зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1316211. P4 - remove CheckSlowDecoding() and friends since IsAsync() now always returns true. r=gerald
MozReview-Commit-ID: 3dOa0aUQ0kM --HG-- extra : rebase_source : 3091fc002b28bd9d2b45c330a45c437032c4cf18 extra : source : b6fe47f3e125097d8d5c6dd322c948b6c483980a
This commit is contained in:
Родитель
669cff3ca0
Коммит
2f7cce7073
|
@ -92,18 +92,10 @@ namespace detail {
|
|||
// time premium for compensating the seeking delay.
|
||||
static constexpr auto RESUME_VIDEO_PREMIUM = TimeUnit::FromMicroseconds(125000);
|
||||
|
||||
// If audio queue has less than this much decoded audio, we won't risk
|
||||
// trying to decode the video, we'll skip decoding video up to the next
|
||||
// keyframe. We may increase this value for an individual decoder if we
|
||||
// encounter video frames which take a long time to decode.
|
||||
static constexpr auto LOW_AUDIO_THRESHOLD = TimeUnit::FromMicroseconds(300000);
|
||||
|
||||
static const int64_t AMPLE_AUDIO_USECS = 2000000;
|
||||
|
||||
// If more than this much decoded audio is queued, we'll hold off
|
||||
// decoding more audio. If we increase the low audio threshold (see
|
||||
// LOW_AUDIO_THRESHOLD above) we'll also increase this value to ensure it's not
|
||||
// less than the low audio threshold.
|
||||
// decoding more audio.
|
||||
static constexpr auto AMPLE_AUDIO_THRESHOLD = TimeUnit::FromMicroseconds(AMPLE_AUDIO_USECS);
|
||||
|
||||
} // namespace detail
|
||||
|
@ -122,12 +114,6 @@ static constexpr auto LOW_VIDEO_THRESHOLD = TimeUnit::FromMicroseconds(60000);
|
|||
// Arbitrary "frame duration" when playing only audio.
|
||||
static const int AUDIO_DURATION_USECS = 40000;
|
||||
|
||||
// If we increase our "low audio threshold" (see LOW_AUDIO_THRESHOLD above), we
|
||||
// use this as a factor in all our calculations. Increasing this will cause
|
||||
// us to be more likely to increase our low audio threshold, and to
|
||||
// increase it by more.
|
||||
static const int THRESHOLD_FACTOR = 2;
|
||||
|
||||
namespace detail {
|
||||
|
||||
// If we have less than this much buffered data available, we'll consider
|
||||
|
@ -731,7 +717,6 @@ public:
|
|||
mMaster->PushVideo(aVideo);
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
MaybeStopPrerolling();
|
||||
CheckSlowDecoding(aDecodeStart);
|
||||
}
|
||||
|
||||
void HandleAudioCanceled() override
|
||||
|
@ -815,37 +800,6 @@ private:
|
|||
void EnsureVideoDecodeTaskQueued();
|
||||
void MaybeStartBuffering();
|
||||
|
||||
void CheckSlowDecoding(TimeStamp aDecodeStart)
|
||||
{
|
||||
// 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 (Reader()->IsAsync()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TimeDuration decodeTime = TimeStamp::Now() - aDecodeStart;
|
||||
auto adjusted = TimeUnit::FromTimeDuration(decodeTime * THRESHOLD_FACTOR);
|
||||
if (adjusted > mMaster->mLowAudioThreshold
|
||||
&& !mMaster->HasLowBufferedData())
|
||||
{
|
||||
mMaster->mLowAudioThreshold = std::min(
|
||||
adjusted, mMaster->mAmpleAudioThreshold);
|
||||
|
||||
mMaster->mAmpleAudioThreshold = std::max(
|
||||
mMaster->mLowAudioThreshold * THRESHOLD_FACTOR,
|
||||
mMaster->mAmpleAudioThreshold);
|
||||
|
||||
SLOG("Slow video decode, set "
|
||||
"mLowAudioThreshold=%" PRId64
|
||||
" mAmpleAudioThreshold=%" PRId64,
|
||||
mMaster->mLowAudioThreshold.ToMicroseconds(),
|
||||
mMaster->mAmpleAudioThreshold.ToMicroseconds());
|
||||
}
|
||||
}
|
||||
|
||||
// At the start of decoding we want to "preroll" the decode until we've
|
||||
// got a few frames decoded before we consider whether decode is falling
|
||||
// behind. Otherwise our "we're falling behind" logic will trigger
|
||||
|
@ -2771,7 +2725,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
INIT_WATCHABLE(mObservedDuration, TimeUnit()),
|
||||
mReader(new MediaDecoderReaderWrapper(mTaskQueue, aReader)),
|
||||
mPlaybackRate(1.0),
|
||||
mLowAudioThreshold(detail::LOW_AUDIO_THRESHOLD),
|
||||
mAmpleAudioThreshold(detail::AMPLE_AUDIO_THRESHOLD),
|
||||
mAudioCaptured(false),
|
||||
mMinimizePreroll(aDecoder->GetMinimizePreroll()),
|
||||
|
|
|
@ -576,21 +576,8 @@ private:
|
|||
// Must hold monitor.
|
||||
uint32_t GetAmpleVideoFrames() const;
|
||||
|
||||
// Low audio threshold. If we've decoded less than this much audio we
|
||||
// consider our audio decode "behind", and we may skip video decoding
|
||||
// in order to allow our audio decoding to catch up. We favour audio
|
||||
// decoding over video. We increase this threshold if we're slow to
|
||||
// decode video frames, in order to reduce the chance of audio underruns.
|
||||
// Note that we don't ever reset this threshold, it only ever grows as
|
||||
// we detect that the decode can't keep up with rendering.
|
||||
media::TimeUnit mLowAudioThreshold;
|
||||
|
||||
// Our "ample" audio threshold. Once we've this much audio decoded, we
|
||||
// pause decoding. If we increase mLowAudioThreshold, we'll also
|
||||
// increase this too appropriately (we don't want mLowAudioThreshold
|
||||
// to be greater than mAmpleAudioThreshold, else we'd stop decoding!).
|
||||
// Note that we don't ever reset this threshold, it only ever grows as
|
||||
// we detect that the decode can't keep up with rendering.
|
||||
// pause decoding.
|
||||
media::TimeUnit mAmpleAudioThreshold;
|
||||
|
||||
// Only one of a given pair of ({Audio,Video}DataPromise, WaitForDataPromise)
|
||||
|
|
Загрузка…
Ссылка в новой задаче