mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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.
This commit is contained in:
parent
2e621f8dbf
commit
431f3e0e6f
1 changed files with 2 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue