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/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 "content/renderer/media/webrtc_audio_capturer.h" | 8 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 9 | 9 |
| 10 using media::AudioBus; | 10 using media::AudioBus; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 void WebAudioCapturerSource::setFormat( | 31 void WebAudioCapturerSource::setFormat( |
| 32 size_t number_of_channels, float sample_rate) { | 32 size_t number_of_channels, float sample_rate) { |
| 33 DVLOG(1) << "WebAudioCapturerSource::setFormat(sample_rate=" | 33 DVLOG(1) << "WebAudioCapturerSource::setFormat(sample_rate=" |
| 34 << sample_rate << ")"; | 34 << sample_rate << ")"; |
| 35 if (number_of_channels <= 2) { | 35 if (number_of_channels <= 2) { |
| 36 set_format_channels_ = number_of_channels; | 36 set_format_channels_ = number_of_channels; |
| 37 ChannelLayout channel_layout = | 37 ChannelLayout channel_layout = |
| 38 number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; | 38 number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; |
| 39 capturer_->SetCapturerSource(this, channel_layout, sample_rate); | 39 capturer_->SetCapturerSource(this, channel_layout, sample_rate); |
| 40 capturer_->Start(); | |
|
henrika (OOO until Aug 14)
2013/06/05 09:09:20
Why was this line removed?
no longer working on chromium
2013/06/05 16:29:45
capturer_ will be automatically started when the f
| |
| 41 } else { | 40 } else { |
| 42 // TODO(crogers): Handle more than just the mono and stereo cases. | 41 // TODO(crogers): Handle more than just the mono and stereo cases. |
| 43 LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format."; | 42 LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format."; |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 | 45 |
| 47 void WebAudioCapturerSource::Initialize( | 46 void WebAudioCapturerSource::Initialize( |
| 48 const media::AudioParameters& params, | 47 const media::AudioParameters& params, |
| 49 media::AudioCapturerSource::CaptureCallback* callback, | 48 media::AudioCapturerSource::CaptureCallback* callback, |
| 50 int session_id) { | 49 int session_id) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 94 |
| 96 fifo_->Push(wrapper_bus_.get()); | 95 fifo_->Push(wrapper_bus_.get()); |
| 97 int capture_frames = params_.frames_per_buffer(); | 96 int capture_frames = params_.frames_per_buffer(); |
| 98 while (fifo_->frames() >= capture_frames) { | 97 while (fifo_->frames() >= capture_frames) { |
| 99 fifo_->Consume(capture_bus_.get(), 0, capture_frames); | 98 fifo_->Consume(capture_bus_.get(), 0, capture_frames); |
| 100 callback_->Capture(capture_bus_.get(), 0, 1.0); | 99 callback_->Capture(capture_bus_.get(), 0, 1.0); |
| 101 } | 100 } |
| 102 } | 101 } |
| 103 | 102 |
| 104 } // namespace content | 103 } // namespace content |
| OLD | NEW |