Bug 879669 - Part 1: Don't callback if there is no track in MediaStream. r=roc

This commit is contained in:
Randy Lin 2013-11-23 09:14:29 +13:00
parent 5be0c2b8f3
commit 74fa67f516
2 changed files with 5 additions and 0 deletions

View File

@ -324,6 +324,9 @@ DOMMediaStream::OnTracksAvailable(OnTracksAvailableCallback* aRunnable)
void
DOMMediaStream::CheckTracksAvailable()
{
if (mTrackTypesAvailable == 0) {
return;
}
nsTArray<nsAutoPtr<OnTracksAvailableCallback> > callbacks;
callbacks.SwapElements(mRunOnTracksAvailable);

View File

@ -164,6 +164,7 @@ public:
// We only care about track additions, we'll fire the notification even if
// some of the tracks have been removed.
// Takes ownership of aCallback.
// If GetExpectedTracks() returns 0, the callback will be fired as soon as there are any tracks.
void OnTracksAvailable(OnTracksAvailableCallback* aCallback);
/**
@ -182,6 +183,7 @@ protected:
void InitSourceStream(nsIDOMWindow* aWindow, TrackTypeHints aHintContents);
void InitTrackUnionStream(nsIDOMWindow* aWindow, TrackTypeHints aHintContents);
void InitStreamCommon(MediaStream* aStream);
void CheckTracksAvailable();
class StreamListener;