Bug 1324629. Part 4 - clean up some functions and comments. r=kaku

MozReview-Commit-ID: HP2Tp8KbRoq

--HG--
extra : rebase_source : e2ac1431611f30a8d9ffb1fb3bcd30b6a52e31c6
extra : intermediate-source : c281654e20d3a91f310f6bd983c3ba2c6915afe7
extra : source : 867b2f18697a1b5a1b87b95ad6af8a4fc60e6162
This commit is contained in:
JW Wang 2016-12-20 15:48:20 +08:00
Родитель d1e5b672ea
Коммит 0323cca4c5
3 изменённых файлов: 4 добавлений и 42 удалений

Просмотреть файл

@ -17,12 +17,6 @@
namespace mozilla {
typedef MozPromise<bool, bool, /* isExclusive = */ false> HaveStartTimePromise;
typedef Variant<MediaData*, MediaResult> AudioCallbackData;
typedef Variant<Tuple<MediaData*, TimeStamp>, MediaResult> VideoCallbackData;
typedef Variant<MediaData::Type, WaitForDataRejectValue> WaitCallbackData;
/**
* A wrapper around MediaDecoderReader to offset the timestamps of Audio/Video
* samples by the start time to ensure MDSM can always assume zero start time.
@ -44,13 +38,11 @@ public:
media::TimeUnit StartTime() const;
RefPtr<MetadataPromise> ReadMetadata();
// NOTE: please set callbacks before requesting audio/video data!
RefPtr<MediaDataPromise> RequestAudioData();
RefPtr<MediaDataPromise>
RequestVideoData(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold);
// NOTE: please set callbacks before invoking WaitForData()!
RefPtr<WaitForDataPromise> WaitForData(MediaData::Type aType);
RefPtr<SeekPromise> Seek(const SeekTarget& aTarget);

Просмотреть файл

@ -2185,8 +2185,6 @@ ShutdownState::Enter()
master->StopPlayback();
}
// To break the cycle-reference between MediaDecoderReaderWrapper and MDSM.
master->CancelMediaDecoderReaderWrapperCallback();
master->mAudioDataRequest.DisconnectIfExists();
master->mVideoDataRequest.DisconnectIfExists();
master->mAudioWaitRequest.DisconnectIfExists();
@ -2350,9 +2348,6 @@ MediaDecoderStateMachine::InitializationTask(MediaDecoder* aDecoder)
mIsVisible.Connect(aDecoder->CanonicalIsVisible());
mWatchManager.Watch(mIsVisible, &MediaDecoderStateMachine::VisibilityChanged);
}
// Configure MediaDecoderReaderWrapper.
SetMediaDecoderReaderWrapperCallback();
}
void
@ -2578,25 +2573,18 @@ void
MediaDecoderStateMachine::OnAudioNotDecoded(const MediaResult& aError)
{
MOZ_ASSERT(OnTaskQueue());
SAMPLE_LOG("OnAudioNotDecoded aError=%u", aError.Code());
mAudioDataRequest.Complete();
OnNotDecoded(MediaData::AUDIO_DATA, aError);
mStateObj->HandleNotDecoded(MediaData::AUDIO_DATA, aError);
}
void
MediaDecoderStateMachine::OnVideoNotDecoded(const MediaResult& aError)
{
MOZ_ASSERT(OnTaskQueue());
SAMPLE_LOG("OnVideoNotDecoded aError=%u", aError.Code());
mVideoDataRequest.Complete();
OnNotDecoded(MediaData::VIDEO_DATA, aError);
}
void
MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
const MediaResult& aError)
{
MOZ_ASSERT(OnTaskQueue());
SAMPLE_LOG("OnNotDecoded (aType=%u, aError=%u)", aType, aError.Code());
mStateObj->HandleNotDecoded(aType, aError);
mStateObj->HandleNotDecoded(MediaData::VIDEO_DATA, aError);
}
void
@ -2713,18 +2701,6 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
return NS_OK;
}
void
MediaDecoderStateMachine::SetMediaDecoderReaderWrapperCallback()
{
MOZ_ASSERT(OnTaskQueue());
}
void
MediaDecoderStateMachine::CancelMediaDecoderReaderWrapperCallback()
{
MOZ_ASSERT(OnTaskQueue());
}
void MediaDecoderStateMachine::StopPlayback()
{
MOZ_ASSERT(OnTaskQueue());

Просмотреть файл

@ -148,9 +148,6 @@ public:
nsresult Init(MediaDecoder* aDecoder);
void SetMediaDecoderReaderWrapperCallback();
void CancelMediaDecoderReaderWrapperCallback();
// Enumeration for the valid decoding states
enum State {
DECODER_STATE_DECODING_METADATA,
@ -331,7 +328,6 @@ private:
void OnVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStartTime);
void OnAudioNotDecoded(const MediaResult& aError);
void OnVideoNotDecoded(const MediaResult& aError);
void OnNotDecoded(MediaData::Type aType, const MediaResult& aError);
void OnAudioWaited(MediaData::Type aType);
void OnVideoWaited(MediaData::Type aType);
void OnNotWaited(const WaitForDataRejectValue& aRejection);
@ -469,11 +465,9 @@ protected:
void EnsureVideoDecodeTaskQueued();
// Start a task to decode audio.
// The decoder monitor must be held.
void RequestAudioData();
// Start a task to decode video.
// The decoder monitor must be held.
void RequestVideoData(bool aSkipToNextKeyframe,
const media::TimeUnit& aCurrentTime);