Bug 1189506. Set mStartBlocking in UpdateCurrentTimeForStreams to indicate that blocking time has been processed. r=karlt

--HG--
extra : commitid : BgPlIfIaRdL
extra : rebase_source : b7f9d55167ffcaa21c2b0cda82fe6110107f4baf
This commit is contained in:
Robert O'Callahan 2015-09-08 15:55:40 +12:00
Родитель 13179ae295
Коммит bac0eac77c
1 изменённых файлов: 13 добавлений и 11 удалений

Просмотреть файл

@ -271,18 +271,28 @@ void
MediaStreamGraphImpl::UpdateCurrentTimeForStreams(GraphTime aPrevCurrentTime) MediaStreamGraphImpl::UpdateCurrentTimeForStreams(GraphTime aPrevCurrentTime)
{ {
for (MediaStream* stream : AllStreams()) { for (MediaStream* stream : AllStreams()) {
bool isAnyBlocked = stream->mStartBlocking < mStateComputedTime;
bool isAnyUnblocked = stream->mStartBlocking > aPrevCurrentTime;
// Calculate blocked time and fire Blocked/Unblocked events // Calculate blocked time and fire Blocked/Unblocked events
GraphTime blockedTime = mStateComputedTime - stream->mStartBlocking; GraphTime blockedTime = mStateComputedTime - stream->mStartBlocking;
NS_ASSERTION(blockedTime >= 0, "Error in blocking time"); NS_ASSERTION(blockedTime >= 0, "Error in blocking time");
stream->AdvanceTimeVaryingValuesToCurrentTime(mStateComputedTime,
blockedTime);
STREAM_LOG(LogLevel::Verbose,
("MediaStream %p bufferStartTime=%f blockedTime=%f", stream,
MediaTimeToSeconds(stream->mBufferStartTime),
MediaTimeToSeconds(blockedTime)));
stream->mStartBlocking = mStateComputedTime;
if (stream->mStartBlocking > aPrevCurrentTime && stream->mNotifiedBlocked) { if (isAnyUnblocked && stream->mNotifiedBlocked) {
for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) { for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) {
MediaStreamListener* l = stream->mListeners[j]; MediaStreamListener* l = stream->mListeners[j];
l->NotifyBlockingChanged(this, MediaStreamListener::UNBLOCKED); l->NotifyBlockingChanged(this, MediaStreamListener::UNBLOCKED);
} }
stream->mNotifiedBlocked = false; stream->mNotifiedBlocked = false;
} }
if (stream->mStartBlocking < mStateComputedTime && !stream->mNotifiedBlocked) { if (isAnyBlocked && !stream->mNotifiedBlocked) {
for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) { for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) {
MediaStreamListener* l = stream->mListeners[j]; MediaStreamListener* l = stream->mListeners[j];
l->NotifyBlockingChanged(this, MediaStreamListener::BLOCKED); l->NotifyBlockingChanged(this, MediaStreamListener::BLOCKED);
@ -290,15 +300,7 @@ MediaStreamGraphImpl::UpdateCurrentTimeForStreams(GraphTime aPrevCurrentTime)
stream->mNotifiedBlocked = true; stream->mNotifiedBlocked = true;
} }
stream->AdvanceTimeVaryingValuesToCurrentTime(mStateComputedTime, if (isAnyUnblocked) {
blockedTime);
STREAM_LOG(LogLevel::Verbose,
("MediaStream %p bufferStartTime=%f blockedTime=%f", stream,
MediaTimeToSeconds(stream->mBufferStartTime),
MediaTimeToSeconds(blockedTime)));
if (stream->mStartBlocking > aPrevCurrentTime) {
NS_ASSERTION(!stream->mNotifiedFinished, NS_ASSERTION(!stream->mNotifiedFinished,
"Shouldn't have already notified of finish *and* have output!"); "Shouldn't have already notified of finish *and* have output!");
for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) { for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) {