After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690267 - interleave: negotiation failure on sinkpads when channel-mask is specified
interleave: negotiation failure on sinkpads when channel-mask is specified
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 1.1.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-12-15 17:23 UTC by Philippe Normand
Modified: 2012-12-18 12:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
interleave: set src pad caps upon last sink pad CAPS event (4.35 KB, patch)
2012-12-15 17:44 UTC, Philippe Normand
needs-work Details | Review
interleave: set src pad caps upon last sink pad CAPS event (5.13 KB, patch)
2012-12-17 10:47 UTC, Philippe Normand
needs-work Details | Review
interleave: set src pad caps upon last sink pad CAPS event (5.16 KB, patch)
2012-12-17 11:44 UTC, Philippe Normand
none Details | Review
interleave: set src pad caps upon last sink pad CAPS event (4.00 KB, patch)
2012-12-17 15:37 UTC, Philippe Normand
needs-work Details | Review
interleave: set src pad caps upon last sink pad CAPS event (4.97 KB, patch)
2012-12-18 11:35 UTC, Philippe Normand
committed Details | Review

Description Philippe Normand 2012-12-15 17:23:36 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.
Comment 1 Philippe Normand 2012-12-15 17:44:02 UTC
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.
Comment 2 Sebastian Dröge (slomo) 2012-12-17 10:20:18 UTC
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
Comment 3 Philippe Normand 2012-12-17 10:47:55 UTC
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.
Comment 4 Sebastian Dröge (slomo) 2012-12-17 11:16:25 UTC
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
Comment 5 Philippe Normand 2012-12-17 11:44:25 UTC
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.
Comment 6 Sebastian Dröge (slomo) 2012-12-17 11:51:35 UTC
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.
Comment 7 Philippe Normand 2012-12-17 12:10:28 UTC
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.
Comment 8 Sebastian Dröge (slomo) 2012-12-17 12:31:59 UTC
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.
Comment 9 Philippe Normand 2012-12-17 15:37:42 UTC
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.
Comment 10 Sebastian Dröge (slomo) 2012-12-18 11:20:37 UTC
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
Comment 11 Philippe Normand 2012-12-18 11:35:20 UTC
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.
Comment 12 Sebastian Dröge (slomo) 2012-12-18 12:13:48 UTC
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