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 322929 - Base audio sink do not resume playback correctly after flush
Base audio sink do not resume playback correctly after flush
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-12-01 13:49 UTC by Michal Benes
Modified: 2006-03-09 15:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to call gst_ring_buffer_set_sample after flushing in baseaudiosink (403 bytes, patch)
2005-12-01 13:53 UTC, Michal Benes
none Details | Review
Updated patch against latest CVS version (782 bytes, patch)
2005-12-07 12:26 UTC, Michal Benes
none Details | Review

Description Michal Benes 2005-12-01 13:49:19 UTC
Base audio sink will start sending segments numbered from 0 after flush. The
ring buffer does not know about this and these segments are not rendered until
segment number reaches the last rendered segment number.

The solution to this is to call gst_ring_buffer_set_sample after flush.
Comment 1 Michal Benes 2005-12-01 13:53:15 UTC
Created attachment 55469 [details] [review]
Patch to call gst_ring_buffer_set_sample after flushing in baseaudiosink

This patch works, though I am not sure if this is the best solution.
Especially, I do not like the condition sink->next_sample == (guint64)-1.

May be, gst_ring_buffer_set_sample should be called in event handler at
FLUSH_STOP?
Comment 2 Michal Benes 2005-12-07 12:26:37 UTC
Created attachment 55742 [details] [review]
Updated patch against latest CVS version
Comment 3 Andy Wingo 2006-01-16 15:33:23 UTC
Assigning to the taymans
Comment 4 Wim Taymans 2006-02-13 12:03:41 UTC
elements that synchronize to the clock and receive a flush need to get their base time redistributed, this usually happens when going from PAUSED->PLAYING. Do you see this behaviour when doing flushing seeks without pausing the element(s)?

Just playing the sample ASAP, as is the case with your patch, will definatly break synchronisation in case of multiple streams and is therefore not acceptable.
Comment 5 Michal Benes 2006-02-21 17:33:48 UTC
In my case, I set the sink (which is alsasink) to READY, then I flush, change the source element and set the sink to PLAYING again. 

The entire pipeline remains in PLAYING state.

Use scenario for this would be changing audio track in live streams.

I do not know if this approach is 100% correct, but I think that baseaudiosink should forget its internal state when going to READY.
Comment 6 Wim Taymans 2006-03-09 14:42:00 UTC
The problem here is that the clock base time is not redistributed in the pipeline since it does not go to PAUSED. 

This means that the pipeline base time and therefore the stream time just increments. The new stream will just be dropped because it arrives too late in the sink.

You can manually reset the stream time of the sink by setting the current clock time with gst_element_set_base_time().

The reason for this is that when there are multiple sinks, they need to have the same base_time to stay synchronized, so it is distributed by the toplevel parent.

Another reason is that when you want to switch in a new stream and have it synchronized with the current playing stream, you have to redistribute the old base_time. 

We need more examples of these mixing use cases...

Going to close, please reopen if more info is needed.
Comment 7 Michal Benes 2006-03-09 15:28:51 UTC
Thanks for the explanation. The synchronization stuff is still a bit unclear to me.