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 582779 - [resindvd] Add support for other audio codecs than ac3
[resindvd] Add support for other audio codecs than ac3
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.15
Assigned To: Sebastian Dröge (slomo)
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-15 15:10 UTC by Sebastian Dröge (slomo)
Modified: 2009-09-26 15:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
resindvd-audio-codecs.diff (4.80 KB, patch)
2009-05-15 15:11 UTC, Sebastian Dröge (slomo)
none Details | Review
Build a list of available audio decoder elements in rsnaudiodec (7.65 KB, patch)
2009-06-03 11:03 UTC, Jan Schmidt
committed Details | Review

Description Sebastian Dröge (slomo) 2009-05-15 15:10:50 UTC
Hi,
attached patch adds support for other audio codecs than ac3. This doesn't work optimally yet as autoconvert for example drops all events before a child is added and other things... but it's a start :)
Comment 1 Sebastian Dröge (slomo) 2009-05-15 15:11:06 UTC
Created attachment 134710 [details] [review]
resindvd-audio-codecs.diff
Comment 2 Olivier Crête 2009-05-15 15:57:28 UTC
Do you have any idea of how to not lose events before a setcaps in autoconvert ?
Comment 3 Sebastian Dröge (slomo) 2009-05-15 19:12:08 UTC
(In reply to comment #2)
> Do you have any idea of how to not lose events before a setcaps in autoconvert
> ?

Cache them in a list and send them to the child after it was added... that should work, I'll test that tomorrow :)
Comment 4 Sebastian Dröge (slomo) 2009-05-22 17:39:59 UTC
This doesn't seem to work and only makes things worse... 
Comment 5 Jan Schmidt 2009-05-22 20:26:51 UTC
Awesome. How do you mean?
Comment 6 Sebastian Dröge (slomo) 2009-05-23 08:01:28 UTC
(In reply to comment #5)
> Awesome. How do you mean?

Without event caching in autoconvert resindvd doesn't play (gets stuck at position 0) but this can be fixed by seeking. With event caching it stays at 0 and it's impossible to seek :)
Comment 7 Jan Schmidt 2009-05-26 14:34:40 UTC
An important thing that needs doing is to unmask the 'other' stream formats in resindvdsrc.c by disabling this code in rsn_dvdsrc_prepare_streamsinfo_event:

#if 1
    /* FIXME: Only output A52 streams for now, until the decoder switching
     * is ready */
    if (a->audio_format != 0) {
      GST_DEBUG_OBJECT (src, "Ignoring non-A52 stream %d, format %d", i,
          (int) a->audio_format);
      continue;
    }
#endif

Comment 8 Jan Schmidt 2009-06-03 11:03:44 UTC
Created attachment 135868 [details] [review]
Build a list of available audio decoder elements in rsnaudiodec

Updated patch attached that iterates the registry to build the list of available decoder elements for the caps we need and sorts it by rank.

We still need event caching until the first decoder is installed in autoconvert, and also for autoconvert to push segment info into the decoder elements when switching them in, but this is great progress.
Comment 9 Sebastian Dröge (slomo) 2009-08-09 14:17:59 UTC
autoconvert now caches the events and sends them downstream properly.

commit cb1f2f2294befa4b1117e89bbfdf7f85e06b3ee4
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Sun Aug 9 15:20:48 2009 +0200

    autoconvert: Cache events and send them downstream once an element was selec

Unfortunately this doesn't automatically make everything work as expected... with updated autoconvert and the patch from comment #8 everything deadlocks on pad blocks inside the stream selector. Any ideas? :)
Comment 10 Sebastian Dröge (slomo) 2009-08-09 15:06:53 UTC
There are two problems here:

When running in playbin2 the above patch will always result in a deadlock by pad blocks in the playbin2 inputselector pads.

When using the resin-play script everything works as expected... unless pads are ignored because no decoder is available. For example if no ac3 decoder is available and the current dvd track only contains ac3 audio tracks.
Comment 11 Sebastian Dröge (slomo) 2009-09-25 09:11:49 UTC
Ok, after the following commits everything works again with resin-play and totem at least (without Jan's patch)

After applying Jan's patch resin-play still works but totem doesn't.


commit 07f95364764f405d96e6d9b7ad422c4ff87404cf
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Fri Sep 25 11:04:01 2009 +0200

    rsnstreamselector: Use new single object iterator for the internally linked 
    
    This prevents an ugly deadlock.

commit a9e05725d2150caab599f5689af89b013022849b
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Fri Sep 25 10:50:31 2009 +0200

    resindvdbin: Don't block the external ghost pads but only their targets
Comment 12 Sebastian Dröge (slomo) 2009-09-25 09:19:45 UTC
...and this time the problem seems to be the pad blocking in playbin2 on the selector pads. At least that's where the important threads are waiting.

Maybe playbin2 can't cope with resindvdbin adding it's 3 pads from different threads or with resindvdbin unblocking every pad directly after adding it (instead of unblocking them all at once after no-more-pads was signaled).

decodebin2 does exactly that (adding pads all at once, signalling no-more-pads and only then unblock them all). I'll try that soon.
Comment 13 Sebastian Dröge (slomo) 2009-09-26 15:25:29 UTC
Ok, so this should be fixed now in latest GIT. At least it works as good as with the hardcoded audio decoder for me now

commit 1de6d9d4187333373a0bed70babdfef1eed5c063
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Sat Sep 26 17:23:02 2009 +0200

    resindvdbin: Use gst_caps_can_intersect() because it's faster

commit 13150af04a529cce56ac8c58a24239de8492a75a
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Sat Sep 26 17:21:35 2009 +0200

    rsnaudiodec: Use ghost pads and always forward application/x-gst-dvd events 
    
    Fixes bug #582779.

commit 434e604096c645372830ce9ca8764a5895b6754d
Author: Jan Schmidt <thaytan@noraisin.net>
Date:   Sat Sep 26 17:19:32 2009 +0200

    resindvdbin: Use autoconvert in rsnaudiodec and build a list of possible dec
    
    Partially fixes bug #582779.