Bug 1307022. Part 1 - Use raw pointers to avoid unnecessary ref-counting.
MozReview-Commit-ID: 5qLfiTv5o95
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1010,46 +1010,44 @@ MediaDecoderStateMachine::NeedToDecodeAu
return IsAudioDecoding() &&
mState != DECODER_STATE_SEEKING &&
((!mSentFirstFrameLoadedEvent && AudioQueue().GetSize() == 0) ||
(!mMinimizePreroll && !HaveEnoughDecodedAudio()));
}
void
-MediaDecoderStateMachine::OnAudioDecoded(MediaData* aAudioSample)
+MediaDecoderStateMachine::OnAudioDecoded(MediaData* aAudio)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(mState != DECODER_STATE_SEEKING);
-
- RefPtr<MediaData> audio(aAudioSample);
- MOZ_ASSERT(audio);
+ MOZ_ASSERT(aAudio);
// audio->GetEndTime() is not always mono-increasing in chained ogg.
- mDecodedAudioEndTime = std::max(audio->GetEndTime(), mDecodedAudioEndTime);
-
- SAMPLE_LOG("OnAudioDecoded [%lld,%lld]", audio->mTime, audio->GetEndTime());
+ mDecodedAudioEndTime = std::max(aAudio->GetEndTime(), mDecodedAudioEndTime);
+
+ SAMPLE_LOG("OnAudioDecoded [%lld,%lld]", aAudio->mTime, aAudio->GetEndTime());
switch (mState) {
case DECODER_STATE_BUFFERING: {
// If we're buffering, this may be the sample we need to stop buffering.
// Save it and schedule the state machine.
- Push(audio, MediaData::AUDIO_DATA);
+ Push(aAudio, MediaData::AUDIO_DATA);
ScheduleStateMachine();
return;
}
case DECODER_STATE_DECODING_FIRSTFRAME: {
- Push(audio, MediaData::AUDIO_DATA);
+ Push(aAudio, MediaData::AUDIO_DATA);
MaybeFinishDecodeFirstFrame();
return;
}
case DECODER_STATE_DECODING: {
- Push(audio, MediaData::AUDIO_DATA);
+ Push(aAudio, MediaData::AUDIO_DATA);
MaybeStopPrerolling();
return;
}
default: {
// Ignore other cases.
return;
}
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -340,17 +340,17 @@ private:
bool IsShutdown() const;
// Returns true if we're currently playing. The decoder monitor must
// be held.
bool IsPlaying() const;
// TODO: Those callback function may receive demuxed-only data.
// Need to figure out a suitable API name for this case.
- void OnAudioDecoded(MediaData* aAudioSample);
+ void OnAudioDecoded(MediaData* aAudio);
void OnVideoDecoded(MediaData* aVideoSample, TimeStamp aDecodeStartTime);
void OnNotDecoded(MediaData::Type aType, const MediaResult& aError);
// Resets all state related to decoding and playback, emptying all buffers
// and aborting all pending operations on the decode task queue.
void Reset(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
TrackInfo::kVideoTrack));