| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/audio_output_mixer.h" | 5 #include "media/audio/audio_output_mixer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 proxy_data->pending_bytes = buffers_state.pending_bytes; | 187 proxy_data->pending_bytes = buffers_state.pending_bytes; |
| 188 | 188 |
| 189 // Note: there is no way we can deduce hardware_delay_bytes for the | 189 // Note: there is no way we can deduce hardware_delay_bytes for the |
| 190 // particular proxy stream. Use zero instead. | 190 // particular proxy stream. Use zero instead. |
| 191 uint32 actual_size = proxy_data->audio_source_callback->OnMoreData( | 191 uint32 actual_size = proxy_data->audio_source_callback->OnMoreData( |
| 192 actual_dest, | 192 actual_dest, |
| 193 max_size, | 193 max_size, |
| 194 AudioBuffersState(proxy_data->pending_bytes, 0)); | 194 AudioBuffersState(proxy_data->pending_bytes, 0)); |
| 195 if (actual_size == 0) | 195 if (actual_size == 0) |
| 196 continue; | 196 continue; |
| 197 | |
| 198 // No need to mix muted stream. | |
| 199 double volume = proxy_data->volume; | 197 double volume = proxy_data->volume; |
| 200 if (volume == 0.0) | |
| 201 continue; | |
| 202 | 198 |
| 203 // Different handling for first and all subsequent streams. | 199 // Different handling for first and all subsequent streams. |
| 204 if (first_stream) { | 200 if (first_stream) { |
| 205 if (volume != 1.0) { | 201 if (volume != 1.0) { |
| 206 media::AdjustVolume(actual_dest, | 202 media::AdjustVolume(actual_dest, |
| 207 actual_size, | 203 actual_size, |
| 208 params_.channels(), | 204 params_.channels(), |
| 209 bytes_per_sample, | 205 bytes_per_sample, |
| 210 volume); | 206 volume); |
| 211 } | 207 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 239 } |
| 244 | 240 |
| 245 void AudioOutputMixer::WaitTillDataReady() { | 241 void AudioOutputMixer::WaitTillDataReady() { |
| 246 base::AutoLock lock(lock_); | 242 base::AutoLock lock(lock_); |
| 247 for (ProxyMap::iterator it = proxies_.begin(); it != proxies_.end(); ++it) { | 243 for (ProxyMap::iterator it = proxies_.begin(); it != proxies_.end(); ++it) { |
| 248 it->second.audio_source_callback->WaitTillDataReady(); | 244 it->second.audio_source_callback->WaitTillDataReady(); |
| 249 } | 245 } |
| 250 } | 246 } |
| 251 | 247 |
| 252 } // namespace media | 248 } // namespace media |
| OLD | NEW |