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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return; | 103 return; |
104 } | 104 } |
105 | 105 |
106 if (!getMediaStream() || | 106 if (!getMediaStream() || |
107 m_sourceNumberOfChannels != outputBus->numberOfChannels()) { | 107 m_sourceNumberOfChannels != outputBus->numberOfChannels()) { |
108 outputBus->zero(); | 108 outputBus->zero(); |
109 return; | 109 return; |
110 } | 110 } |
111 | 111 |
112 // Use a tryLock() to avoid contention in the real-time audio thread. | 112 // Use a tryLock() to avoid contention in the real-time audio thread. |
113 // If we fail to acquire the lock then the MediaStream must be in the middle o
f | 113 // If we fail to acquire the lock then the MediaStream must be in the middle |
114 // a format change, so we output silence in this case. | 114 // of a format change, so we output silence in this case. |
115 MutexTryLocker tryLocker(m_processLock); | 115 MutexTryLocker tryLocker(m_processLock); |
116 if (tryLocker.locked()) { | 116 if (tryLocker.locked()) { |
117 getAudioSourceProvider()->provideInput(outputBus, numberOfFrames); | 117 getAudioSourceProvider()->provideInput(outputBus, numberOfFrames); |
118 } else { | 118 } else { |
119 // We failed to acquire the lock. | 119 // We failed to acquire the lock. |
120 outputBus->zero(); | 120 outputBus->zero(); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 // ---------------------------------------------------------------- | 124 // ---------------------------------------------------------------- |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 MediaStream* MediaStreamAudioSourceNode::getMediaStream() const { | 184 MediaStream* MediaStreamAudioSourceNode::getMediaStream() const { |
185 return mediaStreamAudioSourceHandler().getMediaStream(); | 185 return mediaStreamAudioSourceHandler().getMediaStream(); |
186 } | 186 } |
187 | 187 |
188 void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels, | 188 void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels, |
189 float sourceSampleRate) { | 189 float sourceSampleRate) { |
190 mediaStreamAudioSourceHandler().setFormat(numberOfChannels, sourceSampleRate); | 190 mediaStreamAudioSourceHandler().setFormat(numberOfChannels, sourceSampleRate); |
191 } | 191 } |
192 | 192 |
193 } // namespace blink | 193 } // namespace blink |
OLD | NEW |