Bug 1265408 - Log biquad channel change warning to console; r=padenot

MozReview-Commit-ID: G16wgfKr4I6

--HG--
extra : rebase_source : d4c205b6d30c9d583e2f9f76cdb06b6b32f1500f
extra : source : 5aa770304f2a519fda0989790b2d059d85a1db58
This commit is contained in:
Dan Minor 2016-06-03 14:17:41 -04:00
Родитель c2d0856c53
Коммит 072334bcdb
2 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -230,3 +230,4 @@ PushMessageDecryptionFailure=The ServiceWorker for scope %1$S encountered
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.

Просмотреть файл

@ -77,7 +77,9 @@ SetParamsOnBiquad(WebCore::Biquad& aBiquad,
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
@ -87,6 +89,7 @@ public:
, mDetune(0.f)
, mQ(1.f)
, mGain(0.f)
, mWindowID(aWindowID)
{
}
@ -173,7 +176,8 @@ public:
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
@ -237,6 +241,7 @@ private:
AudioParamTimeline mQ;
AudioParamTimeline mGain;
nsTArray<WebCore::Biquad> mBiquads;
uint64_t mWindowID;
};
BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
@ -251,7 +256,8 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
, 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);
}