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.
This commit is contained in:
Guillaume Desmottes 2019-05-16 10:38:49 +02:00 committed by GStreamer Merge Bot
parent bb0d9add24
commit 4c9b8052c7

View file

@ -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;