gst_clock_id_wait() sleeps for more time than expected

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gst_clock_id_wait() sleeps for more time than expected

Baby Octopus
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)
Reply | Threaded
Open this post in threaded view
|

Re: gst_clock_id_wait() sleeps for more time than expected

Olivier Crête-3
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
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel