[vlc-devel] [RFC PATCH 01/13] clock: add vlc_clock
quinkblack at foxmail.com
Fri Aug 31 14:36:23 CEST 2018
On 8/31/18 5:59 PM, Denis Charmet wrote:
> On 2018-08-29 11:10, Zhao Zhili wrote:
>> On 2018年06月27日 20:41, Thomas Guillem wrote:
>>> +static vlc_tick_t main_stream_to_system(vlc_clock_main_t * main_clock,
>>> + vlc_tick_t pts)
>>> + if (unlikely(main_clock->offset == VLC_TS_INVALID))
>>> + return VLC_TS_INVALID;
>>> + return (vlc_tick_t) (pts * main_clock->coeff / main_clock->rate
>>> + main_clock->offset);
>> I'm afraid int64_t to float to int64_t won't work well as float can
>> only represent a small integer precisely.
>> main_clock->offset makes it worse since it isn't uncommon to be a
>> large value.
>> (vlc_tick_t)(pts * main_clock->coeff / main_clock->rate) +
>> may be a little better, but the problem is still there.
> Thanks for the review, it's indeed a very interesting point. It seems
> that switching to double might help a lot with that. Any other suggestions?
double should give milliseconds precision at the worst case, but I'm not
I think the math in AvgRescale is incorrect, in both the master branch
and the clock-core branch. I have a patch for it
clock: fix AvgRescale
It doesn't make sense in mathematics, but it may have a special meaning
I missed. And the function is not used in the clock-core branch, so it
doesn't matter anymore if it's finally being removed.
More information about the vlc-devel