Bug 1105066 - Make SeekPromise return the time we actually seeked to; r=kentuckyfriedtakahe

This commit is contained in:
Matt Woodrow 2015-01-12 10:57:14 +13:00
parent a60b16a806
commit f05ddb6181
17 changed files with 24 additions and 21 deletions

View File

@ -52,7 +52,7 @@ public:
typedef MediaPromise<nsRefPtr<AudioData>, NotDecodedReason> AudioDataPromise;
typedef MediaPromise<nsRefPtr<VideoData>, NotDecodedReason> VideoDataPromise;
typedef MediaPromise<bool, nsresult> SeekPromise;
typedef MediaPromise<int64_t, nsresult> SeekPromise;
typedef MediaPromise<MediaData::Type, WaitForDataRejectValue> WaitForDataPromise;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)

View File

@ -2395,7 +2395,7 @@ void MediaDecoderStateMachine::DecodeSeek()
}
void
MediaDecoderStateMachine::OnSeekCompleted()
MediaDecoderStateMachine::OnSeekCompleted(int64_t aTime)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mWaitingForDecoderSeek = false;

View File

@ -400,7 +400,7 @@ public:
OnNotDecoded(MediaData::VIDEO_DATA, aReason);
}
void OnSeekCompleted();
void OnSeekCompleted(int64_t aTime);
void OnSeekFailed(nsresult aResult);
void OnWaitForDataResolved(MediaData::Type aType)

View File

@ -340,7 +340,7 @@ AndroidMediaReader::Seek(int64_t aTarget, int64_t aStartTime, int64_t aEndTime,
mAudioSeekTimeUs = mVideoSeekTimeUs = aTarget;
}
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(mAudioSeekTimeUs, __func__);
}
AndroidMediaReader::ImageBufferCallback::ImageBufferCallback(mozilla::layers::ImageContainer *aImageContainer) :

View File

@ -529,7 +529,7 @@ AppleMP3Reader::Seek(int64_t aTime,
ResetDecode();
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTime, __func__);
}
void

View File

@ -377,7 +377,7 @@ DirectShowReader::Seek(int64_t aTargetUs,
if (NS_FAILED(res)) {
return SeekPromise::CreateAndReject(res, __func__);
} else {
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTargetUs, __func__);
}
}

View File

@ -906,17 +906,20 @@ MP4Reader::Seek(int64_t aTime,
return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
int64_t seekTime = aTime;
mQueuedVideoSample = nullptr;
if (mDemuxer->HasValidVideo()) {
mDemuxer->SeekVideo(aTime);
mDemuxer->SeekVideo(seekTime);
mQueuedVideoSample = PopSampleLocked(kVideo);
if (mQueuedVideoSample) {
seekTime = mQueuedVideoSample->composition_timestamp;
}
}
if (mDemuxer->HasValidAudio()) {
mDemuxer->SeekAudio(
mQueuedVideoSample ? mQueuedVideoSample->composition_timestamp : aTime);
mDemuxer->SeekAudio(seekTime);
}
LOG("MP4Reader::Seek(%lld) exit", aTime);
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(seekTime, __func__);
}
void

View File

@ -814,7 +814,7 @@ GStreamerReader::Seek(int64_t aTarget,
gst_message_unref(message);
LOG(PR_LOG_DEBUG, "seek completed");
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTarget, __func__);
}
nsresult GStreamerReader::GetBuffered(dom::TimeRanges* aBuffered)

View File

@ -611,7 +611,7 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
}
void
MediaSourceReader::OnSeekCompleted()
MediaSourceReader::OnSeekCompleted(int64_t aTime)
{
mPendingSeeks--;
FinalizeSeek();
@ -637,7 +637,7 @@ MediaSourceReader::FinalizeSeek()
if (NS_FAILED(mSeekResult)) {
mSeekPromise.Reject(mSeekResult, __func__);
} else {
mSeekPromise.Resolve(true, __func__);
mSeekPromise.Resolve(mPendingSeekTime, __func__);
}
mSeekResult = NS_OK;
}

View File

@ -58,7 +58,7 @@ public:
void OnVideoDecoded(VideoData* aSample);
void OnVideoNotDecoded(NotDecodedReason aReason);
void OnSeekCompleted();
void OnSeekCompleted(int64_t aTime);
void OnSeekFailed(nsresult aResult);
virtual bool IsWaitForDataSupported() MOZ_OVERRIDE { return true; }

View File

@ -1434,7 +1434,7 @@ OggReader::Seek(int64_t aTarget,
if (NS_FAILED(res)) {
return SeekPromise::CreateAndReject(res, __func__);
} else {
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTarget, __func__);
}
}

View File

@ -1056,7 +1056,7 @@ MediaCodecReader::Seek(int64_t aTime,
MOZ_ASSERT(mAudioTrack.mTaskQueue->IsEmpty());
DispatchAudioTask();
}
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTime, __func__);
}
bool

View File

@ -572,7 +572,7 @@ MediaOmxReader::Seek(int64_t aTarget, int64_t aStartTime, int64_t aEndTime, int6
mAudioSeekTimeUs = mVideoSeekTimeUs = aTarget;
}
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(mAudioSeekTimeUs, __func__);
}
void MediaOmxReader::SetIdle() {

View File

@ -242,7 +242,7 @@ RawReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCu
if (NS_FAILED(res)) {
return SeekPromise::CreateAndReject(res, __func__);
} else {
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTime, __func__);
}
}

View File

@ -277,7 +277,7 @@ WaveReader::Seek(int64_t aTarget, int64_t aStartTime, int64_t aEndTime, int64_t
if (NS_FAILED(res)) {
return SeekPromise::CreateAndReject(res, __func__);
} else {
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTarget, __func__);
}
}

View File

@ -959,7 +959,7 @@ WebMReader::Seek(int64_t aTarget, int64_t aStartTime, int64_t aEndTime,
if (NS_FAILED(res)) {
return SeekPromise::CreateAndReject(res, __func__);
} else {
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTarget, __func__);
}
}

View File

@ -898,7 +898,7 @@ WMFReader::Seek(int64_t aTargetUs,
if (NS_FAILED(res)) {
return SeekPromise::CreateAndReject(res, __func__);
} else {
return SeekPromise::CreateAndResolve(true, __func__);
return SeekPromise::CreateAndResolve(aTargetUs, __func__);
}
}