mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 943461. Part 15: Make MediaDecoder set its currentTime based on the decoded stream's time directly, if we are decoding to a stream. r=cpearce
--HG-- extra : rebase_source : 35fe51dbec3107d7dae801a5a179c5ef5fa53725
This commit is contained in:
parent
b33d4283d0
commit
81d72a6306
@ -1283,7 +1283,12 @@ void MediaDecoder::PlaybackPositionChanged()
|
||||
// and we don't want to override the seek algorithm and change the
|
||||
// current time after the seek has started but before it has
|
||||
// completed.
|
||||
mCurrentTime = mDecoderStateMachine->GetCurrentTime();
|
||||
if (GetDecodedStream()) {
|
||||
mCurrentTime = mDecoderStateMachine->GetCurrentTimeViaMediaStreamSync()/
|
||||
static_cast<double>(USECS_PER_S);
|
||||
} else {
|
||||
mCurrentTime = mDecoderStateMachine->GetCurrentTime();
|
||||
}
|
||||
}
|
||||
mDecoderStateMachine->ClearPositionChangeFlag();
|
||||
}
|
||||
|
@ -1336,6 +1336,15 @@ void MediaDecoderStateMachine::SetSyncPointForMediaStream()
|
||||
mSyncPointInDecodedStream = mStartTime + mPlayDuration;
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetCurrentTimeViaMediaStreamSync()
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
NS_ASSERTION(mSyncPointInDecodedStream >= 0, "Should have set up sync point");
|
||||
DecodedStreamData* stream = mDecoder->GetDecodedStream();
|
||||
StreamTime streamDelta = stream->GetLastOutputTime() - mSyncPointInMediaStream;
|
||||
return mSyncPointInDecodedStream + MediaTimeToMicroseconds(streamDelta);
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::StartPlayback()
|
||||
{
|
||||
DECODER_LOG(PR_LOG_DEBUG, ("%p StartPlayback()", mDecoder.get()));
|
||||
@ -2461,9 +2470,7 @@ int64_t MediaDecoderStateMachine::GetClock() {
|
||||
if (!IsPlaying()) {
|
||||
clock_time = mPlayDuration + mStartTime;
|
||||
} else if (stream) {
|
||||
NS_ASSERTION(mSyncPointInDecodedStream >= 0, "Should have set up sync point");
|
||||
StreamTime streamDelta = stream->GetLastOutputTime() - mSyncPointInMediaStream;
|
||||
clock_time = mSyncPointInDecodedStream + MediaTimeToMicroseconds(streamDelta);
|
||||
clock_time = GetCurrentTimeViaMediaStreamSync();
|
||||
} else {
|
||||
int64_t audio_time = GetAudioClock();
|
||||
if (HasAudio() && !mAudioCompleted && audio_time != -1) {
|
||||
|
@ -334,6 +334,7 @@ public:
|
||||
// call this while we're not playing (while the MediaStream is blocked). Can
|
||||
// be called on any thread with the decoder monitor held.
|
||||
void SetSyncPointForMediaStream();
|
||||
int64_t GetCurrentTimeViaMediaStreamSync();
|
||||
|
||||
// Called when a "MozAudioAvailable" event listener is added to the media
|
||||
// element. Called on the main thread.
|
||||
|
Loading…
Reference in New Issue
Block a user