mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=1023697 use MediaStream to convert between stream time and seconds in Web Audio r=roc
--HG-- extra : transplant_source : %FE%C77k/%25%B4%25F%FB1%EAAqn%CA%DEH%06%C0
This commit is contained in:
parent
793162cc82
commit
552baaf560
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user