Each time avcodec_open is called update_context_from_thread() adds thread_count - 1 to has_b_frames. This makes has_b_frames progressively grow because the original value of has_b_frame is not preserved and not reset between avcodec_open calls. avcodec_open is called twice in a "normal" usage scenario where av_find_stream_info opens it once and the following decode opens again. In our usage scenario, we avcodec_open/avcodec_close multiple times. This leads to an overflow of the delayed_pic array in h264.c which has a const size of 18.

Also, the const size of delayed_pic is a problem because the size needed is determined by has_b_frames + thread_count - 1. Since thread_count can be arbitrarily large, this should really be dynamically allocated.

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to