diff options
author | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-06-11 08:24:17 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-06-11 09:00:49 -0300 |
commit | dce9d85695d37b39c2a37b413a5b43d74c0db302 (patch) | |
tree | 51526031013a276482b64b587cee6277c01ed011 | |
parent | 427deb9b3401b5fc04317bf668d3cf8ceeb42d82 (diff) |
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
corruption.
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.
https://bugzilla.gnome.org/show_bug.cgi?id=702003
-rw-r--r-- | ext/libav/gstavviddec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 124d767..dc472e4 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -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, ffmpegdec->context->height); |