Bug 1208371 - Rename CreateOwnDOMTrack/CreateClonedDOMTrack to CreateDOMTrack/CloneDOMTrack. r?jib draft
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 05 Nov 2015 15:42:24 +0800
changeset 306663 7fe7f527330079ca3238bddaad4756fb10b8e104
parent 306662 75918a7e67de636ec1a2230a56277522c76bf37f
child 510887 37b501ccc2b0b75dacaaae763c0f873e3a0d2023
push id7183
push userpehrsons@gmail.com
push dateThu, 05 Nov 2015 07:42:40 +0000
reviewersjib
bugs1208371
milestone45.0a1
Bug 1208371 - Rename CreateOwnDOMTrack/CreateClonedDOMTrack to CreateDOMTrack/CloneDOMTrack. r?jib
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
@@ -677,18 +677,18 @@ HTMLCanvasElement::CaptureStream(const O
 
   TrackID videoTrackId = 1;
   nsresult rv = stream->Init(aFrameRate, videoTrackId);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
-  stream->CreateOwnDOMTrack(videoTrackId, MediaSegment::VIDEO,
-                            new BasicUnstoppableTrackSource());
+  stream->CreateDOMTrack(videoTrackId, MediaSegment::VIDEO,
+                         new BasicUnstoppableTrackSource());
   RegisterFrameCaptureListener(stream->FrameCaptureListener());
   return stream.forget();
 }
 
 nsresult
 HTMLCanvasElement::ExtractData(nsAString& aType,
                                const nsAString& aOptions,
                                nsIInputStream** aStream)
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1893,22 +1893,22 @@ HTMLMediaElement::CaptureStreamInternal(
   if (mDecoder) {
     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 = new BasicUnstoppableTrackSource();
-        out->mStream->CreateOwnDOMTrack(audioTrackId, MediaSegment::AUDIO, trackSource);
+        out->mStream->CreateDOMTrack(audioTrackId, MediaSegment::AUDIO, trackSource);
       }
       if (HasVideo()) {
         TrackID videoTrackId = mMediaInfo.mVideo.mTrackId;
         RefPtr<MediaStreamTrackSource> trackSource = new BasicUnstoppableTrackSource();
-        out->mStream->CreateOwnDOMTrack(videoTrackId, MediaSegment::VIDEO, trackSource);
+        out->mStream->CreateDOMTrack(videoTrackId, MediaSegment::VIDEO, trackSource);
       }
     }
   }
   RefPtr<DOMMediaStream> result = out->mStream;
   return result.forget();
 }
 
 already_AddRefed<DOMMediaStream>
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -130,17 +130,17 @@ public:
       RefPtr<MediaStreamTrackSource> source;
       if (mStream->mTrackSourceGetter) {
         source = mStream->mTrackSourceGetter->GetMediaStreamTrackSource(aTrackID);
       }
       if (!source) {
         NS_ASSERTION(false, "Dynamic track created without an explicit TrackSource");
         source = new BasicUnstoppableTrackSource();
       }
-      track = mStream->CreateOwnDOMTrack(aTrackID, aType, source);
+      track = mStream->CreateDOMTrack(aTrackID, aType, source);
     }
   }
 
   void DoNotifyTrackEnded(MediaStream* aInputStream, TrackID aInputTrackID)
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     if (!mStream) {
@@ -626,17 +626,17 @@ DOMMediaStream::Clone()
   // 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++);
   }
 
   // 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;
   if (mInputStream) {
@@ -692,17 +692,17 @@ DOMMediaStream::InitAudioCaptureStream(M
   RefPtr<BasicUnstoppableTrackSource> audioCaptureSource =
     new BasicUnstoppableTrackSource(MediaSourceEnum::AudioCapture);
 
   AudioCaptureStream* audioCaptureStream =
     static_cast<AudioCaptureStream*>(aGraph->CreateAudioCaptureStream(this, AUDIO_TRACK));
   InitInputStreamCommon(audioCaptureStream, aGraph);
   InitOwnedStreamCommon(aGraph);
   InitPlaybackStreamCommon(aGraph);
-  CreateOwnDOMTrack(AUDIO_TRACK, MediaSegment::AUDIO, audioCaptureSource);
+  CreateDOMTrack(AUDIO_TRACK, MediaSegment::AUDIO, audioCaptureSource);
   audioCaptureStream->Start();
 }
 
 void
 DOMMediaStream::InitInputStreamCommon(MediaStream* aStream,
                                       MediaStreamGraph* aGraph)
 {
   MOZ_ASSERT(!mOwnedStream, "Input stream must be initialized before owned stream");
@@ -826,18 +826,18 @@ DOMMediaStream::AddPrincipalChangeObserv
 
 bool
 DOMMediaStream::RemovePrincipalChangeObserver(PrincipalChangeObserver* aObserver)
 {
   return mPrincipalChangeObservers.RemoveElement(aObserver);
 }
 
 MediaStreamTrack*
-DOMMediaStream::CreateOwnDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
-                                  MediaStreamTrackSource* aSource)
+DOMMediaStream::CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
+                               MediaStreamTrackSource* aSource)
 {
   MOZ_RELEASE_ASSERT(mInputStream);
   MOZ_RELEASE_ASSERT(mOwnedStream);
 
   MOZ_ASSERT(FindOwnedDOMTrack(GetInputStream(), aTrackID) == nullptr);
 
   MediaStreamTrack* track;
   switch (aType) {
@@ -859,18 +859,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
@@ -526,26 +526,26 @@ 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,
-                                      MediaStreamTrackSource* aSource);
+  MediaStreamTrack* CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
+                                   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
@@ -984,26 +984,24 @@ public:
       domStream = nsDOMUserMediaStream::CreateSourceStream(
         window, mListener, msg, new LocalTrackSourceGetter(mListener));
 
       if (mAudioDevice) {
         const MediaSourceEnum source =
           mAudioDevice->GetSource()->GetMediaSource();
         RefPtr<MediaStreamTrackSource> audioSource =
           new LocalTrackSource(mListener, source, kAudioTrack);
-        domStream->CreateOwnDOMTrack(kAudioTrack, MediaSegment::AUDIO,
-                                     audioSource);
+        domStream->CreateDOMTrack(kAudioTrack, MediaSegment::AUDIO, audioSource);
       }
       if (mVideoDevice) {
         const MediaSourceEnum source =
           mVideoDevice->GetSource()->GetMediaSource();
         RefPtr<MediaStreamTrackSource> videoSource =
           new LocalTrackSource(mListener, source, kVideoTrack);
-        domStream->CreateOwnDOMTrack(kVideoTrack, MediaSegment::VIDEO,
-                                     videoSource);
+        domStream->CreateDOMTrack(kVideoTrack, MediaSegment::VIDEO, videoSource);
       }
 
       nsCOMPtr<nsIPrincipal> principal;
       if (mPeerIdentity) {
         principal = nsNullPrincipal::Create();
         domStream->SetPeerIdentity(mPeerIdentity.forget());
       } else {
         principal = window->GetExtantDoc()->NodePrincipal();
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -143,17 +143,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
@@ -32,18 +32,18 @@ MediaStreamAudioDestinationNode::MediaSt
   , mDOMStream(
       DOMAudioNodeMediaStream::CreateTrackUnionStream(GetOwner(),
                                                       this,
                                                       aContext->Graph()))
 {
   // Ensure an audio track with the correct ID is exposed to JS
   RefPtr<MediaStreamTrackSource> source =
     new BasicUnstoppableTrackSource(MediaSourceEnum::AudioCapture);
-  mDOMStream->CreateOwnDOMTrack(AudioNodeStream::AUDIO_TRACK,
-                                MediaSegment::AUDIO, source);
+  mDOMStream->CreateDOMTrack(AudioNodeStream::AUDIO_TRACK,
+                             MediaSegment::AUDIO, 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
@@ -1823,21 +1823,21 @@ PeerConnectionImpl::SetRemoteDescription
             MOZ_ASSERT(false);
             continue;
           }
           info->AddTrack(track->GetTrackId());
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
           RefPtr<MediaStreamTrackSource> source =
             new BasicUnstoppableTrackSource(MediaSourceEnum::Other);
           if (track->GetMediaType() == SdpMediaSection::kAudio) {
-            info->GetMediaStream()->CreateOwnDOMTrack(
+            info->GetMediaStream()->CreateDOMTrack(
               info->GetNumericTrackId(track->GetTrackId()),
               MediaSegment::AUDIO, source);
           } else {
-            info->GetMediaStream()->CreateOwnDOMTrack(
+            info->GetMediaStream()->CreateDOMTrack(
               info->GetNumericTrackId(track->GetTrackId()),
               MediaSegment::VIDEO, 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
@@ -414,17 +414,17 @@ 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)
+  CreateDOMTrack(mozilla::TrackID aTrackID, mozilla::MediaSegment::Type aType)
   {
     switch(aType) {
       case mozilla::MediaSegment::AUDIO: {
         return mAudioTrack;
       }
       case mozilla::MediaSegment::VIDEO: {
         return mVideoTrack;
       }