зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1312886: P4. Override MediaResource reporting if we have a pending promise. r=jwwang
A future use will see the MediaFormatReader using waiting promise to indicate that the decoders are waiting for an EME key. We should always enter buffering mode once we're low on data and we're waiting on a key. MozReview-Commit-ID: DFcT6YEK1Ke --HG-- extra : rebase_source : 806bf55bb2394d2e07d446860a14bebf699b0195
This commit is contained in:
Родитель
7c88ceb9a4
Коммит
ed6fae307d
|
@ -230,6 +230,14 @@ protected:
|
|||
MediaResource* Resource() const { return mMaster->mResource; }
|
||||
MediaDecoderReaderWrapper* Reader() const { return mMaster->mReader; }
|
||||
const MediaInfo& Info() const { return mMaster->Info(); }
|
||||
bool IsExpectingMoreData() const
|
||||
{
|
||||
// We are expecting more data if either the resource states so, or if we
|
||||
// have a waiting promise pending (such as with non-MSE EME).
|
||||
return Resource()->IsExpectingMoreData() ||
|
||||
(Reader()->IsWaitForDataSupported() &&
|
||||
(Reader()->IsWaitingAudioData() || Reader()->IsWaitingVideoData()));
|
||||
}
|
||||
|
||||
// Note this function will delete the current state object.
|
||||
// Don't access members to avoid UAF after this call.
|
||||
|
@ -1471,7 +1479,7 @@ DecodingState::MaybeStartBuffering()
|
|||
|
||||
bool shouldBuffer;
|
||||
if (Reader()->UseBufferingHeuristics()) {
|
||||
shouldBuffer = Resource()->IsExpectingMoreData() &&
|
||||
shouldBuffer = IsExpectingMoreData() &&
|
||||
mMaster->HasLowDecodedData() &&
|
||||
mMaster->HasLowBufferedData();
|
||||
} else {
|
||||
|
@ -1611,7 +1619,7 @@ BufferingState::Step()
|
|||
if ((isLiveStream || !mMaster->CanPlayThrough()) &&
|
||||
elapsed < TimeDuration::FromSeconds(mBufferingWait * mMaster->mPlaybackRate) &&
|
||||
mMaster->HasLowBufferedData(mBufferingWait * USECS_PER_S) &&
|
||||
Resource()->IsExpectingMoreData()) {
|
||||
IsExpectingMoreData()) {
|
||||
SLOG("Buffering: wait %ds, timeout in %.3lfs",
|
||||
mBufferingWait, mBufferingWait - elapsed.ToSeconds());
|
||||
mMaster->ScheduleStateMachineIn(USECS_PER_S);
|
||||
|
|
Загрузка…
Ссылка в новой задаче