| 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/webaudio_capturer_source.h" | 5 #include "content/renderer/media/webaudio_capturer_source.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/renderer/media/webrtc_audio_capturer.h" | 9 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 10 #include "content/renderer/media/webrtc_local_audio_track.h" | 10 #include "content/renderer/media/webrtc_local_audio_track.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 ChannelLayout channel_layout = | 43 ChannelLayout channel_layout = |
| 44 number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; | 44 number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; |
| 45 | 45 |
| 46 base::AutoLock auto_lock(lock_); | 46 base::AutoLock auto_lock(lock_); |
| 47 // Set the format used by this WebAudioCapturerSource. We are using 10ms data | 47 // Set the format used by this WebAudioCapturerSource. We are using 10ms data |
| 48 // as buffer size since that is the native buffer size of WebRtc packet | 48 // as buffer size since that is the native buffer size of WebRtc packet |
| 49 // running on. | 49 // running on. |
| 50 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 50 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 51 channel_layout, number_of_channels, 0, sample_rate, 16, | 51 channel_layout, number_of_channels, sample_rate, 16, |
| 52 sample_rate / 100); | 52 sample_rate / 100); |
| 53 audio_format_changed_ = true; | 53 audio_format_changed_ = true; |
| 54 | 54 |
| 55 wrapper_bus_ = AudioBus::CreateWrapper(params_.channels()); | 55 wrapper_bus_ = AudioBus::CreateWrapper(params_.channels()); |
| 56 capture_bus_ = AudioBus::Create(params_); | 56 capture_bus_ = AudioBus::Create(params_); |
| 57 audio_data_.reset( | 57 audio_data_.reset( |
| 58 new int16[params_.frames_per_buffer() * params_.channels()]); | 58 new int16[params_.frames_per_buffer() * params_.channels()]); |
| 59 fifo_.reset(new AudioFifo( | 59 fifo_.reset(new AudioFifo( |
| 60 params_.channels(), | 60 params_.channels(), |
| 61 kMaxNumberOfBuffersInFifo * params_.frames_per_buffer())); | 61 kMaxNumberOfBuffersInFifo * params_.frames_per_buffer())); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // TODO(xians): Avoid this interleave/deinterleave operation. | 125 // TODO(xians): Avoid this interleave/deinterleave operation. |
| 126 capture_bus_->ToInterleaved(capture_bus_->frames(), | 126 capture_bus_->ToInterleaved(capture_bus_->frames(), |
| 127 params_.bits_per_sample() / 8, | 127 params_.bits_per_sample() / 8, |
| 128 audio_data_.get()); | 128 audio_data_.get()); |
| 129 track_->Capture(audio_data_.get(), delay, volume, key_pressed, | 129 track_->Capture(audio_data_.get(), delay, volume, key_pressed, |
| 130 need_audio_processing); | 130 need_audio_processing); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace content | 134 } // namespace content |
| OLD | NEW |