| 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/base/audio_renderer_mixer.h" | 5 #include "media/base/audio_renderer_mixer.h" |
| 6 | 6 |
| 7 #if defined(ARCH_CPU_X86_FAMILY) && defined(__SSE__) | 7 #if defined(ARCH_CPU_X86_FAMILY) && defined(__SSE__) |
| 8 #include <xmmintrin.h> | 8 #include <xmmintrin.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 int frames_filled = input->callback()->Render( | 113 int frames_filled = input->callback()->Render( |
| 114 mixer_input_audio_bus_.get(), current_audio_delay_milliseconds_); | 114 mixer_input_audio_bus_.get(), current_audio_delay_milliseconds_); |
| 115 if (frames_filled == 0) | 115 if (frames_filled == 0) |
| 116 continue; | 116 continue; |
| 117 | 117 |
| 118 // Volume adjust and mix each mixer input into |audio_bus| after rendering. | 118 // Volume adjust and mix each mixer input into |audio_bus| after rendering. |
| 119 for (int i = 0; i < audio_bus->channels(); ++i) { | 119 for (int i = 0; i < audio_bus->channels(); ++i) { |
| 120 VectorFMAC(mixer_input_audio_bus_->channel(i), volume, frames_filled, | 120 VectorFMAC(mixer_input_audio_bus_->channel(i), volume, frames_filled, |
| 121 audio_bus->channel(i)); | 121 audio_bus->channel(i)); |
| 122 } | 122 } |
| 123 | |
| 124 // No need to clamp values as InterleaveFloatToInt() will take care of this | |
| 125 // for us later when data is transferred to the browser process. | |
| 126 } | 123 } |
| 127 } | 124 } |
| 128 | 125 |
| 129 void AudioRendererMixer::OnRenderError() { | 126 void AudioRendererMixer::OnRenderError() { |
| 130 base::AutoLock auto_lock(mixer_inputs_lock_); | 127 base::AutoLock auto_lock(mixer_inputs_lock_); |
| 131 | 128 |
| 132 // Call each mixer input and signal an error. | 129 // Call each mixer input and signal an error. |
| 133 for (AudioRendererMixerInputSet::iterator it = mixer_inputs_.begin(); | 130 for (AudioRendererMixerInputSet::iterator it = mixer_inputs_.begin(); |
| 134 it != mixer_inputs_.end(); ++it) { | 131 it != mixer_inputs_.end(); ++it) { |
| 135 (*it)->callback()->OnRenderError(); | 132 (*it)->callback()->OnRenderError(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 _mm_mul_ps(_mm_load_ps(src + i), m_scale))); | 169 _mm_mul_ps(_mm_load_ps(src + i), m_scale))); |
| 173 } | 170 } |
| 174 | 171 |
| 175 // Handle any remaining values that wouldn't fit in an SSE pass. | 172 // Handle any remaining values that wouldn't fit in an SSE pass. |
| 176 if (rem) | 173 if (rem) |
| 177 VectorFMAC_C(src + len - rem, scale, rem, dest + len - rem); | 174 VectorFMAC_C(src + len - rem, scale, rem, dest + len - rem); |
| 178 } | 175 } |
| 179 #endif | 176 #endif |
| 180 | 177 |
| 181 } // namespace media | 178 } // namespace media |
| OLD | NEW |