Commit dce9d856 authored by Thiago Santos's avatar Thiago Santos

avviddec: reset coded_width/_height before trying to open codec

If coded_width/_height is supplied, the codec might use it as the
width/height and if it is wrong can lead to segfaults or video

This is specially harmful on renegotiation scenarios where the
resolution changed. There seems to be no specific function for reseting
the AV Context in libav, so just set it directly.
parent 427deb9b
......@@ -395,6 +395,12 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
ffmpegdec->context->release_buffer = gst_ffmpegviddec_release_buffer;
ffmpegdec->context->draw_horiz_band = NULL;
/* reset coded_width/_height to prevent it being reused from last time when
* the codec is opened again, causing a mismatch and possible
* segfault/corruption. (Common scenario when renegotiating caps) */
ffmpegdec->context->coded_width = 0;
ffmpegdec->context->coded_height = 0;
GST_LOG_OBJECT (ffmpegdec, "size %dx%d", ffmpegdec->context->width,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment