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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioNode.cpp

Issue 2014343002: Defer changes to channelInterpretation to pre/post rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void AudioHandler::clearInternalStateWhenDisabled() 90 void AudioHandler::clearInternalStateWhenDisabled()
91 { 91 {
92 } 92 }
93 93
94 void AudioHandler::dispose() 94 void AudioHandler::dispose()
95 { 95 {
96 ASSERT(isMainThread()); 96 ASSERT(isMainThread());
97 ASSERT(context()->isGraphOwner()); 97 ASSERT(context()->isGraphOwner());
98 98
99 context()->deferredTaskHandler().removeChangedChannelCountMode(this); 99 context()->deferredTaskHandler().removeChangedChannelCountMode(this);
100 context()->deferredTaskHandler().removeChangedChannelInterpretation(this);
100 context()->deferredTaskHandler().removeAutomaticPullNode(this); 101 context()->deferredTaskHandler().removeAutomaticPullNode(this);
101 for (auto& output : m_outputs) 102 for (auto& output : m_outputs)
102 output->dispose(); 103 output->dispose();
103 m_node = nullptr; 104 m_node = nullptr;
104 } 105 }
105 106
106 AudioNode* AudioHandler::node() const 107 AudioNode* AudioHandler::node() const
107 { 108 {
108 ASSERT(isMainThread()); 109 ASSERT(isMainThread());
109 return m_node; 110 return m_node;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 274 }
274 ASSERT_NOT_REACHED(); 275 ASSERT_NOT_REACHED();
275 return ""; 276 return "";
276 } 277 }
277 278
278 void AudioHandler::setChannelInterpretation(const String& interpretation, Except ionState& exceptionState) 279 void AudioHandler::setChannelInterpretation(const String& interpretation, Except ionState& exceptionState)
279 { 280 {
280 ASSERT(isMainThread()); 281 ASSERT(isMainThread());
281 AbstractAudioContext::AutoLocker locker(context()); 282 AbstractAudioContext::AutoLocker locker(context());
282 283
284 AudioBus::ChannelInterpretation oldMode = m_channelInterpretation;
285
283 if (interpretation == "speakers") { 286 if (interpretation == "speakers") {
284 m_channelInterpretation = AudioBus::Speakers; 287 m_newChannelInterpretation = AudioBus::Speakers;
285 } else if (interpretation == "discrete") { 288 } else if (interpretation == "discrete") {
286 m_channelInterpretation = AudioBus::Discrete; 289 m_newChannelInterpretation = AudioBus::Discrete;
287 } else { 290 } else {
288 ASSERT_NOT_REACHED(); 291 ASSERT_NOT_REACHED();
289 } 292 }
293
294 if (m_newChannelInterpretation != oldMode)
295 context()->deferredTaskHandler().addChangedChannelInterpretation(this);
290 } 296 }
291 297
292 void AudioHandler::updateChannelsForInputs() 298 void AudioHandler::updateChannelsForInputs()
293 { 299 {
294 for (auto& input : m_inputs) 300 for (auto& input : m_inputs)
295 input->changedOutputs(); 301 input->changedOutputs();
296 } 302 }
297 303
298 void AudioHandler::processIfNecessary(size_t framesToProcess) 304 void AudioHandler::processIfNecessary(size_t framesToProcess)
299 { 305 {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 505 }
500 506
501 #endif // DEBUG_AUDIONODE_REFERENCES 507 #endif // DEBUG_AUDIONODE_REFERENCES
502 508
503 void AudioHandler::updateChannelCountMode() 509 void AudioHandler::updateChannelCountMode()
504 { 510 {
505 m_channelCountMode = m_newChannelCountMode; 511 m_channelCountMode = m_newChannelCountMode;
506 updateChannelsForInputs(); 512 updateChannelsForInputs();
507 } 513 }
508 514
515 void AudioHandler::updateChannelInterpretation()
516 {
517 m_channelInterpretation = m_newChannelInterpretation;
518 }
519
509 unsigned AudioHandler::numberOfOutputChannels() const 520 unsigned AudioHandler::numberOfOutputChannels() const
510 { 521 {
511 // This should only be called for ScriptProcessorNodes which are the only no des where you can 522 // This should only be called for ScriptProcessorNodes which are the only no des where you can
512 // have an output with 0 channels. All other nodes have have at least one o utput channel, so 523 // have an output with 0 channels. All other nodes have have at least one o utput channel, so
513 // there's no reason other nodes should ever call this function. 524 // there's no reason other nodes should ever call this function.
514 DCHECK(0) << "numberOfOutputChannels() not valid for node type " << getNodeT ype(); 525 DCHECK(0) << "numberOfOutputChannels() not valid for node type " << getNodeT ype();
515 return 1; 526 return 1;
516 } 527 }
517 // ---------------------------------------------------------------- 528 // ----------------------------------------------------------------
518 529
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 void AudioNode::didAddOutput(unsigned numberOfOutputs) 944 void AudioNode::didAddOutput(unsigned numberOfOutputs)
934 { 945 {
935 m_connectedNodes.append(nullptr); 946 m_connectedNodes.append(nullptr);
936 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedNodes.size()); 947 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedNodes.size());
937 m_connectedParams.append(nullptr); 948 m_connectedParams.append(nullptr);
938 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedParams.size()); 949 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedParams.size());
939 } 950 }
940 951
941 } // namespace blink 952 } // namespace blink
942 953
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698