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

View file

@ -857,32 +857,28 @@ gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port,
GstOMXH264Enc *self = GST_OMX_H264_ENC (enc); GstOMXH264Enc *self = GST_OMX_H264_ENC (enc);
if (buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { 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 * For bytestream stream format the SPS/PPS is only in-stream and not
* in the caps! * in the caps!
*/ */
if (buf->omx_buf->nFilledLen >= 4 && GstBuffer *hdrs;
GST_READ_UINT32_BE (buf->omx_buf->pBuffer + GstMapInfo map = GST_MAP_INFO_INIT;
buf->omx_buf->nOffset) == 0x00000001) {
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); gst_buffer_map (hdrs, &map, GST_MAP_WRITE);
memcpy (map.data, memcpy (map.data,
buf->omx_buf->pBuffer + buf->omx_buf->nOffset, buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
buf->omx_buf->nFilledLen); buf->omx_buf->nFilledLen);
gst_buffer_unmap (hdrs, &map); gst_buffer_unmap (hdrs, &map);
self->headers = g_list_append (self->headers, hdrs); self->headers = g_list_append (self->headers, hdrs);
if (frame) if (frame)
gst_video_codec_frame_unref (frame); gst_video_codec_frame_unref (frame);
return GST_FLOW_OK; return GST_FLOW_OK;
}
} else if (self->headers) { } else if (self->headers) {
gst_video_encoder_set_headers (GST_VIDEO_ENCODER (self), self->headers); gst_video_encoder_set_headers (GST_VIDEO_ENCODER (self), self->headers);
self->headers = NULL; self->headers = NULL;