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/webrtc_audio_capturer.h" | 5 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 buffer_size = (sample_rate / 100); | 44 buffer_size = (sample_rate / 100); |
| 45 DCHECK_EQ(buffer_size * 100, sample_rate) << | 45 DCHECK_EQ(buffer_size * 100, sample_rate) << |
| 46 "Sample rate not supported"; | 46 "Sample rate not supported"; |
| 47 } | 47 } |
| 48 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 48 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
| 49 // Based on tests using the current ALSA implementation in Chrome, we have | 49 // Based on tests using the current ALSA implementation in Chrome, we have |
| 50 // found that the best combination is 20ms on the input side and 10ms on the | 50 // found that the best combination is 20ms on the input side and 10ms on the |
| 51 // output side. | 51 // output side. |
| 52 // TODO(henrika): It might be possible to reduce the input buffer | 52 // TODO(henrika): It might be possible to reduce the input buffer |
| 53 // size and reduce the delay even more. | 53 // size and reduce the delay even more. |
| 54 buffer_size = 2 * sample_rate / 100; | 54 if (sample_rate == 44100) |
|
DaleCurtis
2013/03/02 01:53:56
Hmm, what is this?
no longer working on chromium
2013/03/04 14:55:04
Oh, this change is making the webrtc audio work wh
| |
| 55 buffer_size = 2 * 440; | |
| 56 else | |
| 57 buffer_size = 2 * sample_rate / 100; | |
| 55 #elif defined(OS_ANDROID) | 58 #elif defined(OS_ANDROID) |
| 56 // TODO(leozwang): Tune and adjust buffer size on Android. | 59 // TODO(leozwang): Tune and adjust buffer size on Android. |
| 57 buffer_size = 2 * sample_rate / 100; | 60 buffer_size = 2 * sample_rate / 100; |
| 58 #endif | 61 #endif |
| 59 | 62 |
| 60 return buffer_size; | 63 return buffer_size; |
| 61 } | 64 } |
| 62 | 65 |
| 63 // This is a temporary audio buffer with parameters used to send data to | 66 // This is a temporary audio buffer with parameters used to send data to |
| 64 // callbacks. | 67 // callbacks. |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 if (!on_device_stopped_cb_.is_null()) | 485 if (!on_device_stopped_cb_.is_null()) |
| 483 on_device_stopped_cb_.Run(); | 486 on_device_stopped_cb_.Run(); |
| 484 } | 487 } |
| 485 | 488 |
| 486 media::AudioParameters WebRtcAudioCapturer::audio_parameters() const { | 489 media::AudioParameters WebRtcAudioCapturer::audio_parameters() const { |
| 487 base::AutoLock auto_lock(lock_); | 490 base::AutoLock auto_lock(lock_); |
| 488 return buffer_->params(); | 491 return buffer_->params(); |
| 489 } | 492 } |
| 490 | 493 |
| 491 } // namespace content | 494 } // namespace content |
| OLD | NEW |