Bug 1208371 - Rename CreateOwnDOMTrack/CreateClonedDOMTrack to CreateDOMTrack/CloneDOMTrack. r?jib draft
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 05 Jan 2016 10:16:26 +0800
changeset 342127 2c269d1c2c1306ff9f06cc7e5a833ef8e05c85f5
parent 342126 38a71f9332fc0706613d3c76bdd333b2be52752f
child 342128 ff5fdb9c03db4746f7e85577dd0e931ed78f6348
push id13352
push userpehrsons@gmail.com
push dateFri, 18 Mar 2016 13:49:47 +0000
reviewersjib
bugs1208371
milestone47.0a1
Bug 1208371 - Rename CreateOwnDOMTrack/CreateClonedDOMTrack to CreateDOMTrack/CloneDOMTrack. r?jib MozReview-Commit-ID: DOGiwcYycJY
dom/html/HTMLCanvasElement.cpp
dom/html/HTMLMediaElement.cpp
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
dom/media/MediaManager.cpp
dom/media/MediaStreamTrack.cpp
dom/media/webaudio/MediaStreamAudioDestinationNode.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/test/FakeMediaStreams.h
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -676,18 +676,18 @@ HTMLCanvasElement::CaptureStream(const O
   TrackID videoTrackId = 1;
   nsresult rv = stream->Init(aFrameRate, videoTrackId);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   nsCOMPtr<nsIPrincipal> principal = NodePrincipal();
-  stream->CreateOwnDOMTrack(videoTrackId, MediaSegment::VIDEO, nsString(),
-                            new BasicUnstoppableTrackSource(principal));
+  stream->CreateDOMTrack(videoTrackId, MediaSegment::VIDEO, nsString(),
+                         new BasicUnstoppableTrackSource(principal));
 
   rv = RegisterFrameCaptureListener(stream->FrameCaptureListener());
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   return stream.forget();
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2008,25 +2008,25 @@ HTMLMediaElement::CaptureStreamInternal(
     mDecoder->AddOutputStream(out->mStream->GetInputStream()->AsProcessedStream(),
                               aFinishWhenEnded);
     if (mReadyState >= HAVE_METADATA) {
       // Expose the tracks to JS directly.
       if (HasAudio()) {
         TrackID audioTrackId = mMediaInfo.mAudio.mTrackId;
         RefPtr<MediaStreamTrackSource> trackSource =
           getter->GetMediaStreamTrackSource(audioTrackId);
-        out->mStream->CreateOwnDOMTrack(audioTrackId, MediaSegment::AUDIO,
-                                        nsString(), trackSource);
+        out->mStream->CreateDOMTrack(audioTrackId, MediaSegment::AUDIO,
+                                     nsString(), trackSource);
       }
       if (HasVideo()) {
         TrackID videoTrackId = mMediaInfo.mVideo.mTrackId;
         RefPtr<MediaStreamTrackSource> trackSource =
           getter->GetMediaStreamTrackSource(videoTrackId);
-        out->mStream->CreateOwnDOMTrack(videoTrackId, MediaSegment::VIDEO,
-                                        nsString(), trackSource);
+        out->mStream->CreateDOMTrack(videoTrackId, MediaSegment::VIDEO,
+                                     nsString(), trackSource);
       }
     }
   }
   RefPtr<DOMMediaStream> result = out->mStream;
   return result.forget();
 }
 
 already_AddRefed<DOMMediaStream>
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -139,17 +139,17 @@ public:
       }
       if (!source) {
         NS_ASSERTION(false, "Dynamic track created without an explicit TrackSource");
         nsPIDOMWindowInner* window = mStream->GetParentObject();
         nsIDocument* doc = window ? window->GetExtantDoc() : nullptr;
         nsIPrincipal* principal = doc ? doc->NodePrincipal() : nullptr;
         source = new BasicUnstoppableTrackSource(principal);
       }
-      track = mStream->CreateOwnDOMTrack(aTrackID, aType, nsString(), source);
+      track = mStream->CreateDOMTrack(aTrackID, aType, nsString(), source);
     }
   }
 
   void DoNotifyTrackEnded(MediaStream* aInputStream, TrackID aInputTrackID)
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     if (!mStream) {
@@ -655,17 +655,17 @@ DOMMediaStream::CloneInternal(TrackForwa
   // Set up existing DOM tracks.
   TrackID allocatedTrackID = 1;
   for (const RefPtr<TrackPort>& info : mTracks) {
     MediaStreamTrack& track = *info->GetTrack();
 
     LOG(LogLevel::Debug, ("DOMMediaStream %p forwarding external track %p to clone %p",
                           this, &track, newStream.get()));
     RefPtr<MediaStreamTrack> trackClone =
-      newStream->CreateClonedDOMTrack(track, allocatedTrackID++);
+      newStream->CloneDOMTrack(track, allocatedTrackID++);
   }
 
   if (aForwarding == TrackForwardingOption::ALL) {
     // Set up an input port from our input stream to the new DOM stream's owned
     // stream, to allow for dynamically added tracks at the source to appear in
     // the clone. The clone may treat mInputStream as its own mInputStream but
     // ownership remains with us.
     newStream->mInputStream = mInputStream;
@@ -775,17 +775,17 @@ DOMMediaStream::InitAudioCaptureStream(n
   RefPtr<BasicUnstoppableTrackSource> audioCaptureSource =
     new BasicUnstoppableTrackSource(aPrincipal, MediaSourceEnum::AudioCapture);
 
   AudioCaptureStream* audioCaptureStream =
     static_cast<AudioCaptureStream*>(aGraph->CreateAudioCaptureStream(this, AUDIO_TRACK));
   InitInputStreamCommon(audioCaptureStream, aGraph);
   InitOwnedStreamCommon(aGraph);
   InitPlaybackStreamCommon(aGraph);
-  CreateOwnDOMTrack(AUDIO_TRACK, MediaSegment::AUDIO, nsString(), audioCaptureSource);
+  CreateDOMTrack(AUDIO_TRACK, MediaSegment::AUDIO, nsString(), audioCaptureSource);
   audioCaptureStream->Start();
 }
 
 void
 DOMMediaStream::InitInputStreamCommon(MediaStream* aStream,
                                       MediaStreamGraph* aGraph)
 {
   MOZ_ASSERT(!mOwnedStream, "Input stream must be initialized before owned stream");
@@ -931,19 +931,19 @@ DOMMediaStream::AddPrincipalChangeObserv
 bool
 DOMMediaStream::RemovePrincipalChangeObserver(
   PrincipalChangeObserver<DOMMediaStream>* aObserver)
 {
   return mPrincipalChangeObservers.RemoveElement(aObserver);
 }
 
 MediaStreamTrack*
-DOMMediaStream::CreateOwnDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
-                                  const nsString& aLabel,
-                                  MediaStreamTrackSource* aSource)
+DOMMediaStream::CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
+                               const nsString& aLabel,
+                               MediaStreamTrackSource* aSource)
 {
   MOZ_RELEASE_ASSERT(mInputStream);
   MOZ_RELEASE_ASSERT(mOwnedStream);
 
   MOZ_ASSERT(FindOwnedDOMTrack(GetInputStream(), aTrackID) == nullptr);
 
   MediaStreamTrack* track;
   switch (aType) {
@@ -965,18 +965,18 @@ DOMMediaStream::CreateOwnDOMTrack(TrackI
   mTracks.AppendElement(
     new TrackPort(mPlaybackPort, track, TrackPort::InputPortOwnership::EXTERNAL));
 
   NotifyTrackAdded(track);
   return track;
 }
 
 already_AddRefed<MediaStreamTrack>
-DOMMediaStream::CreateClonedDOMTrack(MediaStreamTrack& aTrack,
-                                     TrackID aCloneTrackID)
+DOMMediaStream::CloneDOMTrack(MediaStreamTrack& aTrack,
+                              TrackID aCloneTrackID)
 {
   MOZ_RELEASE_ASSERT(mOwnedStream);
   MOZ_RELEASE_ASSERT(mPlaybackStream);
   MOZ_RELEASE_ASSERT(IsTrackIDExplicit(aCloneTrackID));
 
   TrackID inputTrackID = aTrack.mInputTrackID;
   MediaStream* inputStream = aTrack.GetInputStream();
 
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -525,27 +525,27 @@ public:
   }
 
   /**
    * Called for each track in our owned stream to indicate to JS that we
    * are carrying that track.
    *
    * Creates a MediaStreamTrack, adds it to mTracks and returns it.
    */
-  MediaStreamTrack* CreateOwnDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
-                                      const nsString& aLabel,
-                                      MediaStreamTrackSource* aSource);
+  MediaStreamTrack* CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
+                                   const nsString& aLabel,
+                                   MediaStreamTrackSource* aSource);
 
   /**
    * Creates a MediaStreamTrack cloned from aTrack, adds it to mTracks and
    * returns it.
    * aCloneTrackID is the TrackID the new track will get in mOwnedStream.
    */
-  already_AddRefed<MediaStreamTrack> CreateClonedDOMTrack(MediaStreamTrack& aTrack,
-                                                          TrackID aCloneTrackID);
+  already_AddRefed<MediaStreamTrack> CloneDOMTrack(MediaStreamTrack& aTrack,
+                                                   TrackID aCloneTrackID);
 
   // When the initial set of tracks has been added, run
   // aCallback->NotifyTracksAvailable.
   // It is allowed to do anything, including run script.
   // aCallback may run immediately during this call if tracks are already
   // available!
   // We only care about track additions, we'll fire the notification even if
   // some of the tracks have been removed.
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -874,28 +874,28 @@ public:
 
       if (mAudioDevice) {
         nsString audioDeviceName;
         mAudioDevice->GetName(audioDeviceName);
         const MediaSourceEnum source =
           mAudioDevice->GetSource()->GetMediaSource();
         RefPtr<MediaStreamTrackSource> audioSource =
           new LocalTrackSource(principal, mListener, source, kAudioTrack);
-        domStream->CreateOwnDOMTrack(kAudioTrack, MediaSegment::AUDIO,
-                                     audioDeviceName, audioSource);
+        domStream->CreateDOMTrack(kAudioTrack, MediaSegment::AUDIO,
+                                  audioDeviceName, audioSource);
       }
       if (mVideoDevice) {
         nsString videoDeviceName;
         mVideoDevice->GetName(videoDeviceName);
         const MediaSourceEnum source =
           mVideoDevice->GetSource()->GetMediaSource();
         RefPtr<MediaStreamTrackSource> videoSource =
           new LocalTrackSource(principal, mListener, source, kVideoTrack);
-        domStream->CreateOwnDOMTrack(kVideoTrack, MediaSegment::VIDEO,
-                                     videoDeviceName, videoSource);
+        domStream->CreateDOMTrack(kVideoTrack, MediaSegment::VIDEO,
+                                  videoDeviceName, videoSource);
       }
       stream = domStream->GetInputStream()->AsSourceStream();
     }
 
     if (!domStream || sInShutdown) {
       nsCOMPtr<nsIDOMGetUserMediaErrorCallback> onFailure = mOnFailure.forget();
       LOG(("Returning error for getUserMedia() - no stream"));
 
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -208,17 +208,17 @@ MediaStreamTrack::Clone()
   // dynamically created tracks (no input stream) so no need for a SourceGetter.
   RefPtr<DOMMediaStream> newStream =
     new DOMMediaStream(mOwningStream->GetParentObject(), nullptr);
 
   MediaStreamGraph* graph = Graph();
   newStream->InitOwnedStreamCommon(graph);
   newStream->InitPlaybackStreamCommon(graph);
 
-  return newStream->CreateClonedDOMTrack(*this, mTrackID);
+  return newStream->CloneDOMTrack(*this, mTrackID);
 }
 
 DOMMediaStream*
 MediaStreamTrack::GetInputDOMStream()
 {
   MediaStreamTrack* originalTrack =
     mOriginalTrack ? mOriginalTrack.get() : this;
   MOZ_RELEASE_ASSERT(originalTrack->mOwningStream);
--- a/dom/media/webaudio/MediaStreamAudioDestinationNode.cpp
+++ b/dom/media/webaudio/MediaStreamAudioDestinationNode.cpp
@@ -34,18 +34,18 @@ MediaStreamAudioDestinationNode::MediaSt
                                                       this,
                                                       aContext->Graph()))
 {
   // Ensure an audio track with the correct ID is exposed to JS
   nsIDocument* doc = aContext->GetParentObject()->GetExtantDoc();
   RefPtr<MediaStreamTrackSource> source =
     new BasicUnstoppableTrackSource(doc->NodePrincipal(),
                                     MediaSourceEnum::AudioCapture);
-  mDOMStream->CreateOwnDOMTrack(AudioNodeStream::AUDIO_TRACK,
-                                MediaSegment::AUDIO, nsString(), source);
+  mDOMStream->CreateDOMTrack(AudioNodeStream::AUDIO_TRACK,
+                             MediaSegment::AUDIO, nsString(), source);
 
   ProcessedMediaStream* outputStream = mDOMStream->GetInputStream()->AsProcessedStream();
   MOZ_ASSERT(!!outputStream);
   AudioNodeEngine* engine = new AudioNodeEngine(this);
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::EXTERNAL_OUTPUT);
   mPort = outputStream->AllocateInputPort(mStream, AudioNodeStream::AUDIO_TRACK);
 }
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -1810,25 +1810,25 @@ PeerConnectionImpl::CreateNewRemoteTrack
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
         RefPtr<RemoteTrackSource> source = new RemoteTrackSource(principal);
         DebugOnly<bool> sourceSet =
           info->SetTrackSource(track->GetTrackId(), source);
         NS_ASSERTION(sourceSet, "TrackSource was added in the wrong order. "
                                 "Did someone add a track from elsewhere?");
         TrackID trackID = info->GetNumericTrackId(track->GetTrackId());
         if (track->GetMediaType() == SdpMediaSection::kAudio) {
-          info->GetMediaStream()->CreateOwnDOMTrack(trackID,
-                                                    MediaSegment::AUDIO,
-                                                    nsString(),
-                                                    source);
+          info->GetMediaStream()->CreateDOMTrack(trackID,
+                                                 MediaSegment::AUDIO,
+                                                 nsString(),
+                                                 source);
         } else {
-          info->GetMediaStream()->CreateOwnDOMTrack(trackID,
-                                                    MediaSegment::VIDEO,
-                                                    nsString(),
-                                                    source);
+          info->GetMediaStream()->CreateDOMTrack(trackID,
+                                                 MediaSegment::VIDEO,
+                                                 nsString(),
+                                                 source);
         }
 #endif
         CSFLogDebug(logTag, "Added remote track %s/%s",
                     info->GetId().c_str(), track->GetTrackId().c_str());
       } else {
         ++numPreexistingTrackIds;
       }
     }
--- a/media/webrtc/signaling/test/FakeMediaStreams.h
+++ b/media/webrtc/signaling/test/FakeMediaStreams.h
@@ -424,18 +424,18 @@ public:
   {
     return ((mHintContents & HINT_CONTENTS_AUDIO) && aTrack.AsAudioStreamTrack()) ||
            ((mHintContents & HINT_CONTENTS_VIDEO) && aTrack.AsVideoStreamTrack());
   }
 
   void SetTrackEnabled(mozilla::TrackID aTrackID, bool aEnabled) {}
 
   Fake_MediaStreamTrack*
-  CreateOwnDOMTrack(mozilla::TrackID aTrackID, mozilla::MediaSegment::Type aType,
-                    const nsString& aLabel, Fake_MediaStreamTrackSource* aSource)
+  CreateDOMTrack(mozilla::TrackID aTrackID, mozilla::MediaSegment::Type aType,
+                 const nsString& aLabel, Fake_MediaStreamTrackSource* aSource)
   {
     switch(aType) {
       case mozilla::MediaSegment::AUDIO: {
         return mAudioTrack;
       }
       case mozilla::MediaSegment::VIDEO: {
         return mVideoTrack;
       }