Bug 1089798 - Add id to MediaStream. r=bwc, r=smaug
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Thu, 05 Feb 2015 11:03:00 -0500
changeset 229989 f97ab75f35afeaeca1b59738ede8bcfbba83e747
parent 229988 62bc66380845b1886c58731943b8254c21fe75e7
child 229990 d7755b48d81749ca675b2fa4ef65caa406dce424
push id55863
push userryanvm@gmail.com
push dateFri, 20 Feb 2015 15:14:27 +0000
treeherdermozilla-inbound@a30cdc2cc8d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc, smaug
bugs1089798
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1089798 - Add id to MediaStream. r=bwc, r=smaug
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
dom/webidl/MediaStream.webidl
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -178,16 +178,22 @@ DOMMediaStream::CurrentTime()
   if (!mStream) {
     return 0.0;
   }
   return mStream->
     StreamTimeToSeconds(mStream->GetCurrentTime() - mLogicalStreamStartTime);
 }
 
 void
+DOMMediaStream::GetId(nsAString& aID) const
+{
+  aID = mID;
+}
+
+void
 DOMMediaStream::GetAudioTracks(nsTArray<nsRefPtr<AudioStreamTrack> >& aTracks)
 {
   for (uint32_t i = 0; i < mTracks.Length(); ++i) {
     AudioStreamTrack* t = mTracks[i]->AsAudioStreamTrack();
     if (t) {
       aTracks.AppendElement(t);
     }
   }
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -90,16 +90,18 @@ public:
   {
     return mWindow;
   }
   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
 
   // WebIDL
   double CurrentTime();
 
+  void GetId(nsAString& aID) const;
+
   void GetAudioTracks(nsTArray<nsRefPtr<AudioStreamTrack> >& aTracks);
   void GetVideoTracks(nsTArray<nsRefPtr<VideoStreamTrack> >& aTracks);
   void GetTracks(nsTArray<nsRefPtr<MediaStreamTrack> >& aTracks);
   bool HasTrack(const MediaStreamTrack& aTrack) const;
 
   MediaStream* GetStream() const { return mStream; }
 
   /**
@@ -288,16 +290,18 @@ protected:
   // die until we let it.
   MediaStream* mStream;
 
   nsAutoTArray<nsRefPtr<MediaStreamTrack>,2> mTracks;
   nsRefPtr<StreamListener> mListener;
 
   nsTArray<nsAutoPtr<OnTracksAvailableCallback> > mRunOnTracksAvailable;
 
+  nsString mID;
+
   // 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 arrived in this stream
   uint8_t mTrackTypesAvailable;
   bool mNotifiedOfMediaStreamGraphShutdown;
--- a/dom/webidl/MediaStream.webidl
+++ b/dom/webidl/MediaStream.webidl
@@ -23,17 +23,17 @@ dictionary MediaStreamConstraints {
     boolean fakeTracks = false; // For testing purpose, works only if fake is
                                 // enabled. Enable fakeTracks returns a stream
                                 // with two extra empty video tracks and three
                                 // extra empty audio tracks.
     DOMString? peerIdentity = null;
 };
 
 interface MediaStream : EventTarget {
-    // readonly attribute DOMString    id;
+    readonly attribute DOMString    id;
     sequence<AudioStreamTrack> getAudioTracks();
     sequence<VideoStreamTrack> getVideoTracks();
     sequence<MediaStreamTrack> getTracks();
     // MediaStreamTrack           getTrackById (DOMString trackId);
     // void                       addTrack (MediaStreamTrack track);
     // void                       removeTrack (MediaStreamTrack track);
     //         attribute boolean      ended;
     //         attribute EventHandler onended;