Bug 1320466 part 2 - implement media data decoded/not-decoded handlers in SeekTask; r=jwwang

MozReview-Commit-ID: ImzEoZQUOtT

--HG--
extra : rebase_source : 937a3c5f9512866966980e944c5aac51de001fdf
This commit is contained in:
Kaku Kuo 2016-11-26 13:26:46 +08:00
parent 011ca5f67b
commit ce421c2f78
5 changed files with 69 additions and 0 deletions

View File

@ -112,6 +112,27 @@ AccurateSeekTask::CalculateNewCurrentTime() const
return 0;
}
void
AccurateSeekTask::HandleAudioDecoded(MediaData* aAudio)
{
AssertOwnerThread();
OnAudioDecoded(aAudio);
}
void
AccurateSeekTask::HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart)
{
AssertOwnerThread();
OnVideoDecoded(aVideo);
}
void
AccurateSeekTask::HandleNotDecoded(MediaData::Type aType, const MediaResult& aError)
{
AssertOwnerThread();
OnNotDecoded(aType, aError);
}
RefPtr<AccurateSeekTask::SeekTaskPromise>
AccurateSeekTask::Seek(const media::TimeUnit& aDuration)
{

View File

@ -31,6 +31,12 @@ public:
int64_t CalculateNewCurrentTime() const override;
void HandleAudioDecoded(MediaData* aAudio) override;
void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override;
void HandleNotDecoded(MediaData::Type aType, const MediaResult& aError) override;
private:
~AccurateSeekTask();

View File

@ -78,6 +78,36 @@ NextFrameSeekTask::CalculateNewCurrentTime() const
return mTarget.GetTime().ToMicroseconds();
}
void
NextFrameSeekTask::HandleAudioDecoded(MediaData* aAudio)
{
AssertOwnerThread();
OnAudioDecoded(aAudio);
}
void
NextFrameSeekTask::HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart)
{
AssertOwnerThread();
OnVideoDecoded(aVideo);
}
void
NextFrameSeekTask::HandleNotDecoded(MediaData::Type aType, const MediaResult& aError)
{
AssertOwnerThread();
switch (aType) {
case MediaData::AUDIO_DATA:
OnAudioNotDecoded(aError);
break;
case MediaData::VIDEO_DATA:
OnVideoNotDecoded(aError);
break;
default:
MOZ_ASSERT_UNREACHABLE("We cannot handle RAW_DATA or NULL_DATA here.");
}
}
/*
* Remove samples from the queue until aCompare() returns false.
* aCompare A function object with the signature bool(int64_t) which returns

View File

@ -42,6 +42,12 @@ public:
int64_t CalculateNewCurrentTime() const override;
void HandleAudioDecoded(MediaData* aAudio) override;
void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override;
void HandleNotDecoded(MediaData::Type aType, const MediaResult& aError) override;
private:
~NextFrameSeekTask();

View File

@ -62,6 +62,12 @@ public:
const SeekTarget& GetSeekTarget();
virtual void HandleAudioDecoded(MediaData* aAudio) = 0;
virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) = 0;
virtual void HandleNotDecoded(MediaData::Type aType, const MediaResult& aError) = 0;
protected:
SeekTask(const void* aDecoderID,
AbstractThread* aThread,