From bb0d9add242a2840e781c8e1581deea2e88d2cdc Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 16 May 2019 10:38:49 +0200 Subject: omxh264enc: no need to check if codeconfig has startcode We currently only support stream-format=byte-stream so there is no point re-checking for it when handling CODECCONFIG buffer. --- omx/gstomxh264enc.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/omx/gstomxh264enc.c b/omx/gstomxh264enc.c index 2711e86..f050e80 100644 --- a/omx/gstomxh264enc.c +++ b/omx/gstomxh264enc.c @@ -857,32 +857,28 @@ gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port, GstOMXH264Enc *self = GST_OMX_H264_ENC (enc); if (buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { - /* The codec data is SPS/PPS with a startcode => bytestream stream format + /* The codec data is SPS/PPS but our output is stream-format=byte-stream. * For bytestream stream format the SPS/PPS is only in-stream and not * in the caps! */ - if (buf->omx_buf->nFilledLen >= 4 && - GST_READ_UINT32_BE (buf->omx_buf->pBuffer + - buf->omx_buf->nOffset) == 0x00000001) { - GstBuffer *hdrs; - GstMapInfo map = GST_MAP_INFO_INIT; + GstBuffer *hdrs; + GstMapInfo map = GST_MAP_INFO_INIT; - GST_DEBUG_OBJECT (self, "got codecconfig in byte-stream format"); + GST_DEBUG_OBJECT (self, "got codecconfig in byte-stream format"); - hdrs = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); + hdrs = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); - 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); + 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); - if (frame) - gst_video_codec_frame_unref (frame); + if (frame) + gst_video_codec_frame_unref (frame); - return GST_FLOW_OK; - } + return GST_FLOW_OK; } else if (self->headers) { gst_video_encoder_set_headers (GST_VIDEO_ENCODER (self), self->headers); self->headers = NULL; -- cgit v1.2.1