Bug 1113527 - Change isDormantNeeded() behavior. r=sotaro. r=cpearce.

From 8bf5259ba58ae5b37eaceece04a7f217c3ad4284 Mon Sep 17 00:00:00 2001
This commit is contained in:
Blake Wu 2015-01-30 18:24:31 +08:00
parent 1248c3e7ef
commit 3f18c2cc36
9 changed files with 9 additions and 35 deletions

View File

@ -247,12 +247,6 @@ GonkMediaDataDecoder::IsWaitingMediaResources() {
return mDecoder->IsWaitingResources();
}
bool
GonkMediaDataDecoder::IsDormantNeeded()
{
return mDecoder.get() ? true : false;
}
void
GonkMediaDataDecoder::AllocateMediaResources()
{

View File

@ -98,7 +98,7 @@ public:
virtual bool IsWaitingMediaResources() MOZ_OVERRIDE;
virtual bool IsDormantNeeded() MOZ_OVERRIDE;
virtual bool IsDormantNeeded() { return true;}
virtual void AllocateMediaResources() MOZ_OVERRIDE;

View File

@ -656,6 +656,9 @@ void GonkVideoDecoderManager::ReleaseAllPendingVideoBuffers()
void GonkVideoDecoderManager::ReleaseMediaResources() {
GVDM_LOG("ReleseMediaResources");
if (mDecoder == nullptr) {
return;
}
ReleaseAllPendingVideoBuffers();
mDecoder->ReleaseMediaResources();
}

View File

@ -327,12 +327,6 @@ MediaCodecReader::UpdateIsWaitingMediaResources()
(!mVideoTrack.mCodec->allocated());
}
bool
MediaCodecReader::IsDormantNeeded()
{
return mVideoTrack.mSource != nullptr;
}
void
MediaCodecReader::ReleaseMediaResources()
{
@ -1263,7 +1257,8 @@ MediaCodecReader::CreateMediaSources()
mAudioOffloadTrack.mSource = mExtractor->getTrack(audioTrackIndex);
}
if (videoTrackIndex != invalidTrackIndex && mVideoTrack.mSource == nullptr) {
if (videoTrackIndex != invalidTrackIndex && mVideoTrack.mSource == nullptr &&
mDecoder->GetImageContainer()) {
sp<MediaSource> videoSource = mExtractor->getTrack(videoTrackIndex);
if (videoSource != nullptr && videoSource->start() == OK) {
mVideoTrack.mSource = videoSource;

View File

@ -65,7 +65,7 @@ public:
virtual bool IsWaitingMediaResources();
// True when this reader need to become dormant state
virtual bool IsDormantNeeded();
virtual bool IsDormantNeeded() { return true;}
// Release media resources they should be released in dormant state
virtual void ReleaseMediaResources();

View File

@ -207,14 +207,6 @@ void MediaOmxReader::UpdateIsWaitingMediaResources()
}
}
bool MediaOmxReader::IsDormantNeeded()
{
if (!mOmxDecoder.get()) {
return false;
}
return mOmxDecoder->IsDormantNeeded();
}
void MediaOmxReader::ReleaseMediaResources()
{
ResetDecode();

View File

@ -92,7 +92,7 @@ public:
// Return mIsWaitingResources.
virtual bool IsWaitingMediaResources() MOZ_OVERRIDE;
virtual bool IsDormantNeeded();
virtual bool IsDormantNeeded() { return true;}
virtual void ReleaseMediaResources();
virtual void PreReadMetadata() MOZ_OVERRIDE;

View File

@ -150,7 +150,7 @@ bool OmxDecoder::Init(sp<MediaExtractor>& extractor) {
mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
if (videoTrackIndex != -1) {
if (videoTrackIndex != -1 && mDecoder->GetImageContainer()) {
mVideoTrack = extractor->getTrack(videoTrackIndex);
}
@ -219,14 +219,6 @@ bool OmxDecoder::EnsureMetadata() {
return true;
}
bool OmxDecoder::IsDormantNeeded()
{
if (mVideoTrack.get()) {
return true;
}
return false;
}
bool OmxDecoder::IsWaitingMediaResources()
{
if (mVideoSource.get()) {

View File

@ -154,8 +154,6 @@ public:
// Note: RTSP requires a custom extractor because it doesn't have a container.
bool Init(sp<MediaExtractor>& extractor);
bool IsDormantNeeded();
// Called after resources(video/audio codec) are allocated, set the
// mDurationUs and video/audio metadata.
bool EnsureMetadata();