<div dir="ltr"><div><div><div><div><div><div>Hello,<br><br></div>I'm looking at how our pulseaudio client behaves if the CLOCK_REALTIME is changed.<br><br></div><div>So I'm changing set the clock randomly every second and watching the result.<br></div><div><br></div>In some cases our application fails to get the stream latency: our callback, which was set using pa_stream_update_timing_info(), is called (in stream_get_timing_info_callback  [1]) with o->stream->timing_info_valid == FALSE.<br><br></div>My guess is that, in the test a bit above ([2]). we have command==PA_COMMAND_TIMEOUT.<br><br></div>Is there any way to test that hypothesis?<br><br><br></div>It seems indeed that one sets a callback timeout using a pa_rtclock time point [3] (and not just a the timeout duration), which is then (see pa_timeval_rtstore [4]) converted to a CLOCK_REALTIME time point.<br><br>I expect that pa_rtclock uses CLOCK_MONOTONIC internally, but converting it to CLOCK_REALTIME makes the timeout mechanism vulnerable to clock changes.<br><br>There is apparently some mechanism (enabled at [5], back in 2009 [6]) to use pa_rtclock time points for the timeout, but if found no way to enable it for our custom mainloop. Did I miss something?<br><br></div>Moreover, it involves setting some magical bit in the timeval to indicate this is a "rtclock" one. Does someone recall the reason for this trick, as opposed to, say, a (simpler) boolean option when setting up the mainloop? (The question may be stupid, sorry, this is my first foray in pulseaudio).<br><div><br></div><div>Thanks!<br></div><div><div><div><div><br><div>[1] <a href="http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/stream.c#n1959">http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/stream.c#n1959</a><br><br>[2] <a href="http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/stream.c?id=v3.99.2#n1793">http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/stream.c?id=v3.99.2#n1793</a><br><div><div><br>[3] <a href="http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulsecore/pdispatch.c?id=v3.99.2#n385">http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulsecore/pdispatch.c?id=v3.99.2#n385</a><br>pa_gettimeofday<br><br>[4] <a href="http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulsecore/core-rtclock.c?id=v3.99.2#n255">http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulsecore/core-rtclock.c?id=v3.99.2#n255</a><br><br>[5] <a href="http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/context.c?id=v3.99.2#n152">http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/context.c?id=v3.99.2#n152</a><br><br>[6] <a href="http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=f753ef2a23c0c42e5ad35a36327a9fda2e4f2d98">http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=f753ef2a23c0c42e5ad35a36327a9fda2e4f2d98</a><br><br></div></div></div></div></div></div></div></div>