Backed out changeset 5d97bad42411 (bug 1128380)

This commit is contained in:
Carsten "Tomcat" Book 2015-03-05 08:38:47 +01:00
parent cc03107517
commit d33d75ba98
7 changed files with 14 additions and 37 deletions

View File

@ -262,10 +262,6 @@ public:
// the newer async model.
virtual bool IsAsync() const { return false; }
// Returns true if this decoder reader uses hardware accelerated video
// decoding.
virtual bool VideoIsHardwareAccelerated() const { return false; }
protected:
virtual ~MediaDecoderReader();

View File

@ -220,6 +220,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
mVolume(1.0),
mPlaybackRate(1.0),
mPreservesPitch(true),
mAmpleVideoFrames(MIN_VIDEO_QUEUE_SIZE),
mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS),
mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS),
mQuickBufferingLowDataThresholdUsecs(detail::QUICK_BUFFERING_LOW_DATA_USECS),
@ -580,7 +581,7 @@ bool MediaDecoderStateMachine::HaveEnoughDecodedVideo()
{
AssertCurrentThreadInMonitor();
if (static_cast<uint32_t>(VideoQueue().GetSize()) < GetAmpleVideoFrames() * mPlaybackRate) {
if (static_cast<uint32_t>(VideoQueue().GetSize()) < mAmpleVideoFrames * mPlaybackRate) {
return false;
}
@ -2238,10 +2239,13 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
mInfo = info;
if (HasVideo()) {
mAmpleVideoFrames = (mReader->IsAsync() && mInfo.mVideo.mIsHardwareAccelerated)
? std::max<uint32_t>(sVideoQueueHWAccelSize, MIN_VIDEO_QUEUE_SIZE)
: std::max<uint32_t>(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE);
DECODER_LOG("Video decode isAsync=%d HWAccel=%d videoQueueSize=%d",
mReader->IsAsync(),
mReader->VideoIsHardwareAccelerated(),
GetAmpleVideoFrames());
mInfo.mVideo.mIsHardwareAccelerated,
mAmpleVideoFrames);
}
mDecoder->StartProgressUpdates();
@ -3668,14 +3672,6 @@ void MediaDecoderStateMachine::OnAudioSinkError()
DecodeError();
}
uint32_t MediaDecoderStateMachine::GetAmpleVideoFrames() const
{
AssertCurrentThreadInMonitor();
return (mReader->IsAsync() && mReader->VideoIsHardwareAccelerated())
? std::max<uint32_t>(sVideoQueueHWAccelSize, MIN_VIDEO_QUEUE_SIZE)
: std::max<uint32_t>(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE);
}
} // namespace mozilla
// avoid redefined macro in unified build

View File

@ -904,11 +904,10 @@ protected:
uint32_t mBufferingWait;
int64_t mLowDataThresholdUsecs;
// If we've got more than this number of decoded video frames waiting in
// If we've got more than mAmpleVideoFrames decoded video frames waiting in
// the video queue, we will not decode any more video frames until some have
// been consumed by the play state machine thread.
// Must hold monitor.
uint32_t GetAmpleVideoFrames() const;
uint32_t mAmpleVideoFrames;
// Low audio threshold. If we've decoded less than this much audio we
// consider our audio decode "behind", and we may skip video decoding
@ -947,11 +946,7 @@ protected:
MOZ_ASSERT(result <= mAmpleAudioThresholdUsecs, "Prerolling will never finish");
return result;
}
uint32_t VideoPrerollFrames() const
{
return mScheduler->IsRealTime() ? 0 : GetAmpleVideoFrames() / 2;
}
uint32_t VideoPrerollFrames() const { return mScheduler->IsRealTime() ? 0 : mAmpleVideoFrames / 2; }
bool DonePrerollingAudio()
{

View File

@ -46,6 +46,7 @@ private:
mDisplay = nsIntSize(aWidth, aHeight);
mStereoMode = StereoMode::MONO;
mHasVideo = aHasVideo;
mIsHardwareAccelerated = false;
// TODO: TrackInfo should be initialized by its specific codec decoder.
// This following call should be removed once we have that implemented.
@ -75,6 +76,8 @@ public:
bool mHasVideo;
TrackInfo mTrackInfo;
bool mIsHardwareAccelerated;
};
class AudioInfo {

View File

@ -497,6 +497,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, NS_ERROR_FAILURE);
nsresult rv = mVideo.mDecoder->Init();
NS_ENSURE_SUCCESS(rv, rv);
mInfo.mVideo.mIsHardwareAccelerated = mVideo.mDecoder->IsHardwareAccelerated();
// Collect telemetry from h264 AVCC SPS.
if (!mFoundSPSForTelemetry) {
@ -1099,10 +1100,4 @@ MP4Reader::SetSharedDecoderManager(SharedDecoderManager* aManager)
#endif
}
bool
MP4Reader::VideoIsHardwareAccelerated() const
{
return mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated();
}
} // namespace mozilla

View File

@ -82,8 +82,6 @@ public:
virtual bool IsAsync() const MOZ_OVERRIDE { return true; }
virtual bool VideoIsHardwareAccelerated() const MOZ_OVERRIDE;
private:
bool InitDemuxer();

View File

@ -142,16 +142,10 @@ public:
#endif
virtual bool IsAsync() const MOZ_OVERRIDE {
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
return (!GetAudioReader() || GetAudioReader()->IsAsync()) &&
(!GetVideoReader() || GetVideoReader()->IsAsync());
}
virtual bool VideoIsHardwareAccelerated() const MOZ_OVERRIDE {
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
return GetVideoReader() && GetVideoReader()->VideoIsHardwareAccelerated();
}
// Returns true if aReader is a currently active audio or video
bool IsActiveReader(MediaDecoderReader* aReader);