diff --git a/content/media/AudioNodeStream.cpp b/content/media/AudioNodeStream.cpp index 928e74774fcd..ddab6143e391 100644 --- a/content/media/AudioNodeStream.cpp +++ b/content/media/AudioNodeStream.cpp @@ -556,13 +556,15 @@ AudioNodeStream::TimeFromDestinationTime(AudioNodeStream* aDestination, MOZ_ASSERT(aDestination->SampleRate() == SampleRate()); double destinationSeconds = std::max(0.0, aSeconds); - StreamTime streamTime = SecondsToMediaTime(destinationSeconds); + StreamTime streamTime = + aDestination->SecondsToStreamTimeRoundDown(destinationSeconds); // MediaTime does not have the resolution of double - double offset = destinationSeconds - MediaTimeToSeconds(streamTime); + double offset = + destinationSeconds - aDestination->StreamTimeToSeconds(streamTime); GraphTime graphTime = aDestination->StreamTimeToGraphTime(streamTime); StreamTime thisStreamTime = GraphTimeToStreamTimeOptimistic(graphTime); - double thisSeconds = MediaTimeToSeconds(thisStreamTime) + offset; + double thisSeconds = StreamTimeToSeconds(thisStreamTime) + offset; MOZ_ASSERT(thisSeconds >= 0.0); return thisSeconds; } @@ -588,7 +590,7 @@ AudioNodeStream::DestinationTimeFromTicks(AudioNodeStream* aDestination, StreamTime sourceTime = TicksToTimeRoundDown(SampleRate(), aPosition); GraphTime graphTime = StreamTimeToGraphTime(sourceTime); StreamTime destinationTime = aDestination->GraphTimeToStreamTimeOptimistic(graphTime); - return MediaTimeToSeconds(destinationTime); + return StreamTimeToSeconds(destinationTime); } } diff --git a/content/media/webaudio/AudioContext.cpp b/content/media/webaudio/AudioContext.cpp index 62ccd3d1b399..52976550e733 100644 --- a/content/media/webaudio/AudioContext.cpp +++ b/content/media/webaudio/AudioContext.cpp @@ -534,7 +534,8 @@ AudioContext::DestinationStream() const double AudioContext::CurrentTime() const { - return MediaTimeToSeconds(Destination()->Stream()->GetCurrentTime()) + + MediaStream* stream = Destination()->Stream(); + return stream->StreamTimeToSeconds(stream->GetCurrentTime()) + ExtraCurrentTime(); }