зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1126465 - Factor out the seeking phases into helper methods. r=mattwoodrow
This commit is contained in:
Родитель
ab4d30db7c
Коммит
f98dfa3c8f
|
@ -750,17 +750,23 @@ MediaSourceReader::OnVideoSeekCompleted(int64_t aTime)
|
|||
|
||||
if (mAudioTrack) {
|
||||
mPendingSeekTime = aTime;
|
||||
DoAudioSeek();
|
||||
} else {
|
||||
mPendingSeekTime = -1;
|
||||
mSeekPromise.Resolve(aTime, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaSourceReader::DoAudioSeek()
|
||||
{
|
||||
mAudioIsSeeking = true;
|
||||
SwitchAudioReader(mPendingSeekTime);
|
||||
mAudioReader->Seek(mPendingSeekTime, 0)
|
||||
->Then(GetTaskQueue(), __func__, this,
|
||||
&MediaSourceReader::OnAudioSeekCompleted,
|
||||
&MediaSourceReader::OnSeekFailed);
|
||||
MSE_DEBUG("MediaSourceReader(%p)::Seek audio reader=%p", this, mAudioReader.get());
|
||||
return;
|
||||
}
|
||||
mPendingSeekTime = -1;
|
||||
mSeekPromise.Resolve(aTime, __func__);
|
||||
MSE_DEBUG("MediaSourceReader(%p)::DoAudioSeek reader=%p", this, mAudioReader.get());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -817,18 +823,26 @@ MediaSourceReader::AttemptSeek()
|
|||
mLastVideoTime = mPendingSeekTime;
|
||||
|
||||
if (mVideoTrack) {
|
||||
mVideoIsSeeking = true;
|
||||
SwitchVideoReader(mPendingSeekTime);
|
||||
mVideoReader->Seek(mPendingSeekTime, 0)
|
||||
->Then(GetTaskQueue(), __func__, this,
|
||||
&MediaSourceReader::OnVideoSeekCompleted,
|
||||
&MediaSourceReader::OnSeekFailed);
|
||||
MSE_DEBUG("MediaSourceReader(%p)::Seek video reader=%p", this, mVideoReader.get());
|
||||
DoVideoSeek();
|
||||
} else if (mAudioTrack) {
|
||||
DoAudioSeek();
|
||||
} else {
|
||||
OnVideoSeekCompleted(mPendingSeekTime);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaSourceReader::DoVideoSeek()
|
||||
{
|
||||
mVideoIsSeeking = true;
|
||||
SwitchVideoReader(mPendingSeekTime);
|
||||
mVideoReader->Seek(mPendingSeekTime, 0)
|
||||
->Then(GetTaskQueue(), __func__, this,
|
||||
&MediaSourceReader::OnVideoSeekCompleted,
|
||||
&MediaSourceReader::OnSeekFailed);
|
||||
MSE_DEBUG("MediaSourceReader(%p)::DoVideoSeek reader=%p", this, mVideoReader.get());
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaSourceReader::GetBuffered(dom::TimeRanges* aBuffered)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
void OnVideoDecoded(VideoData* aSample);
|
||||
void OnVideoNotDecoded(NotDecodedReason aReason);
|
||||
|
||||
void DoVideoSeek();
|
||||
void DoAudioSeek();
|
||||
void OnVideoSeekCompleted(int64_t aTime);
|
||||
void OnAudioSeekCompleted(int64_t aTime);
|
||||
void OnSeekFailed(nsresult aResult);
|
||||
|
|
Загрузка…
Ссылка в новой задаче