Bug 1090293 - Fix failure to get audio on first getUserMedia after start r=jesup
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 07 Nov 2014 23:25:22 -0500
changeset 226131 dac60d6bef5642cff46a24d339bfe4237175b1fb
parent 226130 aca93ae7eeede8e712b0cf39fc0a47c4e79bcaa0
child 226132 e021487d1297f81b1fa8dfd49e5af483ba12e7fa
push id36
push userdburns@mozilla.com
push dateMon, 10 Nov 2014 15:14:02 +0000
reviewersjesup
bugs1090293
milestone36.0a1
Bug 1090293 - Fix failure to get audio on first getUserMedia after start r=jesup fix GetTrackTypesAvailable to not report placeholder tracks
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -340,21 +340,19 @@ DOMMediaStream::SetHintContents(TrackTyp
 
 MediaStreamTrack*
 DOMMediaStream::CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType)
 {
   MediaStreamTrack* track;
   switch (aType) {
   case MediaSegment::AUDIO:
     track = new AudioStreamTrack(this, aTrackID);
-    mTrackTypesAvailable |= HINT_CONTENTS_AUDIO;
     break;
   case MediaSegment::VIDEO:
     track = new VideoStreamTrack(this, aTrackID);
-    mTrackTypesAvailable |= HINT_CONTENTS_VIDEO;
     break;
   default:
     MOZ_CRASH("Unhandled track type");
   }
   mTracks.AppendElement(track);
 
   return track;
 }
@@ -364,28 +362,28 @@ DOMMediaStream::BindDOMTrack(TrackID aTr
 {
   MediaStreamTrack* track = nullptr;
   switch (aType) {
   case MediaSegment::AUDIO: {
     for (size_t i = 0; i < mTracks.Length(); ++i) {
       track = mTracks[i]->AsAudioStreamTrack();
       if (track) {
         track->BindTrackID(aTrackID);
-        MOZ_ASSERT(mTrackTypesAvailable & HINT_CONTENTS_AUDIO);
+        mTrackTypesAvailable |= HINT_CONTENTS_AUDIO;
         break;
       }
     }
     break;
   }
   case MediaSegment::VIDEO: {
     for (size_t i = 0; i < mTracks.Length(); ++i) {
       track = mTracks[i]->AsVideoStreamTrack();
       if (track) {
         track->BindTrackID(aTrackID);
-        MOZ_ASSERT(mTrackTypesAvailable & HINT_CONTENTS_VIDEO);
+        mTrackTypesAvailable |= HINT_CONTENTS_VIDEO;
         break;
       }
     }
     break;
   }
   default:
     MOZ_CRASH("Unhandled track type");
   }
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -283,17 +283,17 @@ protected:
 
   nsTArray<nsAutoPtr<OnTracksAvailableCallback> > mRunOnTracksAvailable;
 
   // Keep these alive until the stream finishes
   nsTArray<nsCOMPtr<nsISupports> > mConsumersToKeepAlive;
 
   // Indicate what track types we eventually expect to add to this stream
   uint8_t mHintContents;
-  // Indicate what track types have been added to this stream
+  // Indicate what track types have arrived in this stream
   uint8_t mTrackTypesAvailable;
   bool mNotifiedOfMediaStreamGraphShutdown;
 
   // Send notifications to AudioTrackList or VideoTrackList, if this MediaStream
   // is consumed by a HTMLMediaElement.
   nsTArray<MediaTrackListListener> mMediaTrackListListeners;
 
 private: