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 685273 - Pre-rolling on GAP events doesn't work properly for audio sinks
Pre-rolling on GAP events doesn't work properly for audio sinks
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.0.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 686224 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-10-02 10:23 UTC by Jan Schmidt
Modified: 2012-10-24 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Log file (341.40 KB, application/x-bzip)
2012-10-02 10:23 UTC, Jan Schmidt
  Details
audiobasesink: Start the ring buffer when processing a GAP event. (1.15 KB, patch)
2012-10-02 11:57 UTC, Jan Schmidt
needs-work Details | Review

Description Jan Schmidt 2012-10-02 10:23:58 UTC
Created attachment 225570 [details]
Log file

I have a problem in DVD playback where jumping from a menu into the movie with no audio sends a gap event to the audio sink to trigger preroll but the pipeline never resumes. It looks to me that the audio clock never starts running again, even though the pipeline has gone back to PLAYING state.

This pipeline fails:

gst-launch-1.0 rsndvdbin name=s ! dvdspu ! xvimagesink   s. ! dvdspu0. s. ! pulsesink

This one, using the system clock, works fine:

gst-launch-1.0 rsndvdbin name=s ! dvdspu ! xvimagesink   s. ! dvdspu0. s. ! pulsesink provide-clock=false

Log attached.
Comment 1 Wim Taymans 2012-10-02 10:36:17 UTC
pulsesink doesn't start the clock yet until it receives a buffer and puts something in the ringbuffer. It should probably also start when it receives a GAP event.
Comment 2 Jan Schmidt 2012-10-02 11:57:56 UTC
Created attachment 225577 [details] [review]
audiobasesink: Start the ring buffer when processing a GAP event.

Calling the gst_audio_base_sink_drain() function for a GAP event
causes the ringbuffer to start, the clock to start running, and for
preroll to happen the same way it does for an EOS event.

Fixes: #685273
Comment 3 Jan Schmidt 2012-10-02 12:24:49 UTC
This patch fixes my problem by making the audio sinks start running on a gap event. It seems like a hack though - it seems like the correct fix would be to render the commit the correct amount of silence to the ringbuffer and only trigger it when it overflows, as normal.
Comment 4 Wim Taymans 2012-10-04 08:43:53 UTC
Also calling _drain will make it wait for the clock until the last sample is played, which doesn't sound like a good idea. Better would be to indeed insert silence for the timestamp/duration of the GAP event, you could probably do this by making a new buffer of silence and calling the _render function..
Comment 5 Jan Schmidt 2012-10-04 09:14:16 UTC
I was trying to avoid having baseaudiosink have to know what a silence buffer for any given format looks like.
Comment 6 Wim Taymans 2012-10-04 09:23:18 UTC
gst_audio_format_fill_silence() might help :)
Comment 7 Jan Schmidt 2012-10-04 11:47:31 UTC
Yes, filling a silence buffer would work. It's a good point about draining. It doesn't really matter in this exact instance, since we're talking about prerolling. It matters for other gap events that might arrive later, though.
Comment 8 Sebastian Dröge (slomo) 2012-10-23 16:15:28 UTC
*** Bug 686224 has been marked as a duplicate of this bug. ***
Comment 9 Sebastian Dröge (slomo) 2012-10-23 16:18:56 UTC
Bug #686224 is caused by the same problem, unfortunately the GAP event there has timestamp 0 and duration 0 and it's not really trivial to get the correct timestamp/duration.
Comment 10 Sebastian Dröge (slomo) 2012-10-23 16:29:28 UTC
I can get a valid timestamp and probably also a duration, what would be needed though is that the audiosink clock continues to advance until it receives an EOS event.
Comment 11 Jan Schmidt 2012-10-23 16:35:01 UTC
Once the audio sink starts rendering, it'll keep pumping silence and the audio clock will continue to advance
Comment 12 Sebastian Dröge (slomo) 2012-10-24 09:20:13 UTC
commit 7b12afa4cbc89a24a7b1b253a89a02fc2b2bbd9f
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Wed Oct 24 09:57:23 2012 +0200

    streamsynchronizer: Create a GAP event with a sensible timestamp

commit b793d0bfae531e47eda7afb3af66971f19ec3d07
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Wed Oct 24 11:16:54 2012 +0200

    audiobasesink: Properly handle GAP events
    
    These are now converted into silence buffers if they have
    a duration or cause the ringbuffer and clock to be started
    if they don't have a duration.
    
    Fixes bug #685273.


commit 69246dfef7b91b31b69b0398ab92990b9844b5a5
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Wed Oct 24 11:17:55 2012 +0200

    pulsesink: Flush the ringbuffer on GAP events without duration
    
    This is required to properly start the ringbuffer and clock.