Bug 1341200. Part 7 - merge ShutdownDecoderWithPromise() and ShutdownDecoder(). r=jya

MozReview-Commit-ID: 9YRwPJGqrhq

--HG--
extra : rebase_source : 01bc1131ae5443b794369d35c524d7a84aa6ab59
extra : intermediate-source : b46551e3810b5695e9ffd9f13858047ae77b0373
extra : source : d76c075fc8c0a3fa9d1e24aecfdb226b9ef232c8
This commit is contained in:
JW Wang 2017-02-25 07:59:53 +08:00
Родитель 9b1586e228
Коммит 8f139e4859
2 изменённых файлов: 12 добавлений и 20 удалений

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

@ -1113,7 +1113,7 @@ MediaFormatReader::Shutdown()
mAudio.mTrackDemuxer->BreakCycles();
mAudio.mTrackDemuxer = nullptr;
mAudio.ResetState();
ShutdownDecoderWithPromise(TrackInfo::kAudioTrack);
ShutdownDecoder(TrackInfo::kAudioTrack);
}
if (HasVideo()) {
@ -1121,7 +1121,7 @@ MediaFormatReader::Shutdown()
mVideo.mTrackDemuxer->BreakCycles();
mVideo.mTrackDemuxer = nullptr;
mVideo.ResetState();
ShutdownDecoderWithPromise(TrackInfo::kVideoTrack);
ShutdownDecoder(TrackInfo::kVideoTrack);
}
mShutdownPromisePool->Track(mDemuxer->Shutdown());
@ -1138,11 +1138,20 @@ MediaFormatReader::Shutdown()
}
void
MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack)
MediaFormatReader::ShutdownDecoder(TrackType aTrack)
{
LOGV("%s", TrackTypeToStr(aTrack));
auto& decoder = GetDecoderData(aTrack);
if (!decoder.mDecoder) {
LOGV("Already shut down");
return;
}
if (!decoder.mShutdownPromise.IsEmpty()) {
LOGV("Shutdown already in progress");
return;
}
if (!decoder.mFlushed && decoder.mDecoder) {
// The decoder has yet to be flushed.
// We always flush the decoder prior to a shutdown to ensure that all the
@ -1173,22 +1182,6 @@ MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack)
mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__));
}
void
MediaFormatReader::ShutdownDecoder(TrackType aTrack)
{
LOG("%s", TrackTypeToStr(aTrack));
auto& decoder = GetDecoderData(aTrack);
if (!decoder.mDecoder) {
LOGV("Already shut down");
return;
}
if (!decoder.mShutdownPromise.IsEmpty()) {
LOGV("Shutdown already in progress");
return;
}
ShutdownDecoderWithPromise(aTrack);
}
RefPtr<ShutdownPromise>
MediaFormatReader::TearDownDecoders()
{

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

@ -549,7 +549,6 @@ private:
bool mHasStartTime = false;
void ShutdownDecoder(TrackType aTrack);
void ShutdownDecoderWithPromise(TrackType aTrack);
RefPtr<ShutdownPromise> TearDownDecoders();
};