Bug 1265408 - Log biquad channel change warning to console; r=padenot
authorDan Minor <dminor@mozilla.com>
Fri, 03 Jun 2016 14:17:41 -0400
changeset 300934 021ffc7c02e67aaf8d8afaea80403450923f44a6
parent 300933 492d7b059416cd528596516fe727d55a9635b4aa
child 300935 d918f0e6388908251add66d89ba295d89abb2847
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1265408
milestone50.0a1
Bug 1265408 - Log biquad channel change warning to console; r=padenot MozReview-Commit-ID: G16wgfKr4I6
dom/locales/en-US/chrome/dom/dom.properties
dom/media/webaudio/BiquadFilterNode.cpp
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -225,8 +225,9 @@ RewriteYoutubeEmbed=Rewriting old-style 
 # LOCALIZATION NOTE: Do not translate 'youtube'. %S values are origins, like https://domain.com:port
 RewriteYoutubeEmbedInvalidQuery=Rewriting old-style Youtube Flash embed (%S) to iframe embed (%S). Query was invalid and removed from URL. Please update page to use iframe instead of embed/object, if possible.
 # LOCALIZATION NOTE: Do not translate "ServiceWorker". %1$S is the ServiceWorker scope URL. %2$S is an error string.
 PushMessageDecryptionFailure=The ServiceWorker for scope ‘%1$S’ encountered an error decrypting a push message: ‘%2$S’. For help with encryption, please see https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Using_the_Push_API#Encryption
 # LOCALIZATION NOTE: %1$S is the type of a DOM event. 'passive' is a literal parameter from the DOM spec.
 PreventDefaultFromPassiveListenerWarning=Ignoring ‘preventDefault()’ call on event of type ‘%1$S’ from a listener registered as ‘passive’.
 FileLastModifiedDateWarning=File.lastModifiedDate is deprecated. Use File.lastModified instead.
 IIRFilterChannelCountChangeWarning=IIRFilterNode channel count changes may produce audio glitches.
+BiquadFilterChannelCountChangeWarning=BiquadFilterNode channel count changes may produce audio glitches.
--- a/dom/media/webaudio/BiquadFilterNode.cpp
+++ b/dom/media/webaudio/BiquadFilterNode.cpp
@@ -72,26 +72,29 @@ SetParamsOnBiquad(WebCore::Biquad& aBiqu
     NS_NOTREACHED("We should never see the alternate names here");
     break;
   }
 }
 
 class BiquadFilterNodeEngine final : public AudioNodeEngine
 {
 public:
-  BiquadFilterNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
+  BiquadFilterNodeEngine(AudioNode* aNode,
+                         AudioDestinationNode* aDestination,
+                         uint64_t aWindowID)
     : AudioNodeEngine(aNode)
     , mDestination(aDestination->Stream())
     // Keep the default values in sync with the default values in
     // BiquadFilterNode::BiquadFilterNode
     , mType(BiquadFilterType::Lowpass)
     , mFrequency(350.f)
     , mDetune(0.f)
     , mQ(1.f)
     , mGain(0.f)
+    , mWindowID(aWindowID)
   {
   }
 
   enum Parameteres {
     TYPE,
     FREQUENCY,
     DETUNE,
     Q,
@@ -168,17 +171,18 @@ public:
 
     } else if(mBiquads.Length() != aInput.ChannelCount()){
       if (mBiquads.IsEmpty()) {
         RefPtr<PlayingRefChangeHandler> refchanged =
           new PlayingRefChangeHandler(aStream, PlayingRefChangeHandler::ADDREF);
         aStream->Graph()->
           DispatchToMainThreadAfterStreamStateUpdate(refchanged.forget());
       } else { // Help people diagnose bug 924718
-        NS_WARNING("BiquadFilterNode channel count changes may produce audio glitches");
+        WebAudioUtils::LogToDeveloperConsole(mWindowID,
+                                             "BiquadFilterChannelCountChangeWarning");
       }
 
       // Adjust the number of biquads based on the number of channels
       mBiquads.SetLength(aInput.ChannelCount());
     }
 
     uint32_t numberOfChannels = mBiquads.Length();
     aOutput->AllocateChannels(numberOfChannels);
@@ -232,31 +236,33 @@ public:
 private:
   AudioNodeStream* mDestination;
   BiquadFilterType mType;
   AudioParamTimeline mFrequency;
   AudioParamTimeline mDetune;
   AudioParamTimeline mQ;
   AudioParamTimeline mGain;
   nsTArray<WebCore::Biquad> mBiquads;
+  uint64_t mWindowID;
 };
 
 BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
   , mType(BiquadFilterType::Lowpass)
   , mFrequency(new AudioParam(this, BiquadFilterNodeEngine::FREQUENCY,
                               350.f, "frequency"))
   , mDetune(new AudioParam(this, BiquadFilterNodeEngine::DETUNE, 0.f, "detune"))
   , mQ(new AudioParam(this, BiquadFilterNodeEngine::Q, 1.f, "Q"))
   , mGain(new AudioParam(this, BiquadFilterNodeEngine::GAIN, 0.f, "gain"))
 {
-  BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination());
+  uint64_t windowID = aContext->GetParentObject()->WindowID();
+  BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination(), windowID);
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
 }
 
 BiquadFilterNode::~BiquadFilterNode()
 {
 }