From 4c9b8052c7fd15fd0fd676b78d4ba8debd3ebb2d Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 16 May 2019 10:38:49 +0200 Subject: [PATCH] omxh264enc: send codec data downstream We are operating in stream-format=byte-stream so the codec data buffer is meant to be part of the buffer flow. The base class will push it when a key frame is requested (as we stored it with gst_video_encoder_set_headers()) but we still have to push it right away as part of the normal buffer flow. Also set the HEADER flag on this buffer. --- omx/gstomxh264enc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/omx/gstomxh264enc.c b/omx/gstomxh264enc.c index f050e80c5d..94963e12e2 100644 --- a/omx/gstomxh264enc.c +++ b/omx/gstomxh264enc.c @@ -863,22 +863,27 @@ gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port, */ GstBuffer *hdrs; GstMapInfo map = GST_MAP_INFO_INIT; + GstFlowReturn flow_ret; GST_DEBUG_OBJECT (self, "got codecconfig in byte-stream format"); hdrs = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); + GST_BUFFER_FLAG_SET (hdrs, GST_BUFFER_FLAG_HEADER); gst_buffer_map (hdrs, &map, GST_MAP_WRITE); memcpy (map.data, buf->omx_buf->pBuffer + buf->omx_buf->nOffset, buf->omx_buf->nFilledLen); gst_buffer_unmap (hdrs, &map); - self->headers = g_list_append (self->headers, hdrs); + self->headers = g_list_append (self->headers, gst_buffer_ref (hdrs)); + frame->output_buffer = hdrs; + flow_ret = + gst_video_encoder_finish_subframe (GST_VIDEO_ENCODER (self), frame); if (frame) gst_video_codec_frame_unref (frame); - return GST_FLOW_OK; + return flow_ret; } else if (self->headers) { gst_video_encoder_set_headers (GST_VIDEO_ENCODER (self), self->headers); self->headers = NULL;