Bug 1266646 - Rename MediaStreamDirectListener and MediaStreamTrackDirectListener to DirectMediaStreamListener and DirectMediaStreamTrackListener respectively. r=jesup,pehrsons draft
authorctai <ctai@mozilla.com>
Fri, 29 Apr 2016 11:45:25 +0800
changeset 379681 e18ea6c4a181d917ef0c859f1f9dd5a21f16074f
parent 377951 ddb6b30149221f00eb5dd180530e9033093d4c2b
child 379682 f2fe3ac4871f7fc1fd7f0805ea33d732e32ff433
push id21021
push userbmo:ctai@mozilla.com
push dateThu, 16 Jun 2016 15:21:22 +0000
reviewersjesup, pehrsons
bugs1266646
milestone50.0a1
Bug 1266646 - Rename MediaStreamDirectListener and MediaStreamTrackDirectListener to DirectMediaStreamListener and DirectMediaStreamTrackListener respectively. r=jesup,pehrsons Rename those two function to better name alignment with AddDirectListener and AddDirectTrackListener. MozReview-Commit-ID: 6QY08oyih1X
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
dom/media/MediaStreamTrack.cpp
dom/media/MediaStreamTrack.h
dom/media/TrackUnionStream.cpp
dom/media/TrackUnionStream.h
dom/media/encoder/MediaEncoder.h
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/test/FakeMediaStreams.h
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -750,27 +750,27 @@ DOMMediaStream::HasTrack(const MediaStre
 
 bool
 DOMMediaStream::OwnsTrack(const MediaStreamTrack& aTrack) const
 {
   return !!FindOwnedTrackPort(aTrack);
 }
 
 bool
-DOMMediaStream::AddDirectListener(MediaStreamDirectListener* aListener)
+DOMMediaStream::AddDirectListener(DirectMediaStreamListener* aListener)
 {
   if (GetInputStream() && GetInputStream()->AsSourceStream()) {
     GetInputStream()->AsSourceStream()->AddDirectListener(aListener);
     return true; // application should ignore NotifyQueuedTrackData
   }
   return false;
 }
 
 void
-DOMMediaStream::RemoveDirectListener(MediaStreamDirectListener* aListener)
+DOMMediaStream::RemoveDirectListener(DirectMediaStreamListener* aListener)
 {
   if (GetInputStream() && GetInputStream()->AsSourceStream()) {
     GetInputStream()->AsSourceStream()->RemoveDirectListener(aListener);
   }
 }
 
 bool
 DOMMediaStream::IsFinished()
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -25,17 +25,17 @@
 
 namespace mozilla {
 
 class DOMHwMediaStream;
 class DOMLocalMediaStream;
 class DOMMediaStream;
 class MediaStream;
 class MediaInputPort;
-class MediaStreamDirectListener;
+class DirectMediaStreamListener;
 class MediaStreamGraph;
 class ProcessedMediaStream;
 
 enum class BlockingMode;
 
 namespace dom {
 class AudioNode;
 class HTMLCanvasElement;
@@ -434,18 +434,18 @@ public:
    * needs special treatment.
    */
   virtual MediaStream* GetCameraStream() const { return nullptr; }
 
   /**
    * Allows users to get access to media data without going through graph
    * queuing. Returns a bool to let us know if direct data will be delivered.
    */
-  bool AddDirectListener(MediaStreamDirectListener *aListener);
-  void RemoveDirectListener(MediaStreamDirectListener *aListener);
+  bool AddDirectListener(DirectMediaStreamListener *aListener);
+  void RemoveDirectListener(DirectMediaStreamListener *aListener);
 
   virtual DOMLocalMediaStream* AsDOMLocalMediaStream() { return nullptr; }
   virtual DOMHwMediaStream* AsDOMHwMediaStream() { return nullptr; }
 
   bool IsFinished();
   /**
    * Returns a principal indicating who may access this stream. The stream contents
    * can only be accessed by principals subsuming this principal.
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -2523,66 +2523,66 @@ MediaStream::RemoveTrackListener(MediaSt
     }
     RefPtr<MediaStreamTrackListener> mListener;
     TrackID mTrackID;
   };
   GraphImpl()->AppendMessage(MakeUnique<Message>(this, aListener, aTrackID));
 }
 
 void
-MediaStream::AddDirectTrackListenerImpl(already_AddRefed<MediaStreamTrackDirectListener> aListener,
+MediaStream::AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
                                         TrackID aTrackID)
 {
   // Base implementation, for streams that don't support direct track listeners.
-  RefPtr<MediaStreamTrackDirectListener> listener = aListener;
+  RefPtr<DirectMediaStreamTrackListener> listener = aListener;
   listener->NotifyDirectListenerInstalled(
-    MediaStreamTrackDirectListener::InstallationResult::STREAM_NOT_SUPPORTED);
+    DirectMediaStreamTrackListener::InstallationResult::STREAM_NOT_SUPPORTED);
 }
 
 void
-MediaStream::AddDirectTrackListener(MediaStreamTrackDirectListener* aListener,
+MediaStream::AddDirectTrackListener(DirectMediaStreamTrackListener* aListener,
                                     TrackID aTrackID)
 {
   class Message : public ControlMessage {
   public:
-    Message(MediaStream* aStream, MediaStreamTrackDirectListener* aListener,
+    Message(MediaStream* aStream, DirectMediaStreamTrackListener* aListener,
             TrackID aTrackID) :
       ControlMessage(aStream), mListener(aListener), mTrackID(aTrackID) {}
     virtual void Run()
     {
       mStream->AddDirectTrackListenerImpl(mListener.forget(), mTrackID);
     }
-    RefPtr<MediaStreamTrackDirectListener> mListener;
+    RefPtr<DirectMediaStreamTrackListener> mListener;
     TrackID mTrackID;
   };
   GraphImpl()->AppendMessage(MakeUnique<Message>(this, aListener, aTrackID));
 }
 
 void
-MediaStream::RemoveDirectTrackListenerImpl(MediaStreamTrackDirectListener* aListener,
+MediaStream::RemoveDirectTrackListenerImpl(DirectMediaStreamTrackListener* aListener,
                                            TrackID aTrackID)
 {
   // Base implementation, the listener was never added so nothing to do.
-  RefPtr<MediaStreamTrackDirectListener> listener = aListener;
+  RefPtr<DirectMediaStreamTrackListener> listener = aListener;
 }
 
 void
-MediaStream::RemoveDirectTrackListener(MediaStreamTrackDirectListener* aListener,
+MediaStream::RemoveDirectTrackListener(DirectMediaStreamTrackListener* aListener,
                                        TrackID aTrackID)
 {
   class Message : public ControlMessage {
   public:
-    Message(MediaStream* aStream, MediaStreamTrackDirectListener* aListener,
+    Message(MediaStream* aStream, DirectMediaStreamTrackListener* aListener,
             TrackID aTrackID) :
       ControlMessage(aStream), mListener(aListener), mTrackID(aTrackID) {}
     virtual void Run()
     {
       mStream->RemoveDirectTrackListenerImpl(mListener, mTrackID);
     }
-    RefPtr<MediaStreamTrackDirectListener> mListener;
+    RefPtr<DirectMediaStreamTrackListener> mListener;
     TrackID mTrackID;
   };
   GraphImpl()->AppendMessage(MakeUnique<Message>(this, aListener, aTrackID));
 }
 
 void
 MediaStream::RunAfterPendingUpdates(already_AddRefed<nsIRunnable> aRunnable)
 {
@@ -2840,23 +2840,23 @@ SourceMediaStream::AppendToTrack(TrackID
 void
 SourceMediaStream::NotifyDirectConsumers(TrackData *aTrack,
                                          MediaSegment *aSegment)
 {
   mMutex.AssertCurrentThreadOwns();
   MOZ_ASSERT(aTrack);
 
   for (uint32_t j = 0; j < mDirectListeners.Length(); ++j) {
-    MediaStreamDirectListener* l = mDirectListeners[j];
+    DirectMediaStreamListener* l = mDirectListeners[j];
     StreamTime offset = 0; // FIX! need a separate StreamTime.... or the end of the internal buffer
     l->NotifyRealtimeData(static_cast<MediaStreamGraph*>(GraphImpl()), aTrack->mID,
                           offset, aTrack->mCommands, *aSegment);
   }
 
-  for (const TrackBound<MediaStreamTrackDirectListener>& source
+  for (const TrackBound<DirectMediaStreamTrackListener>& source
          : mDirectTrackListeners) {
     if (aTrack->mID != source.mTrackID) {
       continue;
     }
     StreamTime offset = 0; // FIX! need a separate StreamTime.... or the end of the internal buffer
     source.mListener->NotifyRealtimeTrackDataAndApplyTrackDisabling(Graph(), offset, *aSegment);
   }
 }
@@ -2883,96 +2883,96 @@ SourceMediaStream::NotifyListenersEvent(
         mStream->AsSourceStream()->NotifyListenersEventImpl(mEvent);
       }
     MediaStreamListener::MediaStreamGraphEvent mEvent;
   };
   GraphImpl()->AppendMessage(MakeUnique<Message>(this, aNewEvent));
 }
 
 void
-SourceMediaStream::AddDirectListener(MediaStreamDirectListener* aListener)
+SourceMediaStream::AddDirectListener(DirectMediaStreamListener* aListener)
 {
   bool wasEmpty;
   {
     MutexAutoLock lock(mMutex);
     wasEmpty = mDirectListeners.IsEmpty();
     mDirectListeners.AppendElement(aListener);
   }
 
   if (wasEmpty) {
     // Async
     NotifyListenersEvent(MediaStreamListener::EVENT_HAS_DIRECT_LISTENERS);
   }
 }
 
 void
-SourceMediaStream::RemoveDirectListener(MediaStreamDirectListener* aListener)
+SourceMediaStream::RemoveDirectListener(DirectMediaStreamListener* aListener)
 {
   bool isEmpty;
   {
     MutexAutoLock lock(mMutex);
     mDirectListeners.RemoveElement(aListener);
     isEmpty = mDirectListeners.IsEmpty();
   }
 
   if (isEmpty) {
     // Async
     NotifyListenersEvent(MediaStreamListener::EVENT_HAS_NO_DIRECT_LISTENERS);
   }
 }
 
 void
-SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefed<MediaStreamTrackDirectListener> aListener,
+SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
                                               TrackID aTrackID)
 {
   MOZ_ASSERT(IsTrackIDExplicit(aTrackID));
   TrackData* data;
   bool found;
   bool isAudio;
-  RefPtr<MediaStreamTrackDirectListener> listener = aListener;
+  RefPtr<DirectMediaStreamTrackListener> listener = aListener;
   STREAM_LOG(LogLevel::Debug, ("Adding direct track listener %p bound to track %d to source stream %p",
              listener.get(), aTrackID, this));
   {
     MutexAutoLock lock(mMutex);
     data = FindDataForTrack(aTrackID);
     found = !!data;
     isAudio = found && data->mData->GetType() == MediaSegment::AUDIO;
     if (found && isAudio) {
-      TrackBound<MediaStreamTrackDirectListener>* sourceListener =
+      TrackBound<DirectMediaStreamTrackListener>* sourceListener =
         mDirectTrackListeners.AppendElement();
       sourceListener->mListener = listener;
       sourceListener->mTrackID = aTrackID;
     }
   }
   if (!found) {
     STREAM_LOG(LogLevel::Warning, ("Couldn't find source track for direct track listener %p",
                                    listener.get()));
     listener->NotifyDirectListenerInstalled(
-      MediaStreamTrackDirectListener::InstallationResult::TRACK_NOT_FOUND_AT_SOURCE);
+      DirectMediaStreamTrackListener::InstallationResult::TRACK_NOT_FOUND_AT_SOURCE);
     return;
   }
   if (!isAudio) {
     STREAM_LOG(LogLevel::Warning, ("Source track for direct track listener %p is not audio",
                                    listener.get()));
     listener->NotifyDirectListenerInstalled(
-      MediaStreamTrackDirectListener::InstallationResult::TRACK_TYPE_NOT_SUPPORTED);
+      DirectMediaStreamTrackListener::InstallationResult::TRACK_TYPE_NOT_SUPPORTED);
     return;
   }
   STREAM_LOG(LogLevel::Debug, ("Added direct track listener %p", listener.get()));
   listener->NotifyDirectListenerInstalled(
-    MediaStreamTrackDirectListener::InstallationResult::SUCCESS);
+    DirectMediaStreamTrackListener::InstallationResult::SUCCESS);
 }
 
 void
-SourceMediaStream::RemoveDirectTrackListenerImpl(MediaStreamTrackDirectListener* aListener,
+SourceMediaStream::RemoveDirectTrackListenerImpl(DirectMediaStreamTrackListener* aListener,
                                                  TrackID aTrackID)
 {
   MutexAutoLock lock(mMutex);
   for (int32_t i = mDirectTrackListeners.Length() - 1; i >= 0; --i) {
-    const TrackBound<MediaStreamTrackDirectListener>& source =
+    const TrackBound<DirectMediaStreamTrackListener>& source =
       mDirectTrackListeners[i];
     if (source.mListener == aListener && source.mTrackID == aTrackID) {
       aListener->NotifyDirectListenerUninstalled();
       mDirectTrackListeners.RemoveElementAt(i);
     }
   }
 }
 
@@ -3022,17 +3022,17 @@ SourceMediaStream::FinishWithLockHeld()
   }
 }
 
 void
 SourceMediaStream::SetTrackEnabledImpl(TrackID aTrackID, bool aEnabled)
 {
   {
     MutexAutoLock lock(mMutex);
-    for (TrackBound<MediaStreamTrackDirectListener>& l: mDirectTrackListeners) {
+    for (TrackBound<DirectMediaStreamTrackListener>& l: mDirectTrackListeners) {
       if (l.mTrackID == aTrackID) {
         bool oldEnabled = !mDisabledTrackIDs.Contains(aTrackID);
         if (!oldEnabled && aEnabled) {
           STREAM_LOG(LogLevel::Debug, ("SourceMediaStream %p track %d setting "
                                        "direct listener enabled",
                                        this, aTrackID));
           l.mListener->DecreaseDisabled();
         } else if (oldEnabled && !aEnabled) {
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -277,23 +277,23 @@ protected:
 
 
 /**
  * This is a base class for media graph thread listener direct callbacks
  * from within AppendToTrack(). Note that your regular listener will
  * still get NotifyQueuedTrackChanges() callbacks from the MSG thread, so
  * you must be careful to ignore them if AddDirectListener was successful.
  */
-class MediaStreamDirectListener : public MediaStreamListener
+class DirectMediaStreamListener : public MediaStreamListener
 {
 public:
-  virtual ~MediaStreamDirectListener() {}
+  virtual ~DirectMediaStreamListener() {}
 
   /*
-   * This will be called on any MediaStreamDirectListener added to a
+   * This will be called on any DirectMediaStreamListener added to a
    * a SourceMediaStream when AppendToTrack() is called.  The MediaSegment
    * will be the RawSegment (unresampled) if available in AppendToTrack().
    * Note that NotifyQueuedTrackChanges() calls will also still occur.
    */
   virtual void NotifyRealtimeData(MediaStreamGraph* aGraph, TrackID aID,
                                   StreamTime aTrackOffset,
                                   uint32_t aTrackEvents,
                                   const MediaSegment& aMedia) {}
@@ -310,24 +310,24 @@ public:
  * forwarding if it doesn't.
  * Once it reaches a SourceMediaStream, it can be successfully installed.
  * Other types of streams will fail installation since they are not supported.
  *
  * Note that this listener and others for the same track will still get
  * NotifyQueuedChanges() callbacks from the MSG tread, so you must be careful
  * to ignore them if this listener was successfully installed.
  */
-class MediaStreamTrackDirectListener : public MediaStreamTrackListener
+class DirectMediaStreamTrackListener : public MediaStreamTrackListener
 {
   friend class SourceMediaStream;
   friend class TrackUnionStream;
 
 public:
   /*
-   * This will be called on any MediaStreamTrackDirectListener added to a
+   * This will be called on any DirectMediaStreamTrackListener added to a
    * SourceMediaStream when AppendToTrack() is called for the listener's bound
    * track, using the thread of the AppendToTrack() caller. The MediaSegment
    * will be the RawSegment (unresampled) if available in AppendToTrack().
    * If the track is enabled at the source but has been disabled in one of the
    * streams in between the source and where it was originally added, aMedia
    * will be a disabled version of the one passed to AppendToTrack() as well.
    * Note that NotifyQueuedTrackChanges() calls will also still occur.
    */
@@ -357,17 +357,17 @@ public:
     TRACK_TYPE_NOT_SUPPORTED,
     STREAM_NOT_SUPPORTED,
     SUCCESS
   };
   virtual void NotifyDirectListenerInstalled(InstallationResult aResult) {}
   virtual void NotifyDirectListenerUninstalled() {}
 
 protected:
-  virtual ~MediaStreamTrackDirectListener() {}
+  virtual ~DirectMediaStreamTrackListener() {}
 
   void MirrorAndDisableSegment(AudioSegment& aFrom, AudioSegment& aTo)
   {
     aTo.Clear();
     aTo.AppendNullData(aFrom.GetDuration());
   }
 
   void NotifyRealtimeTrackDataAndApplyTrackDisabling(MediaStreamGraph* aGraph,
@@ -595,28 +595,28 @@ public:
   /**
    * Adds aListener to the source stream of track aTrackID in this stream.
    * When the MediaStreamGraph processes the added listener, it will traverse
    * the graph and add it to the track's source stream (remapping the TrackID
    * along the way).
    * Note that the listener will be notified on the MediaStreamGraph thread
    * with whether the installation of it at the source was successful or not.
    */
-  virtual void AddDirectTrackListener(MediaStreamTrackDirectListener* aListener,
+  virtual void AddDirectTrackListener(DirectMediaStreamTrackListener* aListener,
                                       TrackID aTrackID);
 
   /**
    * Removes aListener from the source stream of track aTrackID in this stream.
    * Note that the listener has already been removed if the link between the
    * source of track aTrackID and this stream has been broken (and made track
    * aTrackID end). The caller doesn't have to care about this, removing when
    * the source cannot be found, or when the listener had already been removed
    * does nothing.
    */
-  virtual void RemoveDirectTrackListener(MediaStreamTrackDirectListener* aListener,
+  virtual void RemoveDirectTrackListener(DirectMediaStreamTrackListener* aListener,
                                          TrackID aTrackID);
 
   // A disabled track has video replaced by black, and audio replaced by
   // silence.
   void SetTrackEnabled(TrackID aTrackID, bool aEnabled);
 
   // Finish event will be notified by calling methods of aListener. It is the
   // responsibility of the caller to remove aListener before it is destroyed.
@@ -709,19 +709,19 @@ public:
   void RemoveVideoOutputImpl(VideoFrameContainer* aContainer);
   void AddListenerImpl(already_AddRefed<MediaStreamListener> aListener);
   void RemoveListenerImpl(MediaStreamListener* aListener);
   void RemoveAllListenersImpl();
   virtual void AddTrackListenerImpl(already_AddRefed<MediaStreamTrackListener> aListener,
                                     TrackID aTrackID);
   virtual void RemoveTrackListenerImpl(MediaStreamTrackListener* aListener,
                                        TrackID aTrackID);
-  virtual void AddDirectTrackListenerImpl(already_AddRefed<MediaStreamTrackDirectListener> aListener,
+  virtual void AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
                                           TrackID aTrackID);
-  virtual void RemoveDirectTrackListenerImpl(MediaStreamTrackDirectListener* aListener,
+  virtual void RemoveDirectTrackListenerImpl(DirectMediaStreamTrackListener* aListener,
                                              TrackID aTrackID);
   virtual void SetTrackEnabledImpl(TrackID aTrackID, bool aEnabled);
 
   void AddConsumer(MediaInputPort* aPort)
   {
     mConsumers.AppendElement(aPort);
   }
   void RemoveConsumer(MediaInputPort* aPort)
@@ -998,18 +998,18 @@ public:
 
   /**
    * These add/remove DirectListeners, which allow bypassing the graph and any
    * synchronization delays for e.g. PeerConnection, which wants the data ASAP
    * and lets the far-end handle sync and playout timing.
    */
   void NotifyListenersEventImpl(MediaStreamListener::MediaStreamGraphEvent aEvent);
   void NotifyListenersEvent(MediaStreamListener::MediaStreamGraphEvent aEvent);
-  void AddDirectListener(MediaStreamDirectListener* aListener);
-  void RemoveDirectListener(MediaStreamDirectListener* aListener);
+  void AddDirectListener(DirectMediaStreamListener* aListener);
+  void RemoveDirectListener(DirectMediaStreamListener* aListener);
 
   enum {
     ADDTRACK_QUEUED    = 0x01 // Queue track add until FinishAddTracks()
   };
   /**
    * Add a new track to the stream starting at the given base time (which
    * must be greater than or equal to the last time passed to
    * AdvanceKnownTracksTime). Takes ownership of aSegment. aSegment should
@@ -1123,19 +1123,19 @@ protected:
     // this is cleared.
     uint32_t mCommands;
   };
 
   bool NeedsMixing();
 
   void ResampleAudioToGraphSampleRate(TrackData* aTrackData, MediaSegment* aSegment);
 
-  void AddDirectTrackListenerImpl(already_AddRefed<MediaStreamTrackDirectListener> aListener,
+  void AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
                                   TrackID aTrackID) override;
-  void RemoveDirectTrackListenerImpl(MediaStreamTrackDirectListener* aListener,
+  void RemoveDirectTrackListenerImpl(DirectMediaStreamTrackListener* aListener,
                                      TrackID aTrackID) override;
 
   void AddTrackInternal(TrackID aID, TrackRate aRate,
                         StreamTime aStart, MediaSegment* aSegment,
                         uint32_t aFlags);
 
   TrackData* FindDataForTrack(TrackID aID)
   {
@@ -1165,18 +1165,18 @@ protected:
 
   // This must be acquired *before* MediaStreamGraphImpl's lock, if they are
   // held together.
   Mutex mMutex;
   // protected by mMutex
   StreamTime mUpdateKnownTracksTime;
   nsTArray<TrackData> mUpdateTracks;
   nsTArray<TrackData> mPendingTracks;
-  nsTArray<RefPtr<MediaStreamDirectListener> > mDirectListeners;
-  nsTArray<TrackBound<MediaStreamTrackDirectListener>> mDirectTrackListeners;
+  nsTArray<RefPtr<DirectMediaStreamListener>> mDirectListeners;
+  nsTArray<TrackBound<DirectMediaStreamTrackListener>> mDirectTrackListeners;
   bool mPullEnabled;
   bool mUpdateFinished;
   bool mNeedsMixing;
 };
 
 /**
  * The blocking mode decides how a track should be blocked in a MediaInputPort.
  */
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -404,28 +404,28 @@ MediaStreamTrack::RemoveListener(MediaSt
 {
   LOG(LogLevel::Debug, ("MediaStreamTrack %p removing listener %p",
                         this, aListener));
 
   GetOwnedStream()->RemoveTrackListener(aListener, mTrackID);
 }
 
 void
-MediaStreamTrack::AddDirectListener(MediaStreamTrackDirectListener *aListener)
+MediaStreamTrack::AddDirectListener(DirectMediaStreamTrackListener *aListener)
 {
   LOG(LogLevel::Debug, ("MediaStreamTrack %p (%s) adding direct listener %p to "
                         "stream %p, track %d",
                         this, AsAudioStreamTrack() ? "audio" : "video",
                         aListener, GetOwnedStream(), mTrackID));
 
   GetOwnedStream()->AddDirectTrackListener(aListener, mTrackID);
 }
 
 void
-MediaStreamTrack::RemoveDirectListener(MediaStreamTrackDirectListener *aListener)
+MediaStreamTrack::RemoveDirectListener(DirectMediaStreamTrackListener *aListener)
 {
   LOG(LogLevel::Debug, ("MediaStreamTrack %p removing direct listener %p from stream %p",
                         this, aListener, GetOwnedStream()));
 
   GetOwnedStream()->RemoveDirectTrackListener(aListener, mTrackID);
 }
 
 already_AddRefed<MediaInputPort>
--- a/dom/media/MediaStreamTrack.h
+++ b/dom/media/MediaStreamTrack.h
@@ -19,17 +19,17 @@ namespace mozilla {
 
 class DOMMediaStream;
 class MediaEnginePhotoCallback;
 class MediaInputPort;
 class MediaStream;
 class MediaStreamGraph;
 class MediaStreamGraphImpl;
 class MediaStreamTrackListener;
-class MediaStreamTrackDirectListener;
+class DirectMediaStreamTrackListener;
 class PeerConnectionImpl;
 class PeerConnectionMedia;
 class PeerIdentity;
 class ProcessedMediaStream;
 class RemoteSourceStreamInfo;
 class SourceStreamInfo;
 
 namespace dom {
@@ -358,18 +358,18 @@ public:
   void RemoveListener(MediaStreamTrackListener* aListener);
 
   /**
    * Attempts to add a direct track listener to this track.
    * Callers must listen to the NotifyInstalled event to know if installing
    * the listener succeeded (tracks originating from SourceMediaStreams) or
    * failed (e.g., WebAudio originated tracks).
    */
-  void AddDirectListener(MediaStreamTrackDirectListener *aListener);
-  void RemoveDirectListener(MediaStreamTrackDirectListener  *aListener);
+  void AddDirectListener(DirectMediaStreamTrackListener *aListener);
+  void RemoveDirectListener(DirectMediaStreamTrackListener  *aListener);
 
   /**
    * Sets up a MediaInputPort from the underlying track that this
    * MediaStreamTrack represents, to aStream, and returns it.
    */
   already_AddRefed<MediaInputPort> ForwardTrackContentsTo(ProcessedMediaStream* aStream);
 
   /**
--- a/dom/media/TrackUnionStream.cpp
+++ b/dom/media/TrackUnionStream.cpp
@@ -216,17 +216,17 @@ TrackUnionStream::TrackUnionStream(DOMMe
     map->mEndOfLastInputIntervalInInputStream = -1;
     map->mEndOfLastInputIntervalInOutputStream = -1;
     map->mInputPort = aPort;
     map->mInputTrackID = aTrack->GetID();
     map->mOutputTrackID = track->GetID();
     map->mSegment = aTrack->GetSegment()->CreateEmptyClone();
 
     for (int32_t i = mPendingDirectTrackListeners.Length() - 1; i >= 0; --i) {
-      TrackBound<MediaStreamTrackDirectListener>& bound =
+      TrackBound<DirectMediaStreamTrackListener>& bound =
         mPendingDirectTrackListeners[i];
       if (bound.mTrackID != map->mOutputTrackID) {
         continue;
       }
       MediaStream* source = map->mInputPort->GetSource();
       map->mOwnedDirectListeners.AppendElement(bound.mListener);
       if (mDisabledTrackIDs.Contains(bound.mTrackID)) {
         bound.mListener->IncreaseDisabled();
@@ -350,17 +350,17 @@ TrackUnionStream::TrackUnionStream(DOMMe
   }
 
 void
 TrackUnionStream::SetTrackEnabledImpl(TrackID aTrackID, bool aEnabled) {
   for (TrackMapEntry& entry : mTrackMap) {
     if (entry.mOutputTrackID == aTrackID) {
       STREAM_LOG(LogLevel::Info, ("TrackUnionStream %p track %d was explicitly %s",
                                    this, aTrackID, aEnabled ? "enabled" : "disabled"));
-      for (MediaStreamTrackDirectListener* listener : entry.mOwnedDirectListeners) {
+      for (DirectMediaStreamTrackListener* listener : entry.mOwnedDirectListeners) {
         bool oldEnabled = !mDisabledTrackIDs.Contains(aTrackID);
         if (!oldEnabled && aEnabled) {
           STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p track %d setting "
                                        "direct listener enabled",
                                        this, aTrackID));
           listener->DecreaseDisabled();
         } else if (oldEnabled && !aEnabled) {
           STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p track %d setting "
@@ -394,20 +394,20 @@ TrackUnionStream::GetInputTrackIDFor(Tra
       return entry.mInputTrackID;
     }
   }
 
   return TRACK_NONE;
 }
 
 void
-TrackUnionStream::AddDirectTrackListenerImpl(already_AddRefed<MediaStreamTrackDirectListener> aListener,
+TrackUnionStream::AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
                                              TrackID aTrackID)
 {
-  RefPtr<MediaStreamTrackDirectListener> listener = aListener;
+  RefPtr<DirectMediaStreamTrackListener> listener = aListener;
 
   for (TrackMapEntry& entry : mTrackMap) {
     if (entry.mOutputTrackID == aTrackID) {
       MediaStream* source = entry.mInputPort->GetSource();
       STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p adding direct listener "
                                    "%p for track %d. Forwarding to input "
                                    "stream %p track %d.",
                                    this, listener.get(), aTrackID, source,
@@ -417,24 +417,24 @@ TrackUnionStream::AddDirectTrackListener
         listener->IncreaseDisabled();
       }
       source->AddDirectTrackListenerImpl(listener.forget(),
                                          entry.mInputTrackID);
       return;
     }
   }
 
-  TrackBound<MediaStreamTrackDirectListener>* bound =
+  TrackBound<DirectMediaStreamTrackListener>* bound =
     mPendingDirectTrackListeners.AppendElement();
   bound->mListener = listener.forget();
   bound->mTrackID = aTrackID;
 }
 
 void
-TrackUnionStream::RemoveDirectTrackListenerImpl(MediaStreamTrackDirectListener* aListener,
+TrackUnionStream::RemoveDirectTrackListenerImpl(DirectMediaStreamTrackListener* aListener,
                                                 TrackID aTrackID)
 {
   for (TrackMapEntry& entry : mTrackMap) {
     // OutputTrackID is unique to this stream so we only need to do this once.
     if (entry.mOutputTrackID != aTrackID) {
       continue;
     }
     for (size_t i = 0; i < entry.mOwnedDirectListeners.Length(); ++i) {
@@ -455,17 +455,17 @@ TrackUnionStream::RemoveDirectTrackListe
     }
     // Forward to the input
     MediaStream* source = entry.mInputPort->GetSource();
     source->RemoveDirectTrackListenerImpl(aListener, entry.mInputTrackID);
     return;
   }
 
   for (size_t i = 0; i < mPendingDirectTrackListeners.Length(); ++i) {
-    TrackBound<MediaStreamTrackDirectListener>& bound =
+    TrackBound<DirectMediaStreamTrackListener>& bound =
       mPendingDirectTrackListeners[i];
     if (bound.mListener == aListener && bound.mTrackID == aTrackID) {
       mPendingDirectTrackListeners.RemoveElementAt(i);
       return;
     }
   }
 }
 } // namespace mozilla
--- a/dom/media/TrackUnionStream.h
+++ b/dom/media/TrackUnionStream.h
@@ -48,42 +48,42 @@ protected:
     // we call StreamTracks::FindTrack, which will return null if
     // the track has been deleted.
     TrackID mInputTrackID;
     TrackID mOutputTrackID;
     nsAutoPtr<MediaSegment> mSegment;
     // These are direct track listeners that have been added to this
     // TrackUnionStream-track and forwarded to the input track. We will update
     // these when this track's disabled status changes.
-    nsTArray<RefPtr<MediaStreamTrackDirectListener>> mOwnedDirectListeners;
+    nsTArray<RefPtr<DirectMediaStreamTrackListener>> mOwnedDirectListeners;
   };
 
   // Add the track to this stream, retaining its TrackID if it has never
   // been previously used in this stream, allocating a new TrackID otherwise.
   uint32_t AddTrack(MediaInputPort* aPort, StreamTracks::Track* aTrack,
                     GraphTime aFrom);
   void EndTrack(uint32_t aIndex);
   void CopyTrackData(StreamTracks::Track* aInputTrack,
                      uint32_t aMapIndex, GraphTime aFrom, GraphTime aTo,
                      bool* aOutputTrackFinished);
 
-  void AddDirectTrackListenerImpl(already_AddRefed<MediaStreamTrackDirectListener> aListener,
+  void AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
                                   TrackID aTrackID) override;
-  void RemoveDirectTrackListenerImpl(MediaStreamTrackDirectListener* aListener,
+  void RemoveDirectTrackListenerImpl(DirectMediaStreamTrackListener* aListener,
                                      TrackID aTrackID) override;
 
   nsTArray<TrackMapEntry> mTrackMap;
 
   // The next available TrackID, starting at 1 and progressing upwards.
   // All TrackIDs in [1, mNextAvailableTrackID) have implicitly been used.
   TrackID mNextAvailableTrackID;
 
   // Sorted array of used TrackIDs that require manual tracking.
   nsTArray<TrackID> mUsedTracks;
 
   // Direct track listeners that have not been forwarded to their input stream
   // yet. We'll forward these as their inputs become available.
-  nsTArray<TrackBound<MediaStreamTrackDirectListener>> mPendingDirectTrackListeners;
+  nsTArray<TrackBound<DirectMediaStreamTrackListener>> mPendingDirectTrackListeners;
 };
 
 } // namespace mozilla
 
 #endif /* MOZILLA_MEDIASTREAMGRAPH_H_ */
--- a/dom/media/encoder/MediaEncoder.h
+++ b/dom/media/encoder/MediaEncoder.h
@@ -46,17 +46,17 @@ namespace mozilla {
  * 2) Dispatch the task GetEncodedData() to a worker thread.
  *
  * 3) To start encoding, add this component to its source stream.
  *    => sourceStream->AddListener(encoder);
  *
  * 4) To stop encoding, remove this component from its source stream.
  *    => sourceStream->RemoveListener(encoder);
  */
-class MediaEncoder : public MediaStreamDirectListener
+class MediaEncoder : public DirectMediaStreamListener
 {
 public :
   enum {
     ENCODE_METADDATA,
     ENCODE_TRACK,
     ENCODE_DONE,
     ENCODE_ERROR,
   };
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -1069,17 +1069,17 @@ void MediaPipeline::PacketReceived(Trans
   if (IsRtp(data, len)) {
     RtpPacketReceived(layer, data, len);
   } else {
     RtcpPacketReceived(layer, data, len);
   }
 }
 
 class MediaPipelineTransmit::PipelineListener
-  : public MediaStreamTrackDirectListener
+  : public DirectMediaStreamTrackListener
 {
 friend class MediaPipelineTransmit;
 public:
   explicit PipelineListener(const RefPtr<MediaSessionConduit>& conduit)
     : conduit_(conduit),
       track_id_(TRACK_INVALID),
       mMutex("MediaPipelineTransmit::PipelineListener"),
       track_id_external_(TRACK_INVALID),
@@ -1144,17 +1144,17 @@ public:
   }
 #endif
 
   // Implement MediaStreamTrackListener
   void NotifyQueuedChanges(MediaStreamGraph* aGraph,
                            StreamTime aTrackOffset,
                            const MediaSegment& aQueuedMedia) override;
 
-  // Implement MediaStreamTrackDirectListener
+  // Implement DirectMediaStreamTrackListener
   void NotifyRealtimeTrackData(MediaStreamGraph* aGraph,
                                StreamTime aTrackOffset,
                                const MediaSegment& aMedia) override;
   void NotifyDirectListenerInstalled(InstallationResult aResult) override;
   void NotifyDirectListenerUninstalled() override;
 
 private:
   void UnsetTrackIdImpl() {
--- a/media/webrtc/signaling/test/FakeMediaStreams.h
+++ b/media/webrtc/signaling/test/FakeMediaStreams.h
@@ -98,20 +98,20 @@ public:
                                        mozilla::StreamTime aTrackOffset,
                                        const mozilla::AudioSegment& aQueuedMedia,
                                        Fake_MediaStream* aInputStream,
                                        mozilla::TrackID aInputTrackID) {}
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fake_MediaStreamListener)
 };
 
-class Fake_MediaStreamDirectListener : public Fake_MediaStreamListener
+class Fake_DirectMediaStreamListener : public Fake_MediaStreamListener
 {
 protected:
-  virtual ~Fake_MediaStreamDirectListener() {}
+  virtual ~Fake_DirectMediaStreamListener() {}
 
 public:
   virtual void NotifyRealtimeData(mozilla::MediaStreamGraph* graph, mozilla::TrackID tid,
                                   mozilla::StreamTime offset,
                                   const mozilla::MediaSegment& media) = 0;
 };
 
 class Fake_MediaStreamTrackListener
@@ -122,20 +122,20 @@ protected:
   virtual ~Fake_MediaStreamTrackListener() {}
 
 public:
   virtual void NotifyQueuedChanges(mozilla::MediaStreamGraph* aGraph,
                                    mozilla::StreamTime aTrackOffset,
                                    const mozilla::MediaSegment& aQueuedMedia) = 0;
 };
 
-class Fake_MediaStreamTrackDirectListener : public Fake_MediaStreamTrackListener
+class Fake_DirectMediaStreamTrackListener : public Fake_MediaStreamTrackListener
 {
 protected:
-  virtual ~Fake_MediaStreamTrackDirectListener() {}
+  virtual ~Fake_DirectMediaStreamTrackListener() {}
 
 public:
   virtual void NotifyRealtimeTrackData(mozilla::MediaStreamGraph* aGraph,
                                        mozilla::StreamTime aTrackOffset,
                                        const mozilla::MediaSegment& aMedia) = 0;
   enum class InstallationResult {
     STREAM_NOT_SUPPORTED,
     SUCCESS
@@ -395,23 +395,23 @@ public:
     return sizeof(Fake_MediaStreamTrack);
   }
   const char* typeName () const
   {
     return "Fake_MediaStreamTrack";
   }
   void AddListener(Fake_MediaStreamTrackListener *aListener);
   void RemoveListener(Fake_MediaStreamTrackListener *aListener);
-  void AddDirectListener(Fake_MediaStreamTrackDirectListener *aListener)
+  void AddDirectListener(Fake_DirectMediaStreamTrackListener *aListener)
   {
     AddListener(aListener);
     aListener->NotifyDirectListenerInstalled(
-      Fake_MediaStreamTrackDirectListener::InstallationResult::STREAM_NOT_SUPPORTED);
+      Fake_DirectMediaStreamTrackListener::InstallationResult::STREAM_NOT_SUPPORTED);
   }
-  void RemoveDirectListener(Fake_MediaStreamTrackDirectListener *aListener)
+  void RemoveDirectListener(Fake_DirectMediaStreamTrackListener *aListener)
   {
     RemoveListener(aListener);
   }
 
   class PrincipalChangeObserver
   {
   public:
     virtual void PrincipalChanged(Fake_MediaStreamTrack* aMediaStreamTrack) = 0;
@@ -606,19 +606,19 @@ class Fake_VideoStreamSource : public Fa
   Fake_VideoStreamSource() : Fake_MediaStreamBase() {}
 };
 
 
 namespace mozilla {
 typedef Fake_MediaStream MediaStream;
 typedef Fake_SourceMediaStream SourceMediaStream;
 typedef Fake_MediaStreamListener MediaStreamListener;
-typedef Fake_MediaStreamDirectListener MediaStreamDirectListener;
+typedef Fake_DirectMediaStreamListener DirectMediaStreamListener;
 typedef Fake_MediaStreamTrackListener MediaStreamTrackListener;
-typedef Fake_MediaStreamTrackDirectListener MediaStreamTrackDirectListener;
+typedef Fake_DirectMediaStreamTrackListener DirectMediaStreamTrackListener;
 typedef Fake_DOMMediaStream DOMMediaStream;
 typedef Fake_DOMMediaStream DOMLocalMediaStream;
 
 namespace dom {
 typedef Fake_MediaStreamTrack MediaStreamTrack;
 typedef Fake_MediaStreamTrackSource MediaStreamTrackSource;
 }
 }