mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1128380: Make AmpleVideoFrames calculation dynamic. r=cpearce
This commit is contained in:
parent
d77c2f7f49
commit
bd7cb8851d
@ -262,6 +262,10 @@ public:
|
|||||||
// the newer async model.
|
// the newer async model.
|
||||||
virtual bool IsAsync() const { return false; }
|
virtual bool IsAsync() const { return false; }
|
||||||
|
|
||||||
|
// Returns true if this decoder reader uses hardware accelerated video
|
||||||
|
// decoding.
|
||||||
|
virtual bool VideoIsHardwareAccelerated() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~MediaDecoderReader();
|
virtual ~MediaDecoderReader();
|
||||||
|
|
||||||
|
@ -220,7 +220,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||||||
mVolume(1.0),
|
mVolume(1.0),
|
||||||
mPlaybackRate(1.0),
|
mPlaybackRate(1.0),
|
||||||
mPreservesPitch(true),
|
mPreservesPitch(true),
|
||||||
mAmpleVideoFrames(MIN_VIDEO_QUEUE_SIZE),
|
|
||||||
mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS),
|
mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS),
|
||||||
mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS),
|
mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS),
|
||||||
mQuickBufferingLowDataThresholdUsecs(detail::QUICK_BUFFERING_LOW_DATA_USECS),
|
mQuickBufferingLowDataThresholdUsecs(detail::QUICK_BUFFERING_LOW_DATA_USECS),
|
||||||
@ -581,7 +580,7 @@ bool MediaDecoderStateMachine::HaveEnoughDecodedVideo()
|
|||||||
{
|
{
|
||||||
AssertCurrentThreadInMonitor();
|
AssertCurrentThreadInMonitor();
|
||||||
|
|
||||||
if (static_cast<uint32_t>(VideoQueue().GetSize()) < mAmpleVideoFrames * mPlaybackRate) {
|
if (static_cast<uint32_t>(VideoQueue().GetSize()) < GetAmpleVideoFrames() * mPlaybackRate) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2239,13 +2238,10 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
|
|||||||
mInfo = info;
|
mInfo = info;
|
||||||
|
|
||||||
if (HasVideo()) {
|
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",
|
DECODER_LOG("Video decode isAsync=%d HWAccel=%d videoQueueSize=%d",
|
||||||
mReader->IsAsync(),
|
mReader->IsAsync(),
|
||||||
mInfo.mVideo.mIsHardwareAccelerated,
|
mReader->VideoIsHardwareAccelerated(),
|
||||||
mAmpleVideoFrames);
|
GetAmpleVideoFrames());
|
||||||
}
|
}
|
||||||
|
|
||||||
mDecoder->StartProgressUpdates();
|
mDecoder->StartProgressUpdates();
|
||||||
@ -3672,6 +3668,14 @@ void MediaDecoderStateMachine::OnAudioSinkError()
|
|||||||
DecodeError();
|
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
|
} // namespace mozilla
|
||||||
|
|
||||||
// avoid redefined macro in unified build
|
// avoid redefined macro in unified build
|
||||||
|
@ -904,10 +904,11 @@ protected:
|
|||||||
uint32_t mBufferingWait;
|
uint32_t mBufferingWait;
|
||||||
int64_t mLowDataThresholdUsecs;
|
int64_t mLowDataThresholdUsecs;
|
||||||
|
|
||||||
// If we've got more than mAmpleVideoFrames decoded video frames waiting in
|
// If we've got more than this number of decoded video frames waiting in
|
||||||
// the video queue, we will not decode any more video frames until some have
|
// the video queue, we will not decode any more video frames until some have
|
||||||
// been consumed by the play state machine thread.
|
// been consumed by the play state machine thread.
|
||||||
uint32_t mAmpleVideoFrames;
|
// Must hold monitor.
|
||||||
|
uint32_t GetAmpleVideoFrames() const;
|
||||||
|
|
||||||
// Low audio threshold. If we've decoded less than this much audio we
|
// Low audio threshold. If we've decoded less than this much audio we
|
||||||
// consider our audio decode "behind", and we may skip video decoding
|
// consider our audio decode "behind", and we may skip video decoding
|
||||||
@ -946,7 +947,11 @@ protected:
|
|||||||
MOZ_ASSERT(result <= mAmpleAudioThresholdUsecs, "Prerolling will never finish");
|
MOZ_ASSERT(result <= mAmpleAudioThresholdUsecs, "Prerolling will never finish");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint32_t VideoPrerollFrames() const { return mScheduler->IsRealTime() ? 0 : mAmpleVideoFrames / 2; }
|
|
||||||
|
uint32_t VideoPrerollFrames() const
|
||||||
|
{
|
||||||
|
return mScheduler->IsRealTime() ? 0 : GetAmpleVideoFrames() / 2;
|
||||||
|
}
|
||||||
|
|
||||||
bool DonePrerollingAudio()
|
bool DonePrerollingAudio()
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,6 @@ private:
|
|||||||
mDisplay = nsIntSize(aWidth, aHeight);
|
mDisplay = nsIntSize(aWidth, aHeight);
|
||||||
mStereoMode = StereoMode::MONO;
|
mStereoMode = StereoMode::MONO;
|
||||||
mHasVideo = aHasVideo;
|
mHasVideo = aHasVideo;
|
||||||
mIsHardwareAccelerated = false;
|
|
||||||
|
|
||||||
// TODO: TrackInfo should be initialized by its specific codec decoder.
|
// TODO: TrackInfo should be initialized by its specific codec decoder.
|
||||||
// This following call should be removed once we have that implemented.
|
// This following call should be removed once we have that implemented.
|
||||||
@ -76,8 +75,6 @@ public:
|
|||||||
bool mHasVideo;
|
bool mHasVideo;
|
||||||
|
|
||||||
TrackInfo mTrackInfo;
|
TrackInfo mTrackInfo;
|
||||||
|
|
||||||
bool mIsHardwareAccelerated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioInfo {
|
class AudioInfo {
|
||||||
|
@ -497,7 +497,6 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
|
|||||||
NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, NS_ERROR_FAILURE);
|
||||||
nsresult rv = mVideo.mDecoder->Init();
|
nsresult rv = mVideo.mDecoder->Init();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
mInfo.mVideo.mIsHardwareAccelerated = mVideo.mDecoder->IsHardwareAccelerated();
|
|
||||||
|
|
||||||
// Collect telemetry from h264 AVCC SPS.
|
// Collect telemetry from h264 AVCC SPS.
|
||||||
if (!mFoundSPSForTelemetry) {
|
if (!mFoundSPSForTelemetry) {
|
||||||
@ -1100,4 +1099,10 @@ MP4Reader::SetSharedDecoderManager(SharedDecoderManager* aManager)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
MP4Reader::VideoIsHardwareAccelerated() const
|
||||||
|
{
|
||||||
|
return mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -82,6 +82,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsAsync() const MOZ_OVERRIDE { return true; }
|
virtual bool IsAsync() const MOZ_OVERRIDE { return true; }
|
||||||
|
|
||||||
|
virtual bool VideoIsHardwareAccelerated() const MOZ_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool InitDemuxer();
|
bool InitDemuxer();
|
||||||
|
@ -142,10 +142,16 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual bool IsAsync() const MOZ_OVERRIDE {
|
virtual bool IsAsync() const MOZ_OVERRIDE {
|
||||||
|
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||||
return (!GetAudioReader() || GetAudioReader()->IsAsync()) &&
|
return (!GetAudioReader() || GetAudioReader()->IsAsync()) &&
|
||||||
(!GetVideoReader() || GetVideoReader()->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
|
// Returns true if aReader is a currently active audio or video
|
||||||
bool IsActiveReader(MediaDecoderReader* aReader);
|
bool IsActiveReader(MediaDecoderReader* aReader);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user