diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2016-06-07 16:42:09 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2016-06-07 17:03:40 -0400 |
commit | 462800e9c632fe28bcce2d5523e3b05090052057 (patch) | |
tree | 894402231bafd4eeb5463d1b902b8cf3fc7fd608 /sys | |
parent | a0a590369a453687878d267e874c536ee28c2131 (diff) |
v4l2videodec: Keep part of the input buffer
Instead of completely getting rid of the input buffer, copy
the metadata, the flags and the timestamp into an empty buffer.
This way the decoder base class can copy that information again
to the output buffer.
https://bugzilla.gnome.org/show_bug.cgi?id=758424
Diffstat (limited to 'sys')
-rw-r--r-- | sys/v4l2/gstv4l2videodec.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c index 0a2eace32..d148b66ad 100644 --- a/sys/v4l2/gstv4l2videodec.c +++ b/sys/v4l2/gstv4l2videodec.c @@ -522,6 +522,8 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder, GstV4l2Error error = GST_V4L2_ERROR_INIT; GstV4l2VideoDec *self = GST_V4L2_VIDEO_DEC (decoder); GstFlowReturn ret = GST_FLOW_OK; + gboolean processed = FALSE; + GstBuffer *tmp; GST_DEBUG_OBJECT (self, "Handling frame %d", frame->system_frame_number); @@ -555,8 +557,8 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder, if (codec_data) { gst_buffer_ref (codec_data); } else { - codec_data = frame->input_buffer; - frame->input_buffer = NULL; + codec_data = gst_buffer_ref (frame->input_buffer); + processed = TRUE; } /* Ensure input internal pool is active */ @@ -666,7 +668,7 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder, goto start_task_failed; } - if (frame->input_buffer) { + if (!processed) { GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); ret = gst_v4l2_buffer_pool_process (GST_V4L2_BUFFER_POOL (self->v4l2output-> @@ -680,11 +682,16 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder, } else if (ret != GST_FLOW_OK) { goto process_failed; } - - /* No need to keep input arround */ - gst_buffer_replace (&frame->input_buffer, NULL); } + /* No need to keep input arround */ + tmp = frame->input_buffer; + frame->input_buffer = gst_buffer_new (); + gst_buffer_copy_into (frame->input_buffer, tmp, + GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS | + GST_BUFFER_COPY_META, 0, 0); + gst_buffer_unref (tmp); + gst_video_codec_frame_unref (frame); return ret; |