Bug 1307022. Part 3 - Use raw pointers to avoid unnecessary ref-counting.
MozReview-Commit-ID: 4PsJjpvWAZW
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1191,47 +1191,45 @@ MediaDecoderStateMachine::MaybeFinishDec
if (mQueuedSeek.Exists()) {
InitiateSeek(Move(mQueuedSeek));
} else {
SetState(DECODER_STATE_DECODING);
}
}
void
-MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample,
+MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideo,
TimeStamp aDecodeStartTime)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(mState != DECODER_STATE_SEEKING);
-
- RefPtr<MediaData> video(aVideoSample);
- MOZ_ASSERT(video);
+ MOZ_ASSERT(aVideo);
// Handle abnormal or negative timestamps.
- mDecodedVideoEndTime = std::max(mDecodedVideoEndTime, video->GetEndTime());
-
- SAMPLE_LOG("OnVideoDecoded [%lld,%lld]", video->mTime, video->GetEndTime());
+ mDecodedVideoEndTime = std::max(mDecodedVideoEndTime, aVideo->GetEndTime());
+
+ SAMPLE_LOG("OnVideoDecoded [%lld,%lld]", aVideo->mTime, aVideo->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(video, MediaData::VIDEO_DATA);
+ Push(aVideo, MediaData::VIDEO_DATA);
ScheduleStateMachine();
return;
}
case DECODER_STATE_DECODING_FIRSTFRAME: {
- Push(video, MediaData::VIDEO_DATA);
+ Push(aVideo, MediaData::VIDEO_DATA);
MaybeFinishDecodeFirstFrame();
return;
}
case DECODER_STATE_DECODING: {
- Push(video, MediaData::VIDEO_DATA);
+ Push(aVideo, MediaData::VIDEO_DATA);
MaybeStopPrerolling();
// For non async readers, if the requested video sample was slow to
// arrive, increase the amount of audio we buffer to ensure that we
// don't run out of audio. This is unnecessary for async readers,
// since they decode audio and video on different threads so they
// are unlikely to run out of decoded audio.
if (mReader->IsAsync()) {
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -341,17 +341,17 @@ private:
// 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* aAudio);
- void OnVideoDecoded(MediaData* aVideoSample, TimeStamp aDecodeStartTime);
+ void OnVideoDecoded(MediaData* aVideo, 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));
protected: