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 629917 - [output-selector] Recheck pending_pad after pushing a buffer
[output-selector] Recheck pending_pad after pushing a buffer
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 0.10.21
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 631399 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-17 13:00 UTC by Thiago Sousa Santos
Modified: 2010-11-22 20:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
outputselector: Recheck pending switch after pushing buffer (1.60 KB, patch)
2010-09-17 13:18 UTC, Thiago Sousa Santos
committed Details | Review
outputselector: Avoid losing the last_buffer when switching (1.32 KB, patch)
2010-09-17 13:19 UTC, Thiago Sousa Santos
committed Details | Review

Description Thiago Sousa Santos 2010-09-17 13:00:01 UTC
Camerabin uses output-selector to control its multiple internal branches. One of these branches is the image capture one. This one only wants to receive one buffer and camerabin uses pad_probes to make output-selector active pad switching to only allow a single buffer to go through on the image capture branch.

The problem is that output-selector might push 2 buffers on its chain function when resend-latest is true. In pseudocode, here's what output-selector does in its chain:

chain (buf) {
  if (pending_pad_switch) {
    change_active_pad()
    resend_latest_buffer()
  }

  push_new_buffer()
}

As you can see, if we add a buffer probe to the src pad and we change the active pad on it we will still get a second buffer from the chain function on the old (now not active) pad.

I was not sure if this is desirable as I see pad probes as a natural way to control output selector's pads. So I wanted to raise a discussion.

If people agree that this is not a good idea, I'll just do a fix inside camerabin.
Comment 1 Thiago Sousa Santos 2010-09-17 13:18:26 UTC
Created attachment 170481 [details] [review]
outputselector: Recheck pending switch after pushing buffer

This patch makes output-selector always recheck if there's a
pending pad switch after pushing a buffer, preventing that
it pushes a buffer on the 'wrong' pad.
Comment 2 Thiago Sousa Santos 2010-09-17 13:19:02 UTC
Created attachment 170482 [details] [review]
outputselector: Avoid losing the last_buffer when switching

This patch makes outputselector take an extra when pushing
the last_buffer to avoid it losing it during the switch function.

This makes resend-latest properly work if the active-pad is changed
during the switch function buffer pushing (on a pad probe, for example).
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2010-09-29 20:08:30 UTC
Review of attachment 170482 [details] [review]:

The commit message misses a "ref" in the first line after "This patch makes outputselector take an extra". The patch looks okay, the buffer is freed in _chain or _reset().
Comment 4 Thiago Sousa Santos 2010-09-30 19:51:23 UTC
a grep on gstreamer modules shows that no other element currently uses output-selector.
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2010-11-22 12:13:49 UTC
Pushing a buffer on a not-anymore-active branch sounds buggy. So the patches make sense to me.

The current behaviour of output-selector is also causing this test failure and the patches fix them.

Unexpected critical/warning: Changing the `location' property on filesink when a file is open is not supported.
87%: Checks: 8, Failures: 1, Errors: 0
../../../../libs/gst/check/gstcheck.c:72:F:general:test_image_tags_setting:0: Unexpected critical/warning: Changing the `location' property on filesink when a file is open is not supported.
Comment 6 Thiago Sousa Santos 2010-11-22 20:45:39 UTC
commit 8d5cfc6511ca986f1a0511bfd28c5b4209aca803
commit 0451adeabd9ffb443795055295655fbe6347fe3d

Fixed.
Comment 7 Thiago Sousa Santos 2010-11-22 20:46:43 UTC
*** Bug 631399 has been marked as a duplicate of this bug. ***