GNOME Bugzilla – Bug 521761
gstaudioclock frozen the clock value until reaches latest 'last_time'
Last modified: 2008-05-27 16:32:24 UTC
After change the pipeline state back to NULL, the 'last_time' value stored in the clock it not reset. But, the audio base classes reset the number of samples played. Then when setting the pipeline to PLAYING again, the clock value will be frozen 'cause the clock will always return MAX(last_time, time). The solution implemented in attached patches do: 1- create a gst_clock_reset funcion just to make it possible to set last_time to 0 again 2- calls gst_clock_reset, when uses gst_audio_clock is the clock provided, in change_state function from NULL to READY. I'm just waiting the reviews and OK to commit. Thanks
Created attachment 107053 [details] [review] crete gst_clock_reset function
Created attachment 107054 [details] [review] call gst_clock_reset in baseaudio[sink|src] change state funcs
Created attachment 107055 [details] [review] call gst_clock_reset in alsaspdifsink change_state
Maybe it's better to make sure that the subclass never goes back to 0, this would match the clock API better which says that the get_time() function should be monotonically increasing.
Or the sub-class should publish a new clock. I don't think this is a change we should be making during a freeze. It's not a regression, and not a trivial fix. Feel free to convince me otherwise.
Jan, For me it is Ok Jan, for sure it is critical but may be not blocker. Please change the status to critical and go ahead. Wim, ok, I will submit new patches today, then please review it. I will also try to update the documentation, please also review it and point me out to others docs I missed.
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init), (gst_audio_clock_reset), (gst_audio_clock_get_internal_time): * gst-libs/gst/audio/gstaudioclock.h: Add method to inform the clock that the time starts from 0 again. We use this info to calculate a clock offset so that the time we report in internal_time is monotonically increasing, as required by the clock base class. Fixes #521761. API: GstAudioClock::gst_audio_clock_reset() * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_skew_slaving), (gst_base_audio_sink_change_state): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_create), (gst_base_audio_src_change_state): Reset reported time when we (re)create the ringbuffer.
* configure.ac: Require CVS core and base for new audio clock reset method. * ext/alsaspdif/alsaspdifsink.c: (alsaspdifsink_change_state): Reset the audio clock. See #521761.