Bug 1265315. Part 1 - remove use of MediaDecoderReader from SeekTask. r=kaku.

MozReview-Commit-ID: DlUZYcAVBMB
This commit is contained in:
JW Wang 2016-04-19 16:14:44 +08:00
Родитель ffd7b45558
Коммит c28d55bc29
3 изменённых файлов: 8 добавлений и 24 удалений

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

@ -1471,7 +1471,7 @@ MediaDecoderStateMachine::InitiateSeek(SeekJob aSeekJob)
mSeekTaskRequest.DisconnectIfExists();
// Create a new SeekTask instance for the incoming seek task.
mSeekTask = SeekTask::CreateSeekTask(mDecoderID, OwnerThread(), mReader.get(),
mSeekTask = SeekTask::CreateSeekTask(mDecoderID, OwnerThread(),
mReaderWrapper.get(), Move(aSeekJob),
mInfo, Duration(), GetMediaTime());

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

@ -38,14 +38,13 @@ extern LazyLogModule gMediaSampleLog;
/*static*/ already_AddRefed<SeekTask>
SeekTask::CreateSeekTask(const void* aDecoderID,
AbstractThread* aThread,
MediaDecoderReader* aReader,
MediaDecoderReaderWrapper* aReaderWrapper,
SeekJob&& aSeekJob,
const MediaInfo& aInfo,
const media::TimeUnit& aDuration,
int64_t aCurrentMediaTime)
{
RefPtr<SeekTask> task(new SeekTask(aDecoderID, aThread, aReader,
RefPtr<SeekTask> task(new SeekTask(aDecoderID, aThread,
aReaderWrapper, Move(aSeekJob), aInfo,
aDuration, aCurrentMediaTime));
@ -54,7 +53,6 @@ SeekTask::CreateSeekTask(const void* aDecoderID,
SeekTask::SeekTask(const void* aDecoderID,
AbstractThread* aThread,
MediaDecoderReader* aReader,
MediaDecoderReaderWrapper* aReaderWrapper,
SeekJob&& aSeekJob,
const MediaInfo& aInfo,
@ -62,7 +60,6 @@ SeekTask::SeekTask(const void* aDecoderID,
int64_t aCurrentMediaTime)
: mDecoderID(aDecoderID)
, mOwnerThread(aThread)
, mReader(aReader)
, mReaderWrapper(aReaderWrapper)
, mSeekJob(Move(aSeekJob))
, mCurrentTimeBeforeSeek(aCurrentMediaTime)
@ -140,12 +137,6 @@ SeekTask::HasVideo() const
return mHasVideo;
}
TaskQueue*
SeekTask::DecodeTaskQueue() const
{
return mReader->OwnerThread();
}
AbstractThread*
SeekTask::OwnerThread() const
{
@ -286,7 +277,7 @@ SeekTask::RequestAudioData()
AssertOwnerThread();
SAMPLE_LOG("Queueing audio task - queued=%i, decoder-queued=%o",
!!mSeekedAudioData, mReader->SizeOfAudioQueueInFrames());
!!mSeekedAudioData, mReaderWrapper->SizeOfAudioQueueInFrames());
mAudioDataRequest.Begin(mReaderWrapper->RequestAudioData()
->Then(OwnerThread(), __func__, this,
@ -302,7 +293,7 @@ SeekTask::RequestVideoData()
const media::TimeUnit currentTime = media::TimeUnit::FromMicroseconds(0);
SAMPLE_LOG("Queueing video task - queued=%i, decoder-queued=%o, skip=%i, time=%lld",
!!mSeekedVideoData, mReader->SizeOfVideoQueueInFrames(), skipToNextKeyFrame,
!!mSeekedVideoData, mReaderWrapper->SizeOfVideoQueueInFrames(), skipToNextKeyFrame,
currentTime.ToMicroseconds());
mVideoDataRequest.Begin(
@ -573,12 +564,10 @@ SeekTask::OnAudioNotDecoded(MediaDecoderReader::NotDecodedReason aReason)
// If the decoder is waiting for data, we tell it to call us back when the
// data arrives.
if (aReason == MediaDecoderReader::WAITING_FOR_DATA) {
MOZ_ASSERT(mReader->IsWaitForDataSupported(),
MOZ_ASSERT(mReaderWrapper->IsWaitForDataSupported(),
"Readers that send WAITING_FOR_DATA need to implement WaitForData");
RefPtr<SeekTask> self = this;
mAudioWaitRequest.Begin(InvokeAsync(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::WaitForData,
MediaData::AUDIO_DATA)
mAudioWaitRequest.Begin(mReaderWrapper->WaitForData(MediaData::AUDIO_DATA)
->Then(OwnerThread(), __func__,
[self] (MediaData::Type aType) -> void {
self->mAudioWaitRequest.Complete();
@ -679,12 +668,10 @@ SeekTask::OnVideoNotDecoded(MediaDecoderReader::NotDecodedReason aReason)
// If the decoder is waiting for data, we tell it to call us back when the
// data arrives.
if (aReason == MediaDecoderReader::WAITING_FOR_DATA) {
MOZ_ASSERT(mReader->IsWaitForDataSupported(),
MOZ_ASSERT(mReaderWrapper->IsWaitForDataSupported(),
"Readers that send WAITING_FOR_DATA need to implement WaitForData");
RefPtr<SeekTask> self = this;
mVideoWaitRequest.Begin(InvokeAsync(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::WaitForData,
MediaData::VIDEO_DATA)
mVideoWaitRequest.Begin(mReaderWrapper->WaitForData(MediaData::VIDEO_DATA)
->Then(OwnerThread(), __func__,
[self] (MediaData::Type aType) -> void {
self->mVideoWaitRequest.Complete();

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

@ -48,7 +48,6 @@ public:
static already_AddRefed<SeekTask>
CreateSeekTask(const void* aDecoderID,
AbstractThread* aThread,
MediaDecoderReader* aReader,
MediaDecoderReaderWrapper* aReaderWrapper,
SeekJob&& aSeekJob,
const MediaInfo& aInfo,
@ -68,7 +67,6 @@ public:
protected:
SeekTask(const void* aDecoderID,
AbstractThread* aThread,
MediaDecoderReader* aReader,
MediaDecoderReaderWrapper* aReaderWrapper,
SeekJob&& aSeekJob,
const MediaInfo& aInfo,
@ -134,7 +132,6 @@ protected:
*/
const void* mDecoderID; // For logging.
const RefPtr<AbstractThread> mOwnerThread;
const RefPtr<MediaDecoderReader> mReader;
const RefPtr<MediaDecoderReaderWrapper> mReaderWrapper;
/*