[Matroska-devel] Opus in Matroksa Cont.

Timothy B. Terriberry tterribe at xiph.org
Sat May 25 00:08:25 CEST 2013

Frank Galligan wrote:
> Okay, I'm fine with the units being nanoseconds. In theory, at worst we
> would be off one sample due to rounding, but in practice I think we will
> be fine more often than not.

If you have well-defined rounding rules, there's never a reason to be 
off by anything as soon as the timestamp resolution is at least 48000.

If you map samples -> timestamps as ceil(samples*timestamp_res/48000) 
and timestamps -> samples as floor(timestamp*48000/timestamp_res) then 
you will always be sample-accurate. There are other pairs of rules that 
will work, but these are probably the simplest.

More information about the Matroska-devel mailing list