зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1127203 - Be more consistent about when and how we apply the fuzz factor. r=mattwoodrow
This commit is contained in:
Родитель
419b834c80
Коммит
9acf6dac10
|
@ -225,10 +225,8 @@ MediaSourceReader::OnAudioNotDecoded(NotDecodedReason aReason)
|
||||||
AdjustEndTime(&mLastAudioTime, mAudioReader);
|
AdjustEndTime(&mLastAudioTime, mAudioReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if we can find a different reader that can pick up where we left off. We use the
|
// See if we can find a different reader that can pick up where we left off.
|
||||||
// EOS_FUZZ_US to allow for the fact that our end time can be inaccurate due to bug
|
if (SwitchAudioReader(mLastAudioTime) == READER_NEW) {
|
||||||
// 1065207.
|
|
||||||
if (SwitchAudioReader(mLastAudioTime, EOS_FUZZ_US) == READER_NEW) {
|
|
||||||
mAudioSeekRequest.Begin(mAudioReader->Seek(mLastAudioTime, 0)
|
mAudioSeekRequest.Begin(mAudioReader->Seek(mLastAudioTime, 0)
|
||||||
->RefableThen(GetTaskQueue(), __func__, this,
|
->RefableThen(GetTaskQueue(), __func__, this,
|
||||||
&MediaSourceReader::CompleteAudioSeekAndDoRequest,
|
&MediaSourceReader::CompleteAudioSeekAndDoRequest,
|
||||||
|
@ -337,10 +335,8 @@ MediaSourceReader::OnVideoNotDecoded(NotDecodedReason aReason)
|
||||||
AdjustEndTime(&mLastVideoTime, mVideoReader);
|
AdjustEndTime(&mLastVideoTime, mVideoReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if we can find a different reader that can pick up where we left off. We use the
|
// See if we can find a different reader that can pick up where we left off.
|
||||||
// EOS_FUZZ_US to allow for the fact that our end time can be inaccurate due to bug
|
if (SwitchVideoReader(mLastVideoTime) == READER_NEW) {
|
||||||
// 1065207.
|
|
||||||
if (SwitchVideoReader(mLastVideoTime, EOS_FUZZ_US) == READER_NEW) {
|
|
||||||
mVideoSeekRequest.Begin(mVideoReader->Seek(mLastVideoTime, 0)
|
mVideoSeekRequest.Begin(mVideoReader->Seek(mLastVideoTime, 0)
|
||||||
->RefableThen(GetTaskQueue(), __func__, this,
|
->RefableThen(GetTaskQueue(), __func__, this,
|
||||||
&MediaSourceReader::CompleteVideoSeekAndDoRequest,
|
&MediaSourceReader::CompleteVideoSeekAndDoRequest,
|
||||||
|
@ -472,14 +468,21 @@ MediaSourceReader::HaveData(int64_t aTarget, MediaData::Type aType)
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaSourceReader::SwitchReaderResult
|
MediaSourceReader::SwitchReaderResult
|
||||||
MediaSourceReader::SwitchAudioReader(int64_t aTarget, int64_t aTolerance)
|
MediaSourceReader::SwitchAudioReader(int64_t aTarget)
|
||||||
{
|
{
|
||||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||||
// XXX: Can't handle adding an audio track after ReadMetadata.
|
// XXX: Can't handle adding an audio track after ReadMetadata.
|
||||||
if (!mAudioTrack) {
|
if (!mAudioTrack) {
|
||||||
return READER_ERROR;
|
return READER_ERROR;
|
||||||
}
|
}
|
||||||
nsRefPtr<MediaDecoderReader> newReader = SelectReader(aTarget, aTolerance, mAudioTrack->Decoders());
|
|
||||||
|
// We first search without the tolerance and then search with it, so that, in
|
||||||
|
// the case of perfectly-aligned data, we don't prematurely jump to a new
|
||||||
|
// reader and skip the last few samples of the current one.
|
||||||
|
nsRefPtr<MediaDecoderReader> newReader = SelectReader(aTarget, /* aTolerance = */ 0, mAudioTrack->Decoders());
|
||||||
|
if (!newReader) {
|
||||||
|
newReader = SelectReader(aTarget, EOS_FUZZ_US, mAudioTrack->Decoders());
|
||||||
|
}
|
||||||
if (newReader && newReader != mAudioReader) {
|
if (newReader && newReader != mAudioReader) {
|
||||||
mAudioReader->SetIdle();
|
mAudioReader->SetIdle();
|
||||||
mAudioReader = newReader;
|
mAudioReader = newReader;
|
||||||
|
@ -490,14 +493,21 @@ MediaSourceReader::SwitchAudioReader(int64_t aTarget, int64_t aTolerance)
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaSourceReader::SwitchReaderResult
|
MediaSourceReader::SwitchReaderResult
|
||||||
MediaSourceReader::SwitchVideoReader(int64_t aTarget, int64_t aTolerance)
|
MediaSourceReader::SwitchVideoReader(int64_t aTarget)
|
||||||
{
|
{
|
||||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||||
// XXX: Can't handle adding a video track after ReadMetadata.
|
// XXX: Can't handle adding a video track after ReadMetadata.
|
||||||
if (!mVideoTrack) {
|
if (!mVideoTrack) {
|
||||||
return READER_ERROR;
|
return READER_ERROR;
|
||||||
}
|
}
|
||||||
nsRefPtr<MediaDecoderReader> newReader = SelectReader(aTarget, aTolerance, mVideoTrack->Decoders());
|
|
||||||
|
// We first search without the tolerance and then search with it, so that, in
|
||||||
|
// the case of perfectly-aligned data, we don't prematurely jump to a new
|
||||||
|
// reader and skip the last few samples of the current one.
|
||||||
|
nsRefPtr<MediaDecoderReader> newReader = SelectReader(aTarget, /* aTolerance = */ 0, mVideoTrack->Decoders());
|
||||||
|
if (!newReader) {
|
||||||
|
newReader = SelectReader(aTarget, EOS_FUZZ_US, mVideoTrack->Decoders());
|
||||||
|
}
|
||||||
if (newReader && newReader != mVideoReader) {
|
if (newReader && newReader != mVideoReader) {
|
||||||
mVideoReader->SetIdle();
|
mVideoReader->SetIdle();
|
||||||
mVideoReader = newReader;
|
mVideoReader = newReader;
|
||||||
|
|
|
@ -163,8 +163,8 @@ private:
|
||||||
READER_NEW = 1,
|
READER_NEW = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
SwitchReaderResult SwitchAudioReader(int64_t aTarget, int64_t aTolerance = 0);
|
SwitchReaderResult SwitchAudioReader(int64_t aTarget);
|
||||||
SwitchReaderResult SwitchVideoReader(int64_t aTarget, int64_t aTolerance = 0);
|
SwitchReaderResult SwitchVideoReader(int64_t aTarget);
|
||||||
|
|
||||||
void DoAudioRequest();
|
void DoAudioRequest();
|
||||||
void DoVideoRequest();
|
void DoVideoRequest();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче