| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 node, mediaStream, audioTrack, std::move(audioSourceProvider))); | 62 node, mediaStream, audioTrack, std::move(audioSourceProvider))); |
| 63 } | 63 } |
| 64 | 64 |
| 65 MediaStreamAudioSourceHandler::~MediaStreamAudioSourceHandler() { | 65 MediaStreamAudioSourceHandler::~MediaStreamAudioSourceHandler() { |
| 66 uninitialize(); | 66 uninitialize(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void MediaStreamAudioSourceHandler::setFormat(size_t numberOfChannels, | 69 void MediaStreamAudioSourceHandler::setFormat(size_t numberOfChannels, |
| 70 float sourceSampleRate) { | 70 float sourceSampleRate) { |
| 71 if (numberOfChannels != m_sourceNumberOfChannels || | 71 if (numberOfChannels != m_sourceNumberOfChannels || |
| 72 sourceSampleRate != sampleRate()) { | 72 sourceSampleRate != context()->sampleRate()) { |
| 73 // The sample-rate must be equal to the context's sample-rate. | 73 // The sample-rate must be equal to the context's sample-rate. |
| 74 if (!numberOfChannels || | 74 if (!numberOfChannels || |
| 75 numberOfChannels > BaseAudioContext::maxNumberOfChannels() || | 75 numberOfChannels > BaseAudioContext::maxNumberOfChannels() || |
| 76 sourceSampleRate != sampleRate()) { | 76 sourceSampleRate != context()->sampleRate()) { |
| 77 // process() will generate silence for these uninitialized values. | 77 // process() will generate silence for these uninitialized values. |
| 78 DLOG(ERROR) << "setFormat(" << numberOfChannels << ", " | 78 DLOG(ERROR) << "setFormat(" << numberOfChannels << ", " |
| 79 << sourceSampleRate << ") - unhandled format change"; | 79 << sourceSampleRate << ") - unhandled format change"; |
| 80 m_sourceNumberOfChannels = 0; | 80 m_sourceNumberOfChannels = 0; |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Synchronize with process(). | 84 // Synchronize with process(). |
| 85 MutexLocker locker(m_processLock); | 85 MutexLocker locker(m_processLock); |
| 86 | 86 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 MediaStream* MediaStreamAudioSourceNode::getMediaStream() const { | 192 MediaStream* MediaStreamAudioSourceNode::getMediaStream() const { |
| 193 return mediaStreamAudioSourceHandler().getMediaStream(); | 193 return mediaStreamAudioSourceHandler().getMediaStream(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels, | 196 void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels, |
| 197 float sourceSampleRate) { | 197 float sourceSampleRate) { |
| 198 mediaStreamAudioSourceHandler().setFormat(numberOfChannels, sourceSampleRate); | 198 mediaStreamAudioSourceHandler().setFormat(numberOfChannels, sourceSampleRate); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |