Bug 1400889 - Keep constant output channels in MediaStreamGraph. r=padenot
authorAlex Chronopoulos <achronop@gmail.com>
Tue, 03 Oct 2017 17:56:53 +0300
changeset 427519 d798bb059d77ed0badd848ad720d71792d347bfa
parent 427518 a701f7c8334f814bf16c0b2eadc74b51d81d90be
child 427520 0d8b611c0dd24c8bec5da3fae3c55e99b977c93e
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewerspadenot
bugs1400889
milestone58.0a1
Bug 1400889 - Keep constant output channels in MediaStreamGraph. r=padenot MozReview-Commit-ID: JlQdxU0aNOf
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraphImpl.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -3432,16 +3432,17 @@ MediaStreamGraphImpl::MediaStreamGraphIm
   , mNonRealtimeProcessing(false)
   , mStreamOrderDirty(false)
   , mLatencyLog(AsyncLatencyLogger::Get())
   , mAbstractMainThread(aMainThread)
 #ifdef MOZ_WEBRTC
   , mFarendObserverRef(nullptr)
 #endif
   , mSelfRef(this)
+  , mOutputChannels(std::min<uint32_t>(8, CubebUtils::MaxNumberOfChannels()))
 #ifdef DEBUG
   , mCanRunMessagesSynchronously(false)
 #endif
 {
   if (mRealtime) {
     if (aDriverRequested == AUDIO_THREAD_DRIVER) {
       AudioCallbackDriver* driver = new AudioCallbackDriver(this);
       mDriver = driver;
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -417,17 +417,17 @@ public:
    */
   void SetStreamOrderDirty()
   {
     mStreamOrderDirty = true;
   }
 
   uint32_t AudioChannelCount() const
   {
-    return std::min<uint32_t>(8, CubebUtils::MaxNumberOfChannels());
+    return mOutputChannels;
   }
 
   double MediaTimeToSeconds(GraphTime aTime) const
   {
     NS_ASSERTION(aTime > -STREAM_TIME_MAX && aTime <= STREAM_TIME_MAX,
                  "Bad time");
     return static_cast<double>(aTime)/GraphRate();
   }
@@ -810,16 +810,21 @@ private:
     uint64_t mWindowId;
     RefPtr<ProcessedMediaStream> mCaptureStreamSink;
   };
   /**
    * Stream for window audio capture.
    */
   nsTArray<WindowAndStream> mWindowCaptureStreams;
 
+  /**
+   * Number of channels on output.
+   */
+  const uint32_t mOutputChannels;
+
 #ifdef DEBUG
   /**
    * Used to assert when AppendMessage() runs ControlMessages synchronously.
    */
   bool mCanRunMessagesSynchronously;
 #endif
 };