Bug 778682. Part 1: Add NotifyHasCurrentData callback on StreamListener. r=jesup

--HG--
extra : rebase_source : a56fe8ba36639da7638eb590bd9a7a7e65efae95
This commit is contained in:
Robert O'Callahan 2012-09-20 12:47:51 +12:00
parent d592836a00
commit 402b08d6f4
2 changed files with 21 additions and 0 deletions

View File

@ -294,6 +294,10 @@ public:
* Get the current audio position of the stream's audio output.
*/
GraphTime GetAudioPosition(MediaStream* aStream);
/**
* Call NotifyHaveCurrentData on aStream's listeners.
*/
void NotifyHasCurrentData(MediaStream* aStream);
/**
* If aStream needs an audio stream but doesn't have one, create it.
* If aStream doesn't need an audio stream but has one, destroy it.
@ -1106,6 +1110,16 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray<MediaStream*>& aStreams
}
}
void
MediaStreamGraphImpl::NotifyHasCurrentData(MediaStream* aStream)
{
for (uint32_t j = 0; j < aStream->mListeners.Length(); ++j) {
MediaStreamListener* l = aStream->mListeners[j];
l->NotifyHasCurrentData(this,
GraphTimeToStreamTime(aStream, mCurrentTime) < aStream->mBuffer.GetEnd());
}
}
void
MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTime,
MediaStream* aStream)
@ -1397,6 +1411,7 @@ MediaStreamGraphImpl::RunThread()
GraphTimeToStreamTime(stream, mStateComputedTime),
"Stream did not produce enough data");
}
NotifyHasCurrentData(stream);
CreateOrDestroyAudioStreams(prevComputedTime, stream);
PlayAudio(stream, prevComputedTime, mStateComputedTime);
audioStreamsActive += stream->mAudioOutputStreams.Length();

View File

@ -127,6 +127,12 @@ public:
*/
virtual void NotifyBlockingChanged(MediaStreamGraph* aGraph, Blocking aBlocked) {}
/**
* Notify that the stream has (or does not have) data in each track
* for the stream's current time.
*/
virtual void NotifyHasCurrentData(MediaStreamGraph* aGraph, bool aHasCurrentData) {}
/**
* Notify that the stream output is advancing.
*/