diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2015-07-27 18:44:53 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2015-07-27 18:46:17 -0400 |
commit | 431f3e0e6febb3cbcdd14d8aec0dcdfda26175ed (patch) | |
tree | 869439772892ccd35b31935c1aad9fbd8b4978fa /ext/libav/gstavviddec.c | |
parent | 2e621f8dbf07bc341fec412b1edcbb694aa0c2a4 (diff) | |
download | gst-libav-431f3e0e6febb3cbcdd14d8aec0dcdfda26175ed.tar.gz |
avviddec: Only create the AVBuffer once the stride is validated
If it is created earlier and the stride is invalid, then the frame
will be freed and it won't be possible to use it in the fallback path.
Not doing this causes a segfault because it will try to use
already freed memory.
Diffstat (limited to 'ext/libav/gstavviddec.c')
-rw-r--r-- | ext/libav/gstavviddec.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index ee7f2f2..811e51b 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -696,11 +696,6 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, AVFrame * picture, picture->data[c] = GST_VIDEO_FRAME_PLANE_DATA (&dframe->vframe, c); picture->linesize[c] = GST_VIDEO_FRAME_PLANE_STRIDE (&dframe->vframe, c); - if (c == 0) { - picture->buf[c] = - av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0); - } - /* libav does not allow stride changes currently, fall back to * non-direct rendering here: * https://bugzilla.gnome.org/show_bug.cgi?id=704769 @@ -733,6 +728,8 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, AVFrame * picture, picture->data[c]); } + picture->buf[0] = av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0); + /* tell ffmpeg we own this buffer, tranfer the ref we have on the buffer to * the opaque data. */ picture->type = FF_BUFFER_TYPE_USER; |