GNOME Bugzilla – Bug 690267
interleave: negotiation failure on sinkpads when channel-mask is specified
Last modified: 2012-12-18 12:13:51 UTC
GST_DEBUG=interleave:4,wavparse:3 gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav filesrc location=mono.wav ! decodebin ! "audio/x-raw, channels=(int)1, rate=(int)44100, layout=(string)interleaved, format=(string)F32LE, channel-mask=(bitmask)0x0000000000000001" ! audioconvert ! queue ! i. filesrc location=mono.wav ! decodebin ! "audio/x-raw, channels=(int)1, rate=(int)44100, layout=(string)interleaved, format=(string)F32LE, channel-mask=(bitmask)0x0000000000000002" ! audioconvert ! queue ! i. 0:00:00.063537894 32410 0x9aabf80 WARN interleave interleave.c:290:gst_interleave_set_channel_positions:<i> Invalid channel positions, using NONE 0:00:00.065703846 32410 0x9bcb320 WARN wavparse gstwavparse.c:2386:gst_wavparse_loop:<wavparse1> error: Internal data flow error. 0:00:00.065723740 32410 0x9bcb320 WARN wavparse gstwavparse.c:2386:gst_wavparse_loop:<wavparse1> error: streaming task paused, reason not-negotiated (-4) I think this is because interleave sets its src pad caps once only when it receives the CAPS event. In this case it attempts to set caps for a stereo stream with pos[0]=0x0000000000000001 and pos[1]=NONE and fails. I wonder if we should set the src pad caps when we receive the last CAPS event instead.
Created attachment 231629 [details] [review] interleave: set src pad caps upon last sink pad CAPS event Gather caps on all sink pads before setting the src pad caps. This is specially needed when the audio channel mapping is set on the sink pads and the element needs to preserve it on its src pad.
Review of attachment 231629 [details] [review]: ::: gst/interleave/interleave.c @@ +834,3 @@ + /* Last caps that are set on a sink pad are used as output caps */ + if (GST_INTERLEAVE_PAD_CAST (data->pad)->channel == self->channels - 1) { This assumes that the caps events come in order of the channels. This is not guaranteed at all
Created attachment 231709 [details] [review] interleave: set src pad caps upon last sink pad CAPS event Gather caps on all sink pads before setting the src pad caps. This is specially needed when the audio channel mapping is set on the sink pads and the element needs to preserve it on its src pad.
Review of attachment 231709 [details] [review]: ::: gst/interleave/interleave.c @@ +836,3 @@ + g_atomic_int_add (&self->configured_sinkpads_counter, 1); + /* Last caps that are set on a sink pad are used as output caps */ + if (self->configured_sinkpads_counter == self->channels) { Should probably use g_atomic_int_get() here then :) Other than that this looks good
Created attachment 231713 [details] [review] interleave: set src pad caps upon last sink pad CAPS event Gather caps on all sink pads before setting the src pad caps. This is specially needed when the audio channel mapping is set on the sink pads and the element needs to preserve it on its src pad.
I think there should still be something that rejects caps if incompatible caps are set later, and I don't think this will work reliably now when adding or removing pads during playback.
Ok, do you mean the cannot_change_caps code removed in this patch? I can probably restore it, not sure why I removed it in the first place.
Yes, and also that this counter is never decremented when (configured) pads are removed. And that the counter is incremented when a configured pad gets a new caps event.
Created attachment 231732 [details] [review] interleave: set src pad caps upon last sink pad CAPS event Gather caps on all sink pads before setting the src pad caps. This is specially needed when the audio channel mapping is set on the sink pads and the element needs to preserve it on its src pad.
Review of attachment 231732 [details] [review]: Looks good except for: ::: gst/interleave/interleave.c @@ +862,3 @@ + if (g_atomic_int_get (&self->configured_sinkpads_counter) == + self->channels) { + ret = gst_interleave_sink_setcaps (self, data->pad, caps); You should just pass the GstAudioInfo here
Created attachment 231796 [details] [review] interleave: set src pad caps upon last sink pad CAPS event Gather caps on all sink pads before setting the src pad caps. This is specially needed when the audio channel mapping is set on the sink pads and the element needs to preserve it on its src pad.
commit 2bd77e1c8a6dda6ca68de3e4048162f3d648b42a Author: Philippe Normand <philn@igalia.com> Date: Mon Dec 17 16:35:56 2012 +0100 interleave: set src pad caps upon last sink pad CAPS event Gather caps on all sink pads before setting the src pad caps. This is specially needed when the audio channel mapping is set on the sink pads and the element needs to preserve it on its src pad. https://bugzilla.gnome.org/show_bug.cgi?id=690267