зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1203418. Part 3 - ensure MDSM::mPlaybackOffset and MediaDecoder::mPlaybackPosition are mono-increasing to avoid "jitter" in calculating playback statistics. r=cpearce.
This commit is contained in:
Родитель
85ea4009c2
Коммит
7b0eb74aba
|
@ -695,9 +695,8 @@ MediaDecoderStateMachine::OnAudioPopped(const nsRefPtr<MediaData>& aSample)
|
|||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
int64_t offset = std::max<int64_t>(0, aSample->mOffset);
|
||||
mPlaybackOffset = offset;
|
||||
mDecoder->UpdatePlaybackOffset(offset);
|
||||
mPlaybackOffset = std::max(mPlaybackOffset, aSample->mOffset);
|
||||
mDecoder->UpdatePlaybackOffset(mPlaybackOffset);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchAudioDecodeTaskIfNeeded();
|
||||
}
|
||||
|
@ -707,8 +706,8 @@ MediaDecoderStateMachine::OnVideoPopped(const nsRefPtr<MediaData>& aSample)
|
|||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mPlaybackOffset = aSample->mOffset;
|
||||
mDecoder->UpdatePlaybackOffset(aSample->mOffset);
|
||||
mPlaybackOffset = std::max(mPlaybackOffset, aSample->mOffset);
|
||||
mDecoder->UpdatePlaybackOffset(mPlaybackOffset);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchVideoDecodeTaskIfNeeded();
|
||||
}
|
||||
|
@ -2449,6 +2448,9 @@ MediaDecoderStateMachine::Reset()
|
|||
mVideoWaitRequest.DisconnectIfExists();
|
||||
mSeekRequest.DisconnectIfExists();
|
||||
|
||||
mPlaybackOffset = 0;
|
||||
mDecoder->UpdatePlaybackOffset(mPlaybackOffset);
|
||||
|
||||
nsCOMPtr<nsIRunnable> resetTask =
|
||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::ResetDecode);
|
||||
DecodeTaskQueue()->Dispatch(resetTask.forget());
|
||||
|
|
Загрузка…
Ссылка в новой задаче