Diff
Modified: trunk/Source/WebCore/ChangeLog (242733 => 242734)
--- trunk/Source/WebCore/ChangeLog 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/ChangeLog 2019-03-11 20:19:49 UTC (rev 242734)
@@ -1,3 +1,114 @@
+2019-03-11 Eric Carlson <[email protected]>
+
+ Add web audio release logging
+ https://bugs.webkit.org/show_bug.cgi?id=195554
+ <rdar://problem/48767211>
+
+ Reviewed by Jer Noble.
+
+ No new tests, no functional change.
+
+ * Modules/webaudio/AudioBasicInspectorNode.cpp:
+ (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
+ * Modules/webaudio/AudioBufferSourceNode.cpp:
+ (WebCore::AudioBufferSourceNode::setBuffer):
+ (WebCore::AudioBufferSourceNode::startPlaying):
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::nextLogIdentifier):
+ (WebCore::AudioContext::AudioContext):
+ (WebCore::AudioContext::uninitialize):
+ (WebCore::AudioContext::stop):
+ (WebCore::AudioContext::createBufferSource):
+ (WebCore::AudioContext::createMediaElementSource):
+ (WebCore::AudioContext::createMediaStreamSource):
+ (WebCore::AudioContext::createScriptProcessor):
+ (WebCore::AudioContext::createBiquadFilter):
+ (WebCore::AudioContext::createWaveShaper):
+ (WebCore::AudioContext::createPanner):
+ (WebCore::AudioContext::createConvolver):
+ (WebCore::AudioContext::createDynamicsCompressor):
+ (WebCore::AudioContext::createAnalyser):
+ (WebCore::AudioContext::createGain):
+ (WebCore::AudioContext::createDelay):
+ (WebCore::AudioContext::createChannelSplitter):
+ (WebCore::AudioContext::createChannelMerger):
+ (WebCore::AudioContext::createOscillator):
+ (WebCore::AudioContext::createPeriodicWave):
+ (WebCore::AudioContext::willBeginPlayback):
+ (WebCore::AudioContext::startRendering):
+ (WebCore::AudioContext::fireCompletionEvent):
+ (WebCore::AudioContext::logChannel const):
+ * Modules/webaudio/AudioContext.h:
+ (WebCore::AudioContext::nextAudioNodeLogIdentifier):
+ (WebCore::AudioContext::nextAudioParameterLogIdentifier):
+ * Modules/webaudio/AudioDestinationNode.cpp:
+ (WebCore::AudioDestinationNode::AudioDestinationNode):
+ * Modules/webaudio/AudioNode.cpp:
+ (WebCore::convertEnumerationToString):
+ (WebCore::AudioNode::AudioNode):
+ (WebCore::AudioNode::~AudioNode):
+ (WebCore::AudioNode::setNodeType):
+ (WebCore::AudioNode::addInput):
+ (WebCore::AudioNode::addOutput):
+ (WebCore::AudioNode::connect):
+ (WebCore::AudioNode::disconnect):
+ (WebCore::AudioNode::setChannelCount):
+ (WebCore::AudioNode::setChannelCountMode):
+ (WebCore::AudioNode::setChannelInterpretation):
+ (WebCore::AudioNode::logChannel const):
+ * Modules/webaudio/AudioNode.h:
+ (WTF::LogArgument<WebCore::AudioNode::NodeType>::toString):
+ * Modules/webaudio/AudioParam.cpp:
+ (WebCore::AudioParam::AudioParam):
+ (WebCore::AudioParam::setValue):
+ (WebCore::AudioParam::connect):
+ (WebCore::AudioParam::disconnect):
+ (WebCore::AudioParam::logChannel const):
+ * Modules/webaudio/AudioParam.h:
+ * Modules/webaudio/AudioScheduledSourceNode.cpp:
+ (WebCore::AudioScheduledSourceNode::start):
+ (WebCore::AudioScheduledSourceNode::stop):
+ * Modules/webaudio/BiquadFilterNode.cpp:
+ (WebCore::BiquadFilterNode::BiquadFilterNode):
+ * Modules/webaudio/ChannelMergerNode.cpp:
+ (WebCore::ChannelMergerNode::ChannelMergerNode):
+ * Modules/webaudio/ChannelSplitterNode.cpp:
+ (WebCore::ChannelSplitterNode::ChannelSplitterNode):
+ * Modules/webaudio/ConvolverNode.cpp:
+ (WebCore::ConvolverNode::ConvolverNode):
+ * Modules/webaudio/DefaultAudioDestinationNode.cpp:
+ (WebCore::DefaultAudioDestinationNode::initialize):
+ (WebCore::DefaultAudioDestinationNode::uninitialize):
+ (WebCore::DefaultAudioDestinationNode::enableInput):
+ (WebCore::DefaultAudioDestinationNode::setChannelCount):
+ * Modules/webaudio/DelayNode.cpp:
+ (WebCore::DelayNode::DelayNode):
+ * Modules/webaudio/DynamicsCompressorNode.cpp:
+ (WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
+ * Modules/webaudio/GainNode.cpp:
+ (WebCore::GainNode::GainNode):
+ * Modules/webaudio/MediaElementAudioSourceNode.cpp:
+ (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
+ * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
+ (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
+ * Modules/webaudio/OfflineAudioDestinationNode.cpp:
+ (WebCore::OfflineAudioDestinationNode::startRendering):
+ * Modules/webaudio/OscillatorNode.cpp:
+ (WebCore::OscillatorNode::setType):
+ (WebCore::OscillatorNode::setPeriodicWave):
+ * Modules/webaudio/OscillatorNode.h:
+ (WTF::LogArgument<WebCore::OscillatorNode::Type>::toString):
+ * Modules/webaudio/PannerNode.cpp:
+ (WebCore::PannerNode::PannerNode):
+ * Modules/webaudio/ScriptProcessorNode.cpp:
+ (WebCore::ScriptProcessorNode::ScriptProcessorNode):
+ * Modules/webaudio/WaveShaperNode.cpp:
+ (WebCore::WaveShaperNode::WaveShaperNode):
+ (WebCore::WaveShaperNode::setCurve):
+ (WebCore::WaveShaperNode::setOversample):
+ * Modules/webaudio/WaveShaperNode.h:
+ (WTF::LogArgument<WebCore::WaveShaperNode::OverSampleType>::toString):
+
2019-03-11 Youenn Fablet <[email protected]>
Make IDBDatabaseIdentifier take a ClientOrigin as member
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -36,6 +36,7 @@
AudioBasicInspectorNode::AudioBasicInspectorNode(AudioContext& context, float sampleRate, unsigned outputChannelCount)
: AudioNode(context, sampleRate)
{
+ setNodeType(NodeTypeBasicInspector);
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, outputChannelCount));
}
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -407,7 +407,8 @@
void AudioBufferSourceNode::setBuffer(RefPtr<AudioBuffer>&& buffer)
{
ASSERT(isMainThread());
-
+ DEBUG_LOG(LOGIDENTIFIER);
+
// The context must be locked since changing the buffer can re-configure the number of channels that are output.
AudioContext::AutoLocker contextLocker(context());
@@ -451,6 +452,7 @@
ExceptionOr<void> AudioBufferSourceNode::startPlaying(BufferPlaybackMode playbackMode, double when, double grainOffset, double grainDuration)
{
ASSERT(isMainThread());
+ ALWAYS_LOG(LOGIDENTIFIER, "when = ", when, ", offset = ", grainOffset, ", duration = ", grainDuration);
context().nodeWillBeginPlayback();
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -106,6 +106,14 @@
#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(document()->page() && document()->page()->isAlwaysOnLoggingAllowed(), Media, "%p - AudioContext::" fmt, this, ##__VA_ARGS__)
+#if !RELEASE_LOG_DISABLED
+static const void* nextLogIdentifier()
+{
+ static uint64_t logIdentifier = cryptographicallyRandomNumber();
+ return reinterpret_cast<const void*>(++logIdentifier);
+}
+#endif
+
bool AudioContext::isSampleRateRangeGood(float sampleRate)
{
// FIXME: It would be nice if the minimum sample-rate could be less than 44.1KHz,
@@ -131,6 +139,10 @@
// Constructor for rendering to the audio hardware.
AudioContext::AudioContext(Document& document)
: ActiveDOMObject(document)
+#if !RELEASE_LOG_DISABLED
+ , m_logger(document.logger())
+ , m_logIdentifier(nextLogIdentifier())
+#endif
, m_mediaSession(PlatformMediaSession::create(*this))
, m_eventQueue(std::make_unique<GenericEventQueue>(*this))
{
@@ -145,6 +157,10 @@
// Constructor for offline (non-realtime) rendering.
AudioContext::AudioContext(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
: ActiveDOMObject(document)
+#if !RELEASE_LOG_DISABLED
+ , m_logger(document.logger())
+ , m_logIdentifier(nextLogIdentifier())
+#endif
, m_isOfflineContext(true)
, m_mediaSession(PlatformMediaSession::create(*this))
, m_eventQueue(std::make_unique<GenericEventQueue>(*this))
@@ -240,6 +256,8 @@
void AudioContext::uninitialize()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
if (!m_isInitialized)
@@ -303,6 +321,8 @@
void AudioContext::stop()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
// Usually ScriptExecutionContext calls stop twice.
@@ -413,6 +433,8 @@
Ref<AudioBufferSourceNode> AudioContext::createBufferSource()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
Ref<AudioBufferSourceNode> node = AudioBufferSourceNode::create(*this, m_destinationNode->sampleRate());
@@ -428,6 +450,8 @@
ExceptionOr<Ref<MediaElementAudioSourceNode>> AudioContext::createMediaElementSource(HTMLMediaElement& mediaElement)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
@@ -448,6 +472,8 @@
ExceptionOr<Ref<MediaStreamAudioSourceNode>> AudioContext::createMediaStreamSource(MediaStream& mediaStream)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
auto audioTracks = mediaStream.getAudioTracks();
@@ -484,6 +510,8 @@
ExceptionOr<Ref<ScriptProcessorNode>> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
@@ -542,6 +570,8 @@
Ref<BiquadFilterNode> AudioContext::createBiquadFilter()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return BiquadFilterNode::create(*this, m_destinationNode->sampleRate());
@@ -549,6 +579,8 @@
Ref<WaveShaperNode> AudioContext::createWaveShaper()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return WaveShaperNode::create(*this);
@@ -556,6 +588,8 @@
Ref<PannerNode> AudioContext::createPanner()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return PannerNode::create(*this, m_destinationNode->sampleRate());
@@ -563,6 +597,8 @@
Ref<ConvolverNode> AudioContext::createConvolver()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return ConvolverNode::create(*this, m_destinationNode->sampleRate());
@@ -570,6 +606,8 @@
Ref<DynamicsCompressorNode> AudioContext::createDynamicsCompressor()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return DynamicsCompressorNode::create(*this, m_destinationNode->sampleRate());
@@ -577,6 +615,8 @@
Ref<AnalyserNode> AudioContext::createAnalyser()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return AnalyserNode::create(*this, m_destinationNode->sampleRate());
@@ -584,6 +624,8 @@
Ref<GainNode> AudioContext::createGain()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return GainNode::create(*this, m_destinationNode->sampleRate());
@@ -591,6 +633,8 @@
ExceptionOr<Ref<DelayNode>> AudioContext::createDelay(double maxDelayTime)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
return DelayNode::create(*this, m_destinationNode->sampleRate(), maxDelayTime);
@@ -598,6 +642,8 @@
ExceptionOr<Ref<ChannelSplitterNode>> AudioContext::createChannelSplitter(size_t numberOfOutputs)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
auto node = ChannelSplitterNode::create(*this, m_destinationNode->sampleRate(), numberOfOutputs);
@@ -608,6 +654,8 @@
ExceptionOr<Ref<ChannelMergerNode>> AudioContext::createChannelMerger(size_t numberOfInputs)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
auto node = ChannelMergerNode::create(*this, m_destinationNode->sampleRate(), numberOfInputs);
@@ -618,6 +666,8 @@
Ref<OscillatorNode> AudioContext::createOscillator()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
lazyInitialize();
@@ -632,6 +682,8 @@
ExceptionOr<Ref<PeriodicWave>> AudioContext::createPeriodicWave(Float32Array& real, Float32Array& imaginary)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
if (real.length() != imaginary.length() || (real.length() > MaxPeriodicWaveLength) || !real.length())
return Exception { IndexSizeError };
@@ -981,8 +1033,10 @@
bool AudioContext::willBeginPlayback()
{
if (userGestureRequiredForAudioStart()) {
- if (!processingUserGestureForMedia() && !document()->isCapturing())
+ if (!processingUserGestureForMedia() && !document()->isCapturing()) {
+ ALWAYS_LOG(LOGIDENTIFIER, "returning false, not processing user gesture or capturing");
return false;
+ }
removeBehaviorRestriction(AudioContext::RequireUserGestureForAudioStartRestriction);
}
@@ -990,12 +1044,16 @@
Page* page = document()->page();
if (page && !page->canStartMedia()) {
document()->addMediaCanStartListener(*this);
+ ALWAYS_LOG(LOGIDENTIFIER, "returning false, page doesn't allow media to start");
return false;
}
removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction);
}
-
- return m_mediaSession->clientWillBeginPlayback();
+
+ auto willBegin = m_mediaSession->clientWillBeginPlayback();
+ ALWAYS_LOG(LOGIDENTIFIER, "returning ", willBegin);
+
+ return willBegin;
}
bool AudioContext::willPausePlayback()
@@ -1020,6 +1078,7 @@
void AudioContext::startRendering()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
if (!willBeginPlayback())
return;
@@ -1063,7 +1122,9 @@
ASSERT(isMainThread());
if (!isMainThread())
return;
-
+
+ ALWAYS_LOG(LOGIDENTIFIER);
+
AudioBuffer* renderedBuffer = m_renderTarget.get();
setState(State::Closed);
@@ -1208,6 +1269,12 @@
});
}
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& AudioContext::logChannel() const
+{
+ return LogMedia;
+}
+#endif
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.h (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.h 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.h 2019-03-11 20:19:49 UTC (rev 242734)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,6 +38,7 @@
#include <_javascript_Core/Float32Array.h>
#include <atomic>
#include <wtf/HashSet.h>
+#include <wtf/LoggerHelper.h>
#include <wtf/MainThread.h>
#include <wtf/RefPtr.h>
#include <wtf/ThreadSafeRefCounted.h>
@@ -76,7 +77,18 @@
// AudioContext is the cornerstone of the web audio API and all AudioNodes are created from it.
// For thread safety between the audio thread and the main thread, it has a rendering graph locking mechanism.
-class AudioContext : public ActiveDOMObject, public ThreadSafeRefCounted<AudioContext>, public EventTargetWithInlineData, public MediaCanStartListener, public MediaProducer, private PlatformMediaSessionClient, private VisibilityChangeClient {
+class AudioContext
+ : public ActiveDOMObject
+ , public ThreadSafeRefCounted<AudioContext>
+ , public EventTargetWithInlineData
+ , public MediaCanStartListener
+ , public MediaProducer
+ , private PlatformMediaSessionClient
+ , private VisibilityChangeClient
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
public:
// Create an AudioContext for rendering to the audio hardware.
static RefPtr<AudioContext> create(Document&);
@@ -263,6 +275,14 @@
void nodeWillBeginPlayback();
+#if !RELEASE_LOG_DISABLED
+ const Logger& logger() const final { return m_logger.get(); }
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ WTFLogChannel& logChannel() const final;
+ const void* nextAudioNodeLogIdentifier() { return childLogIdentifier(++m_nextAudioNodeIdentifier); }
+ const void* nextAudioParameterLogIdentifier() { return childLogIdentifier(++m_nextAudioParameterIdentifier); }
+#endif
+
protected:
explicit AudioContext(Document&);
AudioContext(Document&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
@@ -336,6 +356,15 @@
void addReaction(State, DOMPromiseDeferred<void>&&);
void updateAutomaticPullNodes();
+#if !RELEASE_LOG_DISABLED
+ const char* logClassName() const final { return "AudioContext"; }
+
+ Ref<Logger> m_logger;
+ const void* m_logIdentifier;
+ uint64_t m_nextAudioNodeIdentifier { 0 };
+ uint64_t m_nextAudioParameterIdentifier { 0 };
+#endif
+
// Only accessed in the audio thread.
Vector<AudioNode*> m_finishedNodes;
Modified: trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -43,9 +43,8 @@
, m_isEffectivelyPlayingAudio(false)
, m_muted(false)
{
+ setNodeType(NodeTypeDestination);
addInput(std::make_unique<AudioNodeInput>(this));
-
- setNodeType(NodeTypeDestination);
}
AudioDestinationNode::~AudioDestinationNode()
Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -32,6 +32,7 @@
#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
#include "AudioParam.h"
+#include "Logging.h"
#include <wtf/Atomics.h>
#include <wtf/MainThread.h>
@@ -41,6 +42,56 @@
namespace WebCore {
+String convertEnumerationToString(AudioNode::NodeType enumerationValue)
+{
+ static const NeverDestroyed<String> values[] = {
+ MAKE_STATIC_STRING_IMPL("NodeTypeUnknown"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeDestination"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeOscillator"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeAudioBufferSource"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeMediaElementAudioSource"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeMediaStreamAudioDestination"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeMediaStreamAudioSource"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeJavaScript"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeBiquadFilter"),
+ MAKE_STATIC_STRING_IMPL("NodeTypePanner"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeConvolver"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeDelay"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeGain"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeChannelSplitter"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeChannelMerger"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeAnalyser"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeDynamicsCompressor"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeWaveShaper"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeBasicInspector"),
+ MAKE_STATIC_STRING_IMPL("NodeTypeEnd"),
+ };
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeUnknown) == 0, "AudioNode::NodeTypeUnknown is not 0 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeDestination) == 1, "AudioNode::NodeTypeDestination is not 1 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeOscillator) == 2, "AudioNode::NodeTypeOscillator is not 2 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeAudioBufferSource) == 3, "AudioNode::NodeTypeAudioBufferSource is not 3 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeMediaElementAudioSource) == 4, "AudioNode::NodeTypeMediaElementAudioSource is not 4 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeMediaStreamAudioDestination) == 5, "AudioNode::NodeTypeMediaStreamAudioDestination is not 5 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeMediaStreamAudioSource) == 6, "AudioNode::NodeTypeMediaStreamAudioSource is not 6 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeJavaScript) == 7, "AudioNode::NodeTypeJavaScript is not 7 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeBiquadFilter) == 8, "AudioNode::NodeTypeBiquadFilter is not 8 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypePanner) == 9, "AudioNode::NodeTypePanner is not 9 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeConvolver) == 10, "AudioNode::NodeTypeConvolver is not 10 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeDelay) == 11, "AudioNode::NodeTypeDelay is not 11 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeGain) == 12, "AudioNode::NodeTypeGain is not 12 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeChannelSplitter) == 13, "AudioNode::NodeTypeChannelSplitter is not 13 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeChannelMerger) == 14, "AudioNode::NodeTypeChannelMerger is not 14 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeAnalyser) == 15, "AudioNode::NodeTypeAnalyser is not 15 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeDynamicsCompressor) == 16, "AudioNode::NodeTypeDynamicsCompressor is not 16 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeWaveShaper) == 17, "AudioNode::NodeTypeWaveShaper is not 17 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeBasicInspector) == 18, "AudioNode::NodeTypeBasicInspector is not 18 as expected");
+ static_assert(static_cast<size_t>(AudioNode::NodeTypeEnd) == 19, "AudioNode::NodeTypeEnd is not 19 as expected");
+
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+
+ return values[static_cast<size_t>(enumerationValue)];
+}
+
AudioNode::AudioNode(AudioContext& context, float sampleRate)
: m_isInitialized(false)
, m_nodeType(NodeTypeUnknown)
@@ -52,10 +103,16 @@
, m_connectionRefCount(0)
, m_isMarkedForDeletion(false)
, m_isDisabled(false)
+#if !RELEASE_LOG_DISABLED
+ , m_logger(context.logger())
+ , m_logIdentifier(context.nextAudioNodeLogIdentifier())
+#endif
, m_channelCount(2)
, m_channelCountMode(Max)
, m_channelInterpretation(AudioBus::Speakers)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
#if DEBUG_AUDIONODE_REFERENCES
if (!s_isNodeCountInitialized) {
s_isNodeCountInitialized = true;
@@ -66,6 +123,8 @@
AudioNode::~AudioNode()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
#if DEBUG_AUDIONODE_REFERENCES
--s_nodeCount[nodeType()];
@@ -85,6 +144,9 @@
void AudioNode::setNodeType(NodeType type)
{
+ ASSERT(isMainThread());
+ ALWAYS_LOG(LOGIDENTIFIER, type);
+
m_nodeType = type;
#if DEBUG_AUDIONODE_REFERENCES
@@ -100,11 +162,15 @@
void AudioNode::addInput(std::unique_ptr<AudioNodeInput> input)
{
+ ASSERT(isMainThread());
+ DEBUG_LOG(LOGIDENTIFIER, input->node()->nodeType());
m_inputs.append(WTFMove(input));
}
void AudioNode::addOutput(std::unique_ptr<AudioNodeOutput> output)
{
+ ASSERT(isMainThread());
+ DEBUG_LOG(LOGIDENTIFIER, output->node()->nodeType());
m_outputs.append(WTFMove(output));
}
@@ -124,9 +190,11 @@
ExceptionOr<void> AudioNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
{
- ASSERT(isMainThread());
+ ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
+ ALWAYS_LOG(LOGIDENTIFIER, destination.nodeType(), ", output = ", outputIndex, ", input = ", inputIndex);
+
// Sanity check input and output indices.
if (outputIndex >= numberOfOutputs())
return Exception { IndexSizeError };
@@ -149,9 +217,12 @@
ExceptionOr<void> AudioNode::connect(AudioParam& param, unsigned outputIndex)
{
- ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
+ ASSERT(isMainThread());
+
+ DEBUG_LOG(LOGIDENTIFIER, param.name(), ", output = ", outputIndex);
+
if (outputIndex >= numberOfOutputs())
return Exception { IndexSizeError };
@@ -174,6 +245,8 @@
return Exception { IndexSizeError };
auto* output = this->output(outputIndex);
+ DEBUG_LOG(LOGIDENTIFIER, output->node()->nodeType());
+
output->disconnectAll();
return { };
@@ -189,6 +262,8 @@
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
+ ALWAYS_LOG(LOGIDENTIFIER, channelCount);
+
if (!(channelCount > 0 && channelCount <= AudioContext::maxNumberOfChannels()))
return Exception { InvalidStateError };
@@ -220,6 +295,8 @@
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
+ ALWAYS_LOG(LOGIDENTIFIER, mode);
+
ChannelCountMode oldMode = m_channelCountMode;
if (mode == "max")
@@ -254,6 +331,8 @@
ASSERT(isMainThread());
AudioContext::AutoLocker locker(context());
+ ALWAYS_LOG(LOGIDENTIFIER, interpretation);
+
if (interpretation == "speakers")
m_channelInterpretation = AudioBus::Speakers;
else if (interpretation == "discrete")
@@ -505,6 +584,13 @@
#endif // DEBUG_AUDIONODE_REFERENCES
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& AudioNode::logChannel() const
+{
+ return LogMedia;
+}
+#endif
+
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.h (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioNode.h 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.h 2019-03-11 20:19:49 UTC (rev 242734)
@@ -28,6 +28,7 @@
#include "EventTarget.h"
#include "ExceptionOr.h"
#include <wtf/Forward.h>
+#include <wtf/LoggerHelper.h>
#define DEBUG_AUDIONODE_REFERENCES 0
@@ -44,7 +45,12 @@
// An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware.
// Most processing nodes such as filters will have one input and one output, although multiple inputs and outputs are possible.
-class AudioNode : public EventTargetWithInlineData {
+class AudioNode
+ : public EventTargetWithInlineData
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
WTF_MAKE_NONCOPYABLE(AudioNode);
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -75,6 +81,7 @@
NodeTypeAnalyser,
NodeTypeDynamicsCompressor,
NodeTypeWaveShaper,
+ NodeTypeBasicInspector,
NodeTypeEnd
};
@@ -191,6 +198,13 @@
// Force all inputs to take any channel interpretation changes into account.
void updateChannelsForInputs();
+#if !RELEASE_LOG_DISABLED
+ const Logger& logger() const final { return m_logger.get(); }
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ const char* logClassName() const final { return "AudioNode"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
private:
volatile bool m_isInitialized;
NodeType m_nodeType;
@@ -217,6 +231,11 @@
void refEventTarget() override { ref(); }
void derefEventTarget() override { deref(); }
+#if !RELEASE_LOG_DISABLED
+ mutable Ref<const Logger> m_logger;
+ const void* m_logIdentifier;
+#endif
+
protected:
unsigned m_channelCount;
ChannelCountMode m_channelCountMode;
@@ -223,4 +242,14 @@
AudioBus::ChannelInterpretation m_channelInterpretation;
};
+String convertEnumerationToString(AudioNode::NodeType);
+
} // namespace WebCore
+
+namespace WTF {
+
+template<> struct LogArgument<WebCore::AudioNode::NodeType> {
+ static String toString(WebCore::AudioNode::NodeType type) { return convertEnumerationToString(type); }
+};
+
+} // namespace WTF
Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -33,6 +33,7 @@
#include "AudioNodeOutput.h"
#include "AudioUtilities.h"
#include "FloatConversion.h"
+#include "Logging.h"
#include <wtf/MathExtras.h>
namespace WebCore {
@@ -40,6 +41,24 @@
const double AudioParam::DefaultSmoothingConstant = 0.05;
const double AudioParam::SnapThreshold = 0.001;
+AudioParam::AudioParam(AudioContext& context, const String& name, double defaultValue, double minValue, double maxValue, unsigned units)
+ : AudioSummingJunction(context)
+ , m_name(name)
+ , m_value(defaultValue)
+ , m_defaultValue(defaultValue)
+ , m_minValue(minValue)
+ , m_maxValue(maxValue)
+ , m_units(units)
+ , m_smoothedValue(defaultValue)
+ , m_smoothingConstant(DefaultSmoothingConstant)
+#if !RELEASE_LOG_DISABLED
+ , m_logger(context.logger())
+ , m_logIdentifier(context.nextAudioParameterLogIdentifier())
+#endif
+{
+ ALWAYS_LOG(LOGIDENTIFIER, "name = ", m_name, ", value = ", m_value, ", default = ", m_defaultValue, ", min = ", m_minValue, ", max = ", m_maxValue, ", units = ", m_units);
+}
+
float AudioParam::value()
{
// Update value for timeline.
@@ -56,6 +75,8 @@
void AudioParam::setValue(float value)
{
+ DEBUG_LOG(LOGIDENTIFIER, value);
+
// Check against _javascript_ giving us bogus floating-point values.
// Don't ASSERT, since this can happen if somebody writes bad JS.
if (!std::isnan(value) && !std::isinf(value))
@@ -173,6 +194,8 @@
if (!m_outputs.add(output).isNewEntry)
return;
+ DEBUG_LOG(LOGIDENTIFIER, output->node()->nodeType());
+
output->addParam(this);
changedOutputs();
}
@@ -185,6 +208,8 @@
if (!output)
return;
+ DEBUG_LOG(LOGIDENTIFIER, output->node()->nodeType());
+
if (m_outputs.remove(output)) {
changedOutputs();
output->removeParam(this);
@@ -191,6 +216,14 @@
}
}
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& AudioParam::logChannel() const
+{
+ return LogMedia;
+}
+#endif
+
+
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.h (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioParam.h 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.h 2019-03-11 20:19:49 UTC (rev 242734)
@@ -33,6 +33,7 @@
#include "AudioSummingJunction.h"
#include <_javascript_Core/Float32Array.h>
#include <sys/types.h>
+#include <wtf/LoggerHelper.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -40,7 +41,13 @@
class AudioNodeOutput;
-class AudioParam final : public AudioSummingJunction, public RefCounted<AudioParam> {
+class AudioParam final
+ : public AudioSummingJunction
+ , public RefCounted<AudioParam>
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
public:
static const double DefaultSmoothingConstant;
static const double SnapThreshold;
@@ -101,18 +108,7 @@
void disconnect(AudioNodeOutput*);
protected:
- AudioParam(AudioContext& context, const String& name, double defaultValue, double minValue, double maxValue, unsigned units = 0)
- : AudioSummingJunction(context)
- , m_name(name)
- , m_value(defaultValue)
- , m_defaultValue(defaultValue)
- , m_minValue(minValue)
- , m_maxValue(maxValue)
- , m_units(units)
- , m_smoothedValue(defaultValue)
- , m_smoothingConstant(DefaultSmoothingConstant)
- {
- }
+ AudioParam(AudioContext&, const String&, double defaultValue, double minValue, double maxValue, unsigned units = 0);
private:
// sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web Audio specification.
@@ -119,6 +115,13 @@
void calculateFinalValues(float* values, unsigned numberOfValues, bool sampleAccurate);
void calculateTimelineValues(float* values, unsigned numberOfValues);
+#if !RELEASE_LOG_DISABLED
+ const Logger& logger() const final { return m_logger.get(); }
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ const char* logClassName() const final { return "AudioParam"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
String m_name;
double m_value;
double m_defaultValue;
@@ -131,6 +134,11 @@
double m_smoothingConstant;
AudioParamTimeline m_timeline;
+
+#if !RELEASE_LOG_DISABLED
+ mutable Ref<const Logger> m_logger;
+ const void* m_logIdentifier;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -132,6 +132,7 @@
ExceptionOr<void> AudioScheduledSourceNode::start(double when)
{
ASSERT(isMainThread());
+ ALWAYS_LOG(LOGIDENTIFIER, when);
context().nodeWillBeginPlayback();
@@ -149,6 +150,7 @@
ExceptionOr<void> AudioScheduledSourceNode::stop(double when)
{
ASSERT(isMainThread());
+ ALWAYS_LOG(LOGIDENTIFIER, when);
if (m_playbackState == UNSCHEDULED_STATE || m_endTime != UnknownTime)
return Exception { InvalidStateError };
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -33,9 +33,10 @@
BiquadFilterNode::BiquadFilterNode(AudioContext& context, float sampleRate)
: AudioBasicProcessorNode(context, sampleRate)
{
+ setNodeType(NodeTypeBiquadFilter);
+
// Initially setup as lowpass filter.
m_processor = std::make_unique<BiquadProcessor>(context, sampleRate, 1, false);
- setNodeType(NodeTypeBiquadFilter);
}
BiquadFilterType BiquadFilterNode::type() const
Modified: trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -52,6 +52,8 @@
: AudioNode(context, sampleRate)
, m_desiredNumberOfOutputChannels(DefaultNumberOfOutputChannels)
{
+ setNodeType(NodeTypeChannelMerger);
+
// Create the requested number of inputs.
for (unsigned i = 0; i < numberOfInputs; ++i)
addInput(std::make_unique<AudioNodeInput>(this));
@@ -58,8 +60,6 @@
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
- setNodeType(NodeTypeChannelMerger);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -45,6 +45,8 @@
ChannelSplitterNode::ChannelSplitterNode(AudioContext& context, float sampleRate, unsigned numberOfOutputs)
: AudioNode(context, sampleRate)
{
+ setNodeType(NodeTypeChannelSplitter);
+
addInput(std::make_unique<AudioNodeInput>(this));
// Create a fixed number of outputs (able to handle the maximum number of channels fed to an input).
@@ -51,8 +53,6 @@
for (unsigned i = 0; i < numberOfOutputs; ++i)
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
- setNodeType(NodeTypeChannelSplitter);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -47,6 +47,8 @@
ConvolverNode::ConvolverNode(AudioContext& context, float sampleRate)
: AudioNode(context, sampleRate)
{
+ setNodeType(NodeTypeConvolver);
+
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, 2));
@@ -54,8 +56,6 @@
m_channelCount = 2;
m_channelCountMode = ClampedMax;
m_channelInterpretation = AudioBus::Speakers;
-
- setNodeType(NodeTypeConvolver);
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -57,6 +57,7 @@
ASSERT(isMainThread());
if (isInitialized())
return;
+ ALWAYS_LOG(LOGIDENTIFIER);
createDestination();
AudioNode::initialize();
@@ -68,6 +69,7 @@
if (!isInitialized())
return;
+ ALWAYS_LOG(LOGIDENTIFIER);
m_destination->stop();
m_destination = nullptr;
m_numberOfInputChannels = 0;
@@ -85,6 +87,8 @@
void DefaultAudioDestinationNode::enableInput(const String& inputDeviceId)
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
if (m_numberOfInputChannels != EnabledInputChannels) {
m_numberOfInputChannels = EnabledInputChannels;
@@ -144,6 +148,7 @@
// channels supported by the hardware.
ASSERT(isMainThread());
+ ALWAYS_LOG(LOGIDENTIFIER, channelCount);
if (!maxChannelCount() || channelCount > maxChannelCount())
return Exception { InvalidStateError };
Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -37,8 +37,8 @@
inline DelayNode::DelayNode(AudioContext& context, float sampleRate, double maxDelayTime)
: AudioBasicProcessorNode(context, sampleRate)
{
+ setNodeType(NodeTypeDelay);
m_processor = std::make_unique<DelayProcessor>(context, sampleRate, 1, maxDelayTime);
- setNodeType(NodeTypeDelay);
}
ExceptionOr<Ref<DelayNode>> DelayNode::create(AudioContext& context, float sampleRate, double maxDelayTime)
Modified: trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -41,11 +41,11 @@
DynamicsCompressorNode::DynamicsCompressorNode(AudioContext& context, float sampleRate)
: AudioNode(context, sampleRate)
{
+ setNodeType(NodeTypeDynamicsCompressor);
+
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, defaultNumberOfOutputChannels));
- setNodeType(NodeTypeDynamicsCompressor);
-
m_threshold = AudioParam::create(context, "threshold", -24, -100, 0);
m_knee = AudioParam::create(context, "knee", 30, 0, 40);
m_ratio = AudioParam::create(context, "ratio", 12, 1, 20);
Modified: trunk/Source/WebCore/Modules/webaudio/GainNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/GainNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/GainNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -39,13 +39,13 @@
, m_lastGain(1.0)
, m_sampleAccurateGainValues(AudioNode::ProcessingSizeInFrames) // FIXME: can probably share temp buffer in context
{
+ setNodeType(NodeTypeGain);
+
m_gain = AudioParam::create(context, "gain", 1.0, 0.0, 1.0);
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, 1));
- setNodeType(NodeTypeGain);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -51,11 +51,11 @@
, m_sourceNumberOfChannels(0)
, m_sourceSampleRate(0)
{
+ setNodeType(NodeTypeMediaElementAudioSource);
+
// Default to stereo. This could change depending on what the media element .src is set to.
addOutput(std::make_unique<AudioNodeOutput>(this, 2));
- setNodeType(NodeTypeMediaElementAudioSource);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -45,6 +45,8 @@
, m_mediaStream(mediaStream)
, m_audioTrack(audioTrack)
{
+ setNodeType(NodeTypeMediaStreamAudioSource);
+
AudioSourceProvider* audioSourceProvider = m_audioTrack->audioSourceProvider();
ASSERT(audioSourceProvider);
@@ -53,8 +55,6 @@
// Default to stereo. This could change depending on the format of the MediaStream's audio track.
addOutput(std::make_unique<AudioNodeOutput>(this, 2));
- setNodeType(NodeTypeMediaStreamAudioSource);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -74,6 +74,8 @@
void OfflineAudioDestinationNode::startRendering()
{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
ASSERT(isMainThread());
ASSERT(m_renderTarget.get());
if (!m_renderTarget.get())
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -79,6 +79,8 @@
{
PeriodicWave* periodicWave = nullptr;
+ ALWAYS_LOG(LOGIDENTIFIER, type);
+
switch (type) {
case Type::Sine:
if (!s_periodicWaveSine)
@@ -297,8 +299,9 @@
void OscillatorNode::setPeriodicWave(PeriodicWave* periodicWave)
{
+ ALWAYS_LOG(LOGIDENTIFIER, "sample rate = ", periodicWave ? periodicWave->sampleRate() : 0, ", wave size = ", periodicWave ? periodicWave->periodicWaveSize() : 0, ", rate scale = ", periodicWave ? periodicWave->rateScale() : 0);
ASSERT(isMainThread());
-
+
// This synchronizes with process().
std::lock_guard<Lock> lock(m_processMutex);
m_periodicWave = periodicWave;
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h 2019-03-11 20:19:49 UTC (rev 242734)
@@ -101,4 +101,14 @@
static PeriodicWave* s_periodicWaveTriangle;
};
+String convertEnumerationToString(OscillatorNode::Type); // In JSOscillatorNode.cpp
+
} // namespace WebCore
+
+namespace WTF {
+
+template<> struct LogArgument<WebCore::OscillatorNode::Type> {
+ static String toString(WebCore::OscillatorNode::Type type) { return convertEnumerationToString(type); }
+};
+
+} // namespace WTF
Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -50,6 +50,8 @@
, m_lastGain(-1.0)
, m_connectionCount(0)
{
+ setNodeType(NodeTypePanner);
+
// Load the HRTF database asynchronously so we don't block the _javascript_ thread while creating the HRTF database.
m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(context.sampleRate());
@@ -68,8 +70,6 @@
m_orientation = FloatPoint3D(1, 0, 0);
m_velocity = FloatPoint3D(0, 0, 0);
- setNodeType(NodeTypePanner);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -64,11 +64,10 @@
ASSERT(numberOfInputChannels <= AudioContext::maxNumberOfChannels());
+ setNodeType(NodeTypeJavaScript);
addInput(std::make_unique<AudioNodeInput>(this));
addOutput(std::make_unique<AudioNodeOutput>(this, numberOfOutputChannels));
- setNodeType(NodeTypeJavaScript);
-
initialize();
}
Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp 2019-03-11 20:19:49 UTC (rev 242734)
@@ -32,11 +32,12 @@
namespace WebCore {
+
WaveShaperNode::WaveShaperNode(AudioContext& context)
: AudioBasicProcessorNode(context, context.sampleRate())
{
+ setNodeType(NodeTypeWaveShaper);
m_processor = std::make_unique<WaveShaperProcessor>(context.sampleRate(), 1);
- setNodeType(NodeTypeWaveShaper);
initialize();
}
@@ -44,6 +45,7 @@
void WaveShaperNode::setCurve(Float32Array& curve)
{
ASSERT(isMainThread());
+ DEBUG_LOG(LOGIDENTIFIER);
waveShaperProcessor()->setCurve(&curve);
}
@@ -69,6 +71,7 @@
void WaveShaperNode::setOversample(OverSampleType type)
{
ASSERT(isMainThread());
+ DEBUG_LOG(LOGIDENTIFIER, type);
// Synchronize with any graph changes or changes to channel configuration.
AudioContext::AutoLocker contextLocker(context());
Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h (242733 => 242734)
--- trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h 2019-03-11 20:17:50 UTC (rev 242733)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h 2019-03-11 20:19:49 UTC (rev 242734)
@@ -53,4 +53,14 @@
WaveShaperProcessor* waveShaperProcessor() { return static_cast<WaveShaperProcessor*>(processor()); }
};
+String convertEnumerationToString(WebCore::WaveShaperNode::OverSampleType); // in JSWaveShaperNode.cpp
+
} // namespace WebCore
+
+namespace WTF {
+
+template<> struct LogArgument<WebCore::WaveShaperNode::OverSampleType> {
+ static String toString(WebCore::WaveShaperNode::OverSampleType type) { return convertEnumerationToString(type); }
+};
+
+} // namespace WTF