Bug 1652884 - Rename MediaTrack::SetEnabled to SetDisabledTrackMode. r=pehrsons
authorJan-Ivar Bruaroey <jib@mozilla.com>
Wed, 19 Aug 2020 22:18:04 +0000
changeset 545442 1c059a524a701193181a11494e1cff58a5d67359
parent 545441 a7bce4685014fbf318cac6df3d68c5b277bfb14e
child 545443 048e722589de8687345a86571b68c228b2c81c26
push id37713
push userabutkovits@mozilla.com
push dateThu, 20 Aug 2020 09:32:09 +0000
treeherdermozilla-central@8cb700c12bd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1652884
milestone81.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 1652884 - Rename MediaTrack::SetEnabled to SetDisabledTrackMode. r=pehrsons Differential Revision: https://phabricator.services.mozilla.com/D86070
dom/html/HTMLMediaElement.cpp
dom/media/ForwardedInputTrack.cpp
dom/media/ForwardedInputTrack.h
dom/media/MediaStreamTrack.cpp
dom/media/MediaTrackGraph.cpp
dom/media/MediaTrackGraph.h
dom/media/webaudio/AudioDestinationNode.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1125,18 +1125,18 @@ class HTMLMediaElement::MediaElementTrac
     mCapturedTrack->AddConsumer(this);
     mCapturedTrackSource->RegisterSink(this);
   }
 
   void SetEnabled(bool aEnabled) {
     if (!mTrack) {
       return;
     }
-    mTrack->SetEnabled(aEnabled ? DisabledTrackMode::ENABLED
-                                : DisabledTrackMode::SILENCE_FREEZE);
+    mTrack->SetDisabledTrackMode(aEnabled ? DisabledTrackMode::ENABLED
+                                          : DisabledTrackMode::SILENCE_FREEZE);
   }
 
   void SetPrincipal(RefPtr<nsIPrincipal> aPrincipal) {
     mPrincipal = std::move(aPrincipal);
     MediaStreamTrackSource::PrincipalChanged();
   }
 
   void SetMutedByElement(OutputMuteState aMuteState) {
--- a/dom/media/ForwardedInputTrack.cpp
+++ b/dom/media/ForwardedInputTrack.cpp
@@ -165,17 +165,17 @@ void ForwardedInputTrack::ProcessInput(G
     MOZ_CRASH("Unknown segment type");
   }
 
   if (mEnded) {
     RemoveAllDirectListenersImpl();
   }
 }
 
-void ForwardedInputTrack::SetEnabledImpl(DisabledTrackMode aMode) {
+void ForwardedInputTrack::SetDisabledTrackModeImpl(DisabledTrackMode aMode) {
   bool enabled = aMode == DisabledTrackMode::ENABLED;
   TRACK_LOG(LogLevel::Info, ("ForwardedInputTrack %p was explicitly %s", this,
                              enabled ? "enabled" : "disabled"));
   for (DirectMediaTrackListener* listener : mOwnedDirectListeners) {
     DisabledTrackMode oldMode = mDisabledMode;
     bool oldEnabled = oldMode == DisabledTrackMode::ENABLED;
     if (!oldEnabled && enabled) {
       TRACK_LOG(LogLevel::Debug, ("ForwardedInputTrack %p setting "
@@ -184,17 +184,17 @@ void ForwardedInputTrack::SetEnabledImpl
       listener->DecreaseDisabled(oldMode);
     } else if (oldEnabled && !enabled) {
       TRACK_LOG(LogLevel::Debug, ("ForwardedInputTrack %p setting "
                                   "direct listener disabled",
                                   this));
       listener->IncreaseDisabled(aMode);
     }
   }
-  MediaTrack::SetEnabledImpl(aMode);
+  MediaTrack::SetDisabledTrackModeImpl(aMode);
 }
 
 void ForwardedInputTrack::AddDirectListenerImpl(
     already_AddRefed<DirectMediaTrackListener> aListener) {
   RefPtr<DirectMediaTrackListener> listener = aListener;
   mOwnedDirectListeners.AppendElement(listener);
 
   DisabledTrackMode currentMode = mDisabledMode;
--- a/dom/media/ForwardedInputTrack.h
+++ b/dom/media/ForwardedInputTrack.h
@@ -21,17 +21,17 @@ class ForwardedInputTrack : public Proce
 
   virtual ForwardedInputTrack* AsForwardedInputTrack() override { return this; }
   friend class DOMMediaStream;
 
   void AddInput(MediaInputPort* aPort) override;
   void RemoveInput(MediaInputPort* aPort) override;
   void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) override;
 
-  void SetEnabledImpl(DisabledTrackMode aMode) override;
+  void SetDisabledTrackModeImpl(DisabledTrackMode aMode) override;
 
   friend class MediaTrackGraphImpl;
 
  protected:
   // Set up this track from a specific input.
   void SetInput(MediaInputPort* aPort);
 
   // MediaSegment-agnostic ProcessInput.
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -290,18 +290,18 @@ void MediaStreamTrack::SetEnabled(bool a
   }
 
   mEnabled = aEnabled;
 
   if (Ended()) {
     return;
   }
 
-  mTrack->SetEnabled(mEnabled ? DisabledTrackMode::ENABLED
-                              : DisabledTrackMode::SILENCE_BLACK);
+  mTrack->SetDisabledTrackMode(mEnabled ? DisabledTrackMode::ENABLED
+                                        : DisabledTrackMode::SILENCE_BLACK);
   NotifyEnabledChanged();
 }
 
 void MediaStreamTrack::Stop() {
   LOG(LogLevel::Info, ("MediaStreamTrack %p Stop()", this));
 
   if (Ended()) {
     LOG(LogLevel::Warning, ("MediaStreamTrack %p Already ended", this));
--- a/dom/media/MediaTrackGraph.cpp
+++ b/dom/media/MediaTrackGraph.cpp
@@ -859,17 +859,18 @@ void MediaTrackGraphImpl::ProcessInputDa
   if (!mInputData) {
     return;
   }
 
   nsTArray<RefPtr<AudioDataListener>>* listeners =
       mInputDeviceUsers.GetValue(mInputDeviceID);
   MOZ_ASSERT(listeners);
   for (auto& listener : *listeners) {
-    listener->NotifyInputData(this, mInputData, mInputFrames, GraphRate(), mInputChannelCount);
+    listener->NotifyInputData(this, mInputData, mInputFrames, GraphRate(),
+                              mInputChannelCount);
   }
 
   mInputData = nullptr;
   mInputFrames = 0;
   mInputChannelCount = 0;
 }
 
 void MediaTrackGraphImpl::DeviceChangedImpl() {
@@ -2310,17 +2311,17 @@ void MediaTrack::RunAfterPendingUpdates(
   };
 
   if (mMainThreadDestroyed) {
     return;
   }
   graph->AppendMessage(MakeUnique<Message>(this, runnable.forget()));
 }
 
-void MediaTrack::SetEnabledImpl(DisabledTrackMode aMode) {
+void MediaTrack::SetDisabledTrackModeImpl(DisabledTrackMode aMode) {
   if (aMode == DisabledTrackMode::ENABLED) {
     mDisabledMode = DisabledTrackMode::ENABLED;
     for (const auto& l : mTrackListeners) {
       l->NotifyEnabledStateChanged(Graph(), true);
     }
   } else {
     MOZ_DIAGNOSTIC_ASSERT(
         mDisabledMode == DisabledTrackMode::ENABLED,
@@ -2329,22 +2330,22 @@ void MediaTrack::SetEnabledImpl(Disabled
     if (aMode == DisabledTrackMode::SILENCE_BLACK) {
       for (const auto& l : mTrackListeners) {
         l->NotifyEnabledStateChanged(Graph(), false);
       }
     }
   }
 }
 
-void MediaTrack::SetEnabled(DisabledTrackMode aMode) {
+void MediaTrack::SetDisabledTrackMode(DisabledTrackMode aMode) {
   class Message : public ControlMessage {
    public:
     Message(MediaTrack* aTrack, DisabledTrackMode aMode)
         : ControlMessage(aTrack), mMode(aMode) {}
-    void Run() override { mTrack->SetEnabledImpl(mMode); }
+    void Run() override { mTrack->SetDisabledTrackModeImpl(mMode); }
     DisabledTrackMode mMode;
   };
   if (mMainThreadDestroyed) {
     return;
   }
   GraphImpl()->AppendMessage(MakeUnique<Message>(this, aMode));
 }
 
@@ -2818,17 +2819,17 @@ void SourceMediaTrack::End() {
   if (auto graph = GraphImpl()) {
     MonitorAutoLock lock(graph->GetMonitor());
     if (graph->CurrentDriver()) {  // graph has not completed forced shutdown
       graph->EnsureNextIteration();
     }
   }
 }
 
-void SourceMediaTrack::SetEnabledImpl(DisabledTrackMode aMode) {
+void SourceMediaTrack::SetDisabledTrackModeImpl(DisabledTrackMode aMode) {
   {
     MutexAutoLock lock(mMutex);
     for (const auto& l : mDirectTrackListeners) {
       DisabledTrackMode oldMode = mDisabledMode;
       bool oldEnabled = oldMode == DisabledTrackMode::ENABLED;
       if (!oldEnabled && aMode == DisabledTrackMode::ENABLED) {
         LOG(LogLevel::Debug, ("%p: SourceMediaTrack %p setting "
                               "direct listener enabled",
@@ -2837,17 +2838,17 @@ void SourceMediaTrack::SetEnabledImpl(Di
       } else if (oldEnabled && aMode != DisabledTrackMode::ENABLED) {
         LOG(LogLevel::Debug, ("%p: SourceMediaTrack %p setting "
                               "direct listener disabled",
                               GraphImpl(), this));
         l->IncreaseDisabled(aMode);
       }
     }
   }
-  MediaTrack::SetEnabledImpl(aMode);
+  MediaTrack::SetDisabledTrackModeImpl(aMode);
 }
 
 void SourceMediaTrack::RemoveAllDirectListenersImpl() {
   GraphImpl()->AssertOnGraphThreadOrNotRunning();
   MutexAutoLock lock(mMutex);
 
   for (auto& l : mDirectTrackListeners.Clone()) {
     l->NotifyDirectListenerUninstalled();
--- a/dom/media/MediaTrackGraph.h
+++ b/dom/media/MediaTrackGraph.h
@@ -324,17 +324,17 @@ class MediaTrack : public mozilla::Linke
    * source and this track has been broken. 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 RemoveDirectListener(DirectMediaTrackListener* aListener);
 
   // A disabled track has video replaced by black, and audio replaced by
   // silence.
-  void SetEnabled(DisabledTrackMode aMode);
+  void SetDisabledTrackMode(DisabledTrackMode aMode);
 
   // End event will be notified by calling methods of aListener. It is the
   // responsibility of the caller to remove aListener before it is destroyed.
   void AddMainThreadListener(MainThreadMediaTrackListener* aListener);
   // It's safe to call this even if aListener is not currently a listener;
   // the call will be ignored.
   void RemoveMainThreadListener(MainThreadMediaTrackListener* aListener) {
     MOZ_ASSERT(NS_IsMainThread());
@@ -406,17 +406,17 @@ class MediaTrack : public mozilla::Linke
   virtual void RemoveAllDirectListenersImpl() {}
   void RemoveAllResourcesAndListenersImpl();
 
   virtual void AddListenerImpl(already_AddRefed<MediaTrackListener> aListener);
   virtual void RemoveListenerImpl(MediaTrackListener* aListener);
   virtual void AddDirectListenerImpl(
       already_AddRefed<DirectMediaTrackListener> aListener);
   virtual void RemoveDirectListenerImpl(DirectMediaTrackListener* aListener);
-  virtual void SetEnabledImpl(DisabledTrackMode aMode);
+  virtual void SetDisabledTrackModeImpl(DisabledTrackMode aMode);
 
   void AddConsumer(MediaInputPort* aPort) { mConsumers.AppendElement(aPort); }
   void RemoveConsumer(MediaInputPort* aPort) {
     mConsumers.RemoveElement(aPort);
   }
   GraphTime StartTime() const { return mStartTime; }
   bool Ended() const { return mEnded; }
 
@@ -666,17 +666,17 @@ class SourceMediaTrack : public MediaTra
   /**
    * Indicate that this track has ended. Do not do any more API calls affecting
    * this track.
    */
   void End();
 
   // Overriding allows us to hold the mMutex lock while changing the track
   // enable status
-  void SetEnabledImpl(DisabledTrackMode aMode) override;
+  void SetDisabledTrackModeImpl(DisabledTrackMode aMode) override;
 
   // Overriding allows us to ensure mMutex is locked while changing the track
   // enable status
   void ApplyTrackDisabling(MediaSegment* aSegment,
                            MediaSegment* aRawSegment = nullptr) override {
     mMutex.AssertCurrentThreadOwns();
     MediaTrack::ApplyTrackDisabling(aSegment, aRawSegment);
   }
--- a/dom/media/webaudio/AudioDestinationNode.cpp
+++ b/dom/media/webaudio/AudioDestinationNode.cpp
@@ -542,17 +542,17 @@ AudioDestinationNode::WindowSuspendChang
       "AudioDestinationNode %p WindowSuspendChanged, "
       "aSuspend = %s\n",
       this, SuspendTypeToStr(aSuspend));
 
   mAudioChannelSuspended = suspended;
 
   DisabledTrackMode disabledMode =
       suspended ? DisabledTrackMode::SILENCE_BLACK : DisabledTrackMode::ENABLED;
-  mTrack->SetEnabled(disabledMode);
+  mTrack->SetDisabledTrackMode(disabledMode);
 
   AudioChannelService::AudibleState audible =
       aSuspend == nsISuspendedTypes::NONE_SUSPENDED
           ? AudioChannelService::AudibleState::eAudible
           : AudioChannelService::AudibleState::eNotAudible;
   if (mAudible != audible) {
     mAudible = audible;
     mAudioChannelAgent->NotifyStartedAudible(