mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=972678 round double times to ticks consistently and round to nearest r=padenot
--HG-- extra : transplant_source : Q%B5%155%81%7C%8BQ4%EB%BD%E9h%A7%8E%94%C9%EC%A2q
This commit is contained in:
parent
9635368701
commit
07b1c1b640
@ -519,10 +519,20 @@ TrackTicks
|
||||
AudioNodeStream::TicksFromDestinationTime(MediaStream* aDestination,
|
||||
double aSeconds)
|
||||
{
|
||||
StreamTime streamTime = std::max<MediaTime>(0, SecondsToMediaTime(aSeconds));
|
||||
MOZ_ASSERT(aDestination->AsAudioNodeStream() &&
|
||||
aDestination->AsAudioNodeStream()->SampleRate() == SampleRate());
|
||||
|
||||
double destinationSeconds = std::max(0.0, aSeconds);
|
||||
StreamTime streamTime = SecondsToMediaTime(destinationSeconds);
|
||||
// MediaTime does not have the resolution of double
|
||||
double offset = destinationSeconds - MediaTimeToSeconds(streamTime);
|
||||
|
||||
GraphTime graphTime = aDestination->StreamTimeToGraphTime(streamTime);
|
||||
StreamTime thisStreamTime = GraphTimeToStreamTimeOptimistic(graphTime);
|
||||
TrackTicks ticks = TimeToTicksRoundUp(SampleRate(), thisStreamTime);
|
||||
double thisSeconds = MediaTimeToSeconds(thisStreamTime) + offset;
|
||||
MOZ_ASSERT(thisSeconds >= 0.0);
|
||||
// Round to nearest
|
||||
TrackTicks ticks = thisSeconds * SampleRate() + 0.5;
|
||||
return ticks;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user