Caps renegotiation with codec_data results in "not-negotiated"
Graham Leggett
minfrin at sharp.fm
Sun Dec 11 15:09:21 UTC 2016
On 23 Nov 2016, at 10:06 AM, Sebastian Dröge <sebastian at centricular.com> wrote:
> byte-stream h264 has no "codec_data" in the headers, only avc has. The
> information is in-band in this case.
Looking at http://www.sharp.fm/0.07.26.578741662-gst-launch.error.dot.svg we definitely have some oddness with codec_data being added to byte-stream.
It looks like h264parse is the one that is refusing to negotiate, it is receiving a codec_data with a stream-format: byte-stream and then refusing to accept it.
The source of the codec_data is omxh264enc. Looking in gst_omx_video_enc_handle_output_frame() in gstomxvideoenc.c I’m not seeing anything that checks first whether we are byte-stream or avc before adding the codec_data to the caps.
Busy testing this hack workaround to see if it makes a difference:
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index bfad2f3..a16e714 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -554,29 +554,32 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port,
if ((buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG)
&& buf->omx_buf->nFilledLen > 0) {
- GstVideoCodecState *state;
- GstBuffer *codec_data;
- GstMapInfo map = GST_MAP_INFO_INIT;
- GstCaps *caps;
+ if (0) {
+ GstVideoCodecState *state;
+ GstBuffer *codec_data;
+ GstMapInfo map = GST_MAP_INFO_INIT;
+ GstCaps *caps;
- GST_DEBUG_OBJECT (self, "Handling codec data");
+ GST_DEBUG_OBJECT (self, "Handling codec data");
- caps = klass->get_caps (self, self->enc_out_port, self->input_state);
- codec_data = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
+ caps = klass->get_caps (self, self->enc_out_port, self->input_state);
+ codec_data = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
- gst_buffer_map (codec_data, &map, GST_MAP_WRITE);
- memcpy (map.data,
- buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
- buf->omx_buf->nFilledLen);
- gst_buffer_unmap (codec_data, &map);
- state =
- gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,
- self->input_state);
- state->codec_data = codec_data;
- gst_video_codec_state_unref (state);
- if (!gst_video_encoder_negotiate (GST_VIDEO_ENCODER (self))) {
- gst_video_codec_frame_unref (frame);
- return GST_FLOW_NOT_NEGOTIATED;
+ gst_buffer_map (codec_data, &map, GST_MAP_WRITE);
+ memcpy (map.data,
+ buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
+ buf->omx_buf->nFilledLen);
+ gst_buffer_unmap (codec_data, &map);
+ state =
+ gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,
+ self->input_state);
+ state->codec_data = codec_data;
+ gst_video_codec_state_unref (state);
+ if (!gst_video_encoder_negotiate (GST_VIDEO_ENCODER (self))) {
+ gst_video_codec_frame_unref (frame);
+ GST_ERROR_OBJECT (self, "Downstream refused to negotiate our codec_data in the caps");
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
}
flow_ret = GST_FLOW_OK;
} else if (buf->omx_buf->nFilledLen > 0) {
Regards,
Graham
—
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3240 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161211/ca9b07b4/attachment.bin>
More information about the gstreamer-devel
mailing list