GNOME Bugzilla – Bug 746682
flvdemux: Don't create AAC/H264 caps without codec_data
Last modified: 2015-03-24 15:20:32 UTC
See commit message
Created attachment 300192 [details] [review] flvdemux: Don't create AAC/H264 caps without codec_data Instead delay creating the caps until we read the codec_data from the stream, or fail if we get normal data before the codec_data. AAC raw caps and H264 avc caps always need codec_data, setting caps on the pad without them is going to make negotiation fail most of the time. Even if we later set new caps with the codec_data, that's usually going to be too late.
Review of attachment 300192 [details] [review]: ::: gst/flv/gstflvdemux.c @@ +714,1 @@ + gst_buffer_map (demux->audio_codec_data, &map, GST_MAP_READ); Check the return value while at it please. @@ +932,3 @@ + if G_UNLIKELY + (!demux->audio_pad && demux->no_more_pads) { This is a weird syntax, I didn't know it was valid. Remains that his change does not belong here. @@ +1116,3 @@ + GST_ERROR_OBJECT (demux, "got AAC audio packet before codec data"); + ret = GST_FLOW_ERROR; + goto beach; Is that an error without posting on the bus ? Or is this only failing audio ? Maybe posting at least a warning on the bus would be nice ?
I'll push the gst-indent noise as a separate commit, and post an error message in those two cases. First of all someone needs to check that this patch actually fixes something, I only implemented that based on a bug report on IRC and don't have a sample stream :)
It's not an error anymore and we just ignore packets before we have codec_data. commit ac0141b6a0dbb30372d11501b413a61b06da8d38 Author: Sebastian Dröge <sebastian@centricular.com> Date: Tue Mar 24 16:18:53 2015 +0100 flvdemux: Only set caps once if they don't change Previously we were setting new caps with the same content for every H264 or AAC codec_data we found in the stream, spamming everything and causing renegotiations. commit c9b42951fefaeb4afbad2f84ff845375424f8bcb Author: Sebastian Dröge <sebastian@centricular.com> Date: Tue Mar 24 12:46:19 2015 +0100 flvdemux: Don't create AAC/H264 caps without codec_data Instead delay creating the caps until we read the codec_data from the stream, or fail if we get normal data before the codec_data. AAC raw caps and H264 avc caps always need codec_data, setting caps on the pad without them is going to make negotiation fail most of the time. Even if we later set new caps with the codec_data, that's usually going to be too late. https://bugzilla.gnome.org/show_bug.cgi?id=746682 commit 5e88b532122bab23227a010b1ca9790c595fd780 Author: Sebastian Dröge <sebastian@centricular.com> Date: Tue Mar 24 15:39:22 2015 +0100 flvdemux: Fix indention