From c6f55538e35a06e5febfe255748d0433cac39271 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 27 Mar 2012 15:01:01 +0200 Subject: [PATCH] video: keep the buffer reffed in the videoframe This would also ensure that the buffer is not writable while mapped. --- gst-libs/gst/video/video.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index dee80c87f5..61004d7c61 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -1030,9 +1030,6 @@ gst_video_frame_map_id (GstVideoFrame * frame, GstVideoInfo * info, else meta = gst_buffer_get_video_meta_id (buffer, id); - frame->buffer = buffer; - frame->meta = meta; - if (meta) { frame->info.flags = meta->flags; frame->info.finfo = &formats[meta->format].info; @@ -1064,6 +1061,9 @@ gst_video_frame_map_id (GstVideoFrame * frame, GstVideoInfo * info, frame->data[i] = frame->map[0].data + info->offset[i]; } } + frame->buffer = gst_buffer_ref (buffer); + frame->meta = meta; + return TRUE; /* ERRORS */ @@ -1127,6 +1127,7 @@ gst_video_frame_unmap (GstVideoFrame * frame) } else { gst_buffer_unmap (buffer, &frame->map[0]); } + gst_buffer_unref (buffer); } /**