| 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 29 matching lines...) Expand all Loading... |
| 40 capturer_->Start(); | 40 capturer_->Start(); |
| 41 } else { | 41 } else { |
| 42 // TODO(crogers): Handle more than just the mono and stereo cases. | 42 // TODO(crogers): Handle more than just the mono and stereo cases. |
| 43 LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format."; | 43 LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format."; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 void WebAudioCapturerSource::Initialize( | 47 void WebAudioCapturerSource::Initialize( |
| 48 const media::AudioParameters& params, | 48 const media::AudioParameters& params, |
| 49 media::AudioCapturerSource::CaptureCallback* callback, | 49 media::AudioCapturerSource::CaptureCallback* callback, |
| 50 media::AudioCapturerSource::CaptureEventHandler* event_handler) { | 50 int session_id) { |
| 51 // The downstream client should be configured the same as what WebKit | 51 // The downstream client should be configured the same as what WebKit |
| 52 // is feeding it. | 52 // is feeding it. |
| 53 DCHECK_EQ(set_format_channels_, params.channels()); | 53 DCHECK_EQ(set_format_channels_, params.channels()); |
| 54 | 54 |
| 55 base::AutoLock auto_lock(lock_); | 55 base::AutoLock auto_lock(lock_); |
| 56 params_ = params; | 56 params_ = params; |
| 57 callback_ = callback; | 57 callback_ = callback; |
| 58 wrapper_bus_ = AudioBus::CreateWrapper(params.channels()); | 58 wrapper_bus_ = AudioBus::CreateWrapper(params.channels()); |
| 59 capture_bus_ = AudioBus::Create(params); | 59 capture_bus_ = AudioBus::Create(params); |
| 60 fifo_.reset(new AudioFifo(params.channels(), kFifoSize)); | 60 fifo_.reset(new AudioFifo(params.channels(), kFifoSize)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 fifo_->Push(wrapper_bus_.get()); | 96 fifo_->Push(wrapper_bus_.get()); |
| 97 int capture_frames = params_.frames_per_buffer(); | 97 int capture_frames = params_.frames_per_buffer(); |
| 98 while (fifo_->frames() >= capture_frames) { | 98 while (fifo_->frames() >= capture_frames) { |
| 99 fifo_->Consume(capture_bus_.get(), 0, capture_frames); | 99 fifo_->Consume(capture_bus_.get(), 0, capture_frames); |
| 100 callback_->Capture(capture_bus_.get(), 0, 1.0); | 100 callback_->Capture(capture_bus_.get(), 0, 1.0); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace content | 104 } // namespace content |
| OLD | NEW |