Chromium Code Reviews| 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 "content/renderer/media/audio_renderer_mixer_manager.h" | 5 #include "content/renderer/media/audio_renderer_mixer_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 output_buffer_size = media::AudioLatency::GetRtcBufferSize( | 56 output_buffer_size = media::AudioLatency::GetRtcBufferSize( |
| 57 output_sample_rate, valid_not_fake_hardware_params | 57 output_sample_rate, valid_not_fake_hardware_params |
| 58 ? hardware_params.frames_per_buffer() | 58 ? hardware_params.frames_per_buffer() |
| 59 : 0); | 59 : 0); |
| 60 break; | 60 break; |
| 61 case media::AudioLatency::LATENCY_PLAYBACK: | 61 case media::AudioLatency::LATENCY_PLAYBACK: |
| 62 output_buffer_size = media::AudioLatency::GetHighLatencyBufferSize( | 62 output_buffer_size = media::AudioLatency::GetHighLatencyBufferSize( |
| 63 output_sample_rate, preferred_high_latency_output_buffer_size); | 63 output_sample_rate, preferred_high_latency_output_buffer_size); |
| 64 break; | 64 break; |
| 65 case media::AudioLatency::LATENCY_EXACT_MS: | 65 case media::AudioLatency::LATENCY_EXACT_MS: |
| 66 // TODO(olka): add support when WebAudio requires it. | 66 output_buffer_size = |
| 67 std::max(std::min(input_params.frames_per_buffer(), | |
| 68 media::AudioLatency::GetHighLatencyBufferSize( | |
|
o1ka
2017/03/14 15:55:43
HighLatencyBufferSize is 20 ms. Is it the the maxi
Raymond Toy
2017/03/14 16:14:35
Is 20ms the value for "playback"?
In any case, th
| |
| 69 output_sample_rate, | |
| 70 preferred_high_latency_output_buffer_size)), | |
| 71 hardware_params.frames_per_buffer()); | |
|
Raymond Toy
2017/03/14 15:19:39
Blink has a clampTo() function that's easier to re
Andrew MacPherson
2017/03/15 15:08:17
Makes sense, I've refactored the AudioContextTest
| |
| 72 break; | |
| 67 default: | 73 default: |
| 68 NOTREACHED(); | 74 NOTREACHED(); |
| 69 } | 75 } |
| 70 | 76 |
| 71 DCHECK_NE(output_buffer_size, 0); | 77 DCHECK_NE(output_buffer_size, 0); |
| 72 | 78 |
| 73 // Force to 16-bit output for now since we know that works everywhere; | 79 // Force to 16-bit output for now since we know that works everywhere; |
| 74 // ChromeOS does not support other bit depths. | 80 // ChromeOS does not support other bit depths. |
| 75 media::AudioParameters params(input_params.format(), | 81 media::AudioParameters params(input_params.format(), |
| 76 input_params.channel_layout(), | 82 input_params.channel_layout(), |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 const url::Origin& security_origin) | 253 const url::Origin& security_origin) |
| 248 : source_render_frame_id(source_render_frame_id), | 254 : source_render_frame_id(source_render_frame_id), |
| 249 params(params), | 255 params(params), |
| 250 latency(latency), | 256 latency(latency), |
| 251 device_id(device_id), | 257 device_id(device_id), |
| 252 security_origin(security_origin) {} | 258 security_origin(security_origin) {} |
| 253 | 259 |
| 254 AudioRendererMixerManager::MixerKey::MixerKey(const MixerKey& other) = default; | 260 AudioRendererMixerManager::MixerKey::MixerKey(const MixerKey& other) = default; |
| 255 | 261 |
| 256 } // namespace content | 262 } // namespace content |
| OLD | NEW |