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 648195 - (hgr) outputselector: make it "swap-safe"
(hgr)
outputselector: make it "swap-safe"
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal major
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-04-19 10:53 UTC by Håvard Graff (hgr)
Modified: 2014-11-25 20:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test-case that defines the desired behavior (7.51 KB, text/plain)
2011-04-19 10:53 UTC, Håvard Graff (hgr)
  Details
patch (19.58 KB, patch)
2011-04-19 10:54 UTC, Håvard Graff (hgr)
none Details | Review
patch (20.07 KB, patch)
2011-04-19 12:01 UTC, Håvard Graff (hgr)
none Details | Review
patch with fixed author (20.08 KB, patch)
2011-04-19 13:56 UTC, Håvard Graff (hgr)
none Details | Review

Description Håvard Graff (hgr) 2011-04-19 10:53:48 UTC
Created attachment 186266 [details]
test-case that defines the desired behavior

With this patch, setting active-pad blocks against any activity on that pad.
After you have sat active-pad, you are guaranteed that all pad-traffic,
aka. chain, bufferalloc and event, have ceased on the pad being switched
from.

This is very useful for dynamic pipelinbuilding, where you now safely can
swap-out, unlink and remove any element without having to worry about a push
or a pad-alloc sneaking in at the last minute, hitting elements that are on
their way out.

All pad-traffic is still kept non-serialized, aka, you can have a pad-alloc
while a push in in progress, while an OOB-event is underway.

Also some general cleanup and bugfixes for MT-safety.

Attached is a test-case for this behavior, as well as a proposed patch.
Comment 1 Håvard Graff (hgr) 2011-04-19 10:54:41 UTC
Created attachment 186267 [details] [review]
patch
Comment 2 Tim-Philipp Müller 2011-04-19 11:01:52 UTC
> With this patch, setting active-pad blocks against any activity on that pad.

That sounds like it might cause problems with backwards-compatibility ..
Comment 3 Håvard Graff (hgr) 2011-04-19 11:16:26 UTC
(In reply to comment #2)
> > With this patch, setting active-pad blocks against any activity on that pad.
> 
> That sounds like it might cause problems with backwards-compatibility ..

I thought about that. We did an external trick to make it "half-safe" (pushes was OK, OOB-events and pad-allocs was not), and that trick could not be used anymore. Aka, it was not compatible with our own code. 

However, that ment removing a lot of hacks trying to do the job that outputselector should have done in the first place (IMO).

I think most users of outputselector would feel the same way. It is now guaranteed to be safe, wheras before it was practically impossible to swap something out safely.

But of course I am happy to modify the patch if there are any actual regressions. I'll even write a test-case for it :)
Comment 4 Håvard Graff (hgr) 2011-04-19 12:01:47 UTC
Created attachment 186271 [details] [review]
patch

Found some unused variables in the previous patch, cleaned them up
Comment 5 Håvard Graff (hgr) 2011-04-19 13:56:26 UTC
Created attachment 186289 [details] [review]
patch with fixed author
Comment 6 Håvard Graff (hgr) 2011-04-24 12:39:20 UTC
Just a comment on the one proper regression this change will have:

If you use pad-blocking on the pad that outputselector is swapping from, and then go on to set a new active pad, you will deadlock with this patch, since the swapping will wait for the chain-method to return, something it never will, since it is being blocked.

The reason one would use pad-blocking with outputselector is of course that it was not swap-safe in the first place, and it is an external way of hacking it to do the right thing.

However, using pad-blocking have some serious drawbacks as well. If there never arrives a buffer on the pad being blocked, you can never safely swap, and you will end up potentially waiting forever.

Using this patch then will enable you to remove the pad-blocking hack, and have the comfort of knowing that it is now 100% safe, and not having to worry about the potential pad-blocking pitfalls.
Comment 7 Sebastian Dröge (slomo) 2011-05-26 11:00:55 UTC
Is there something that can be done to avoid the pad-blocking regression? Doesn't sound like a good idea
Comment 8 Edward Hervey 2012-08-07 08:46:53 UTC
Is this still an issue/concern for 1.0 ? The blocking/probing system has changed quite a bit.
Comment 9 Tobias Mueller 2012-12-21 10:56:39 UTC
Håvard, ping.
Comment 10 Edward Hervey 2014-04-10 06:28:42 UTC
Havard, ping
Comment 11 Håvard Graff (hgr) 2014-04-10 08:49:36 UTC
Pong.

I think the value from this patch is in the attached test. If someone is feeling adventurous, porting that to 1.0 and see if the current outputselector passes would be a confirmation that this is no longer needed. If not, there *could* still be a need for swap-safe outputselectors. :) But feel free to close.
Comment 12 Tim-Philipp Müller 2014-11-25 20:32:42 UTC
Well, let's close this for the time being. I'm sure you or someone else will file a new bug for 1.x if you notice any issues after porting your stuff to 1.x.