| Index: third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
|
| index a6fc98218628ce1bcaffe083212e6af20df18e90..7894253c36f9b2773c51d519fff9e9069e90d0e5 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
|
| @@ -32,7 +32,7 @@
|
| namespace blink {
|
|
|
| DefaultAudioDestinationHandler::DefaultAudioDestinationHandler(AudioNode& node)
|
| - : AudioDestinationHandler(node, AudioDestination::hardwareSampleRate())
|
| + : AudioDestinationHandler(node, AudioRenderSink::audioHardwareSampleRate())
|
| , m_numberOfInputChannels(0)
|
| {
|
| // Node-specific default mixing rules.
|
| @@ -63,7 +63,7 @@ void DefaultAudioDestinationHandler::initialize()
|
| if (isInitialized())
|
| return;
|
|
|
| - createDestination();
|
| + createRenderSink();
|
| AudioHandler::initialize();
|
| }
|
|
|
| @@ -73,66 +73,66 @@ void DefaultAudioDestinationHandler::uninitialize()
|
| if (!isInitialized())
|
| return;
|
|
|
| - m_destination->stop();
|
| + m_audioRenderSink->stop();
|
| m_numberOfInputChannels = 0;
|
|
|
| AudioHandler::uninitialize();
|
| }
|
|
|
| -void DefaultAudioDestinationHandler::createDestination()
|
| +void DefaultAudioDestinationHandler::createRenderSink()
|
| {
|
| - float hardwareSampleRate = AudioDestination::hardwareSampleRate();
|
| - VLOG(1) << ">>>> hardwareSampleRate = " << hardwareSampleRate;
|
| + float audioHardwareSampleRate = AudioRenderSink::audioHardwareSampleRate();
|
| + VLOG(1) << ">>>> hardwareSampleRate = " << audioHardwareSampleRate;
|
|
|
| - m_destination = AudioDestination::create(*this, m_inputDeviceId, m_numberOfInputChannels, channelCount(), hardwareSampleRate, context()->getSecurityOrigin());
|
| + m_audioRenderSink = AudioRenderSink::create(*this,
|
| + m_inputDeviceId, m_numberOfInputChannels, channelCount(),
|
| + audioHardwareSampleRate, context()->getSecurityOrigin());
|
| }
|
|
|
| void DefaultAudioDestinationHandler::startRendering()
|
| {
|
| ASSERT(isInitialized());
|
| - if (isInitialized()) {
|
| - ASSERT(!m_destination->isPlaying());
|
| - m_destination->start();
|
| - }
|
| + if (isInitialized())
|
| + m_audioRenderSink->start();
|
| }
|
|
|
| void DefaultAudioDestinationHandler::stopRendering()
|
| {
|
| ASSERT(isInitialized());
|
| - if (isInitialized()) {
|
| - ASSERT(m_destination->isPlaying());
|
| - m_destination->stop();
|
| - }
|
| + if (isInitialized())
|
| + m_audioRenderSink->stop();
|
| }
|
|
|
| unsigned long DefaultAudioDestinationHandler::maxChannelCount() const
|
| {
|
| - return AudioDestination::maxChannelCount();
|
| + return AudioRenderSink::audioHardwareChannelCount();
|
| }
|
|
|
| -void DefaultAudioDestinationHandler::setChannelCount(unsigned long channelCount, ExceptionState& exceptionState)
|
| +void DefaultAudioDestinationHandler::setChannelCount(unsigned long newChannelCount, ExceptionState& exceptionState)
|
| {
|
| - // The channelCount for the input to this node controls the actual number of channels we
|
| - // send to the audio hardware. It can only be set depending on the maximum number of
|
| - // channels supported by the hardware.
|
| -
|
| + // The channelCount for the input to this node controls the actual number of
|
| + // channels we send to the audio hardware. It can only be set depending on
|
| + // the maximum number of channels supported by the hardware.
|
| ASSERT(isMainThread());
|
| + ASSERT(isInitialized());
|
| + if (!isInitialized())
|
| + return;
|
|
|
| - if (!maxChannelCount() || channelCount > maxChannelCount()) {
|
| + if (!maxChannelCount() || newChannelCount > maxChannelCount()) {
|
| exceptionState.throwDOMException(
|
| IndexSizeError,
|
| - ExceptionMessages::indexOutsideRange<unsigned>("channel count", channelCount, 1, ExceptionMessages::InclusiveBound, maxChannelCount(), ExceptionMessages::InclusiveBound));
|
| + ExceptionMessages::indexOutsideRange<unsigned>("channel count", newChannelCount, 1, ExceptionMessages::InclusiveBound, maxChannelCount(), ExceptionMessages::InclusiveBound));
|
| return;
|
| }
|
|
|
| - unsigned long oldChannelCount = this->channelCount();
|
| - AudioHandler::setChannelCount(channelCount, exceptionState);
|
| + unsigned long oldChannelCount = channelCount();
|
| + AudioHandler::setChannelCount(newChannelCount, exceptionState);
|
|
|
| - if (!exceptionState.hadException() && this->channelCount() != oldChannelCount && isInitialized()) {
|
| - // Re-create destination.
|
| - m_destination->stop();
|
| - createDestination();
|
| - m_destination->start();
|
| + // Restart render sink to apply the channel count change.
|
| + if (!exceptionState.hadException() && channelCount() != oldChannelCount) {
|
| + m_audioRenderSink->stop();
|
| + createRenderSink();
|
| + m_audioRenderSink->start();
|
| }
|
| }
|
|
|
|
|