Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioNode.cpp

Issue 2282483002: Return the correct channelCountMode and channelInterpretation (Closed)
Patch Set: Define setters for the mode and interpretation Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
index 67b176ffc3f16be6b90fe03e26728ed12e4bd0fa..d627cb86b4463237569e647c855e2bceadce2185 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
@@ -49,11 +49,10 @@ AudioHandler::AudioHandler(NodeType nodeType, AudioNode& node, float sampleRate)
, m_connectionRefCount(0)
, m_isDisabled(false)
, m_channelCount(2)
- , m_channelCountMode(Max)
- , m_channelInterpretation(AudioBus::Speakers)
- , m_newChannelCountMode(Max)
{
setNodeType(nodeType);
+ setInternalChannelCountMode(Max);
+ setInternalChannelInterpretation(AudioBus::Speakers);
#if DEBUG_AUDIONODE_REFERENCES
if (!s_isNodeCountInitialized) {
@@ -79,6 +78,9 @@ AudioHandler::~AudioHandler()
void AudioHandler::initialize()
{
+ DCHECK_EQ(m_newChannelCountMode, m_channelCountMode);
+ DCHECK_EQ(m_newChannelInterpretation, m_channelInterpretation);
+
m_isInitialized = true;
}
@@ -206,6 +208,18 @@ unsigned long AudioHandler::channelCount()
return m_channelCount;
}
+void AudioHandler::setInternalChannelCountMode(ChannelCountMode mode)
+{
+ m_channelCountMode = mode;
+ m_newChannelCountMode = mode;
+}
+
+void AudioHandler::setInternalChannelInterpretation(AudioBus::ChannelInterpretation interpretation)
+{
+ m_channelInterpretation = interpretation;
+ m_newChannelInterpretation = interpretation;
+}
+
void AudioHandler::setChannelCount(unsigned long channelCount, ExceptionState& exceptionState)
{
DCHECK(isMainThread());
@@ -232,7 +246,10 @@ void AudioHandler::setChannelCount(unsigned long channelCount, ExceptionState& e
String AudioHandler::channelCountMode()
{
- switch (m_channelCountMode) {
+ // Because we delay the actual setting of the mode to the pre or post
+ // rendering phase, we want to return the value that was set, not the actual
+ // current mode.
+ switch (m_newChannelCountMode) {
case Max:
return "max";
case ClampedMax:
@@ -267,7 +284,10 @@ void AudioHandler::setChannelCountMode(const String& mode, ExceptionState& excep
String AudioHandler::channelInterpretation()
{
- switch (m_channelInterpretation) {
+ // Because we delay the actual setting of the interpreation to the pre or
+ // post rendering phase, we want to return the value that was set, not the
+ // actual current interpretation.
+ switch (m_newChannelInterpretation) {
case AudioBus::Speakers:
return "speakers";
case AudioBus::Discrete:

Powered by Google App Engine
This is Rietveld 408576698