зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1121148 - Make QUICK_BUFFERING_LOW_DATA_USECS a member variable and adjust it appropriately. r=cpearce
This commit is contained in:
Родитель
b398a95f3c
Коммит
f2e2db81ac
|
@ -162,6 +162,8 @@ static const uint32_t EXHAUSTED_DATA_MARGIN_USECS = 60000;
|
||||||
// back to buffering normally.
|
// back to buffering normally.
|
||||||
static const uint32_t QUICK_BUFFER_THRESHOLD_USECS = 2000000;
|
static const uint32_t QUICK_BUFFER_THRESHOLD_USECS = 2000000;
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
// If we're quick buffering, we'll remain in buffering mode while we have less than
|
// If we're quick buffering, we'll remain in buffering mode while we have less than
|
||||||
// QUICK_BUFFERING_LOW_DATA_USECS of decoded data available.
|
// QUICK_BUFFERING_LOW_DATA_USECS of decoded data available.
|
||||||
static const uint32_t QUICK_BUFFERING_LOW_DATA_USECS = 1000000;
|
static const uint32_t QUICK_BUFFERING_LOW_DATA_USECS = 1000000;
|
||||||
|
@ -170,9 +172,11 @@ static const uint32_t QUICK_BUFFERING_LOW_DATA_USECS = 1000000;
|
||||||
// quick buffering in a timely fashion, as the decode pauses when it
|
// quick buffering in a timely fashion, as the decode pauses when it
|
||||||
// reaches AMPLE_AUDIO_USECS decoded data, and thus we'll never reach
|
// reaches AMPLE_AUDIO_USECS decoded data, and thus we'll never reach
|
||||||
// QUICK_BUFFERING_LOW_DATA_USECS.
|
// QUICK_BUFFERING_LOW_DATA_USECS.
|
||||||
static_assert(QUICK_BUFFERING_LOW_DATA_USECS <= detail::AMPLE_AUDIO_USECS,
|
static_assert(QUICK_BUFFERING_LOW_DATA_USECS <= AMPLE_AUDIO_USECS,
|
||||||
"QUICK_BUFFERING_LOW_DATA_USECS is too large");
|
"QUICK_BUFFERING_LOW_DATA_USECS is too large");
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
// The amount of instability we tollerate in calls to
|
// The amount of instability we tollerate in calls to
|
||||||
// MediaDecoderStateMachine::UpdateEstimatedDuration(); changes of duration
|
// MediaDecoderStateMachine::UpdateEstimatedDuration(); changes of duration
|
||||||
// less than this are ignored, as they're assumed to be the result of
|
// less than this are ignored, as they're assumed to be the result of
|
||||||
|
@ -215,6 +219,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
||||||
mAmpleVideoFrames(2),
|
mAmpleVideoFrames(2),
|
||||||
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),
|
||||||
mIsAudioPrerolling(false),
|
mIsAudioPrerolling(false),
|
||||||
mIsVideoPrerolling(false),
|
mIsVideoPrerolling(false),
|
||||||
mAudioRequestStatus(RequestStatus::Idle),
|
mAudioRequestStatus(RequestStatus::Idle),
|
||||||
|
@ -2347,6 +2352,7 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame()
|
||||||
// order to reduce memory usage.
|
// order to reduce memory usage.
|
||||||
mAmpleAudioThresholdUsecs /= NO_VIDEO_AMPLE_AUDIO_DIVISOR;
|
mAmpleAudioThresholdUsecs /= NO_VIDEO_AMPLE_AUDIO_DIVISOR;
|
||||||
mLowAudioThresholdUsecs /= NO_VIDEO_AMPLE_AUDIO_DIVISOR;
|
mLowAudioThresholdUsecs /= NO_VIDEO_AMPLE_AUDIO_DIVISOR;
|
||||||
|
mQuickBufferingLowDataThresholdUsecs /= NO_VIDEO_AMPLE_AUDIO_DIVISOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get potentially updated metadata
|
// Get potentially updated metadata
|
||||||
|
@ -2814,7 +2820,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||||
bool isLiveStream = resource->GetLength() == -1;
|
bool isLiveStream = resource->GetLength() == -1;
|
||||||
if ((isLiveStream || !mDecoder->CanPlayThrough()) &&
|
if ((isLiveStream || !mDecoder->CanPlayThrough()) &&
|
||||||
elapsed < TimeDuration::FromSeconds(mBufferingWait * mPlaybackRate) &&
|
elapsed < TimeDuration::FromSeconds(mBufferingWait * mPlaybackRate) &&
|
||||||
(mQuickBuffering ? HasLowDecodedData(QUICK_BUFFERING_LOW_DATA_USECS)
|
(mQuickBuffering ? HasLowDecodedData(mQuickBufferingLowDataThresholdUsecs)
|
||||||
: HasLowUndecodedData(mBufferingWait * USECS_PER_S)) &&
|
: HasLowUndecodedData(mBufferingWait * USECS_PER_S)) &&
|
||||||
mDecoder->IsExpectingMoreData())
|
mDecoder->IsExpectingMoreData())
|
||||||
{
|
{
|
||||||
|
|
|
@ -955,6 +955,10 @@ protected:
|
||||||
// we detect that the decode can't keep up with rendering.
|
// we detect that the decode can't keep up with rendering.
|
||||||
int64_t mAmpleAudioThresholdUsecs;
|
int64_t mAmpleAudioThresholdUsecs;
|
||||||
|
|
||||||
|
// If we're quick buffering, we'll remain in buffering mode while we have less than
|
||||||
|
// QUICK_BUFFERING_LOW_DATA_USECS of decoded data available.
|
||||||
|
int64_t mQuickBufferingLowDataThresholdUsecs;
|
||||||
|
|
||||||
// At the start of decoding we want to "preroll" the decode until we've
|
// 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
|
// got a few frames decoded before we consider whether decode is falling
|
||||||
// behind. Otherwise our "we're falling behind" logic will trigger
|
// behind. Otherwise our "we're falling behind" logic will trigger
|
||||||
|
|
Загрузка…
Ссылка в новой задаче