gst_clock_id_wait() sleeps for more time than expected

Olivier Crête olivier.crete at collabora.com
Tue Jun 21 00:06:44 UTC 2016


Hello,

On Mon, 2016-06-20 at 07:31 -0700, Baby Octopus wrote:
> Hi,
> 
> I'm getting clock handle using the function gst_system_clock_obtain()
> and using it for sleeping for desired time using gst_clock_id_wait()
> by getting a clock id. This sleep is accurate most of the times, at
> times it sleeps for more time than expected. Occasionally the thread 
> wakes up after 4x the time(Sleeps for 4ms instead of 1ms)!!
>
> My question is the API gst_clock_id_wait() can be trusted for
> accurate sleep? I'm using the same clock handle across multiple
> threads(Document says its MT safe)> 

This is probably your machine being busy and the operating system not
giving you back control fast enough. Try giving the thread you want to
wake up faster realtime priority, that may help. Otherwise your
approach looks sound, but on a non-realtime thread, 4ms of jitter is
perfectly normal.

-- 
Olivier Crête
olivier.crete at collabora.com


More information about the gstreamer-devel mailing list