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_local_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_local_audio_renderer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 int WebRtcLocalAudioRenderer::CaptureData(const std::vector<int>& channels, | 62 int WebRtcLocalAudioRenderer::CaptureData(const std::vector<int>& channels, |
| 63 const int16* audio_data, | 63 const int16* audio_data, |
| 64 int sample_rate, | 64 int sample_rate, |
| 65 int number_of_channels, | 65 int number_of_channels, |
| 66 int number_of_frames, | 66 int number_of_frames, |
| 67 int audio_delay_milliseconds, | 67 int audio_delay_milliseconds, |
| 68 int current_volume, | 68 int current_volume, |
| 69 bool need_audio_processing, | 69 bool need_audio_processing, |
| 70 bool key_pressed) { | 70 bool key_pressed) { |
| 71 TRACE_EVENT0("audio", "WebRtcLocalAudioRenderer::CaptureData"); | 71 TRACE_EVENT0("audio", "WebRtcLocalAudioRenderer::CaptureData"); |
| 72 if (!current_volume) | |
|
ajm
2013/09/27 22:54:40
This seems really hacky. What if the current volum
| |
| 73 return 0; | |
| 74 | |
| 72 base::AutoLock auto_lock(thread_lock_); | 75 base::AutoLock auto_lock(thread_lock_); |
| 73 if (!playing_ || !volume_) | 76 if (!playing_ || !volume_) |
| 74 return 0; | 77 return 0; |
| 75 | 78 |
| 76 // Push captured audio to FIFO so it can be read by a local sink. | 79 // Push captured audio to FIFO so it can be read by a local sink. |
| 77 if (loopback_fifo_) { | 80 if (loopback_fifo_) { |
| 78 if (loopback_fifo_->frames() + number_of_frames <= | 81 if (loopback_fifo_->frames() + number_of_frames <= |
| 79 loopback_fifo_->max_frames()) { | 82 loopback_fifo_->max_frames()) { |
| 80 scoped_ptr<media::AudioBus> audio_source = media::AudioBus::Create( | 83 scoped_ptr<media::AudioBus> audio_source = media::AudioBus::Create( |
| 81 number_of_channels, number_of_frames); | 84 number_of_channels, number_of_frames); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 return; | 284 return; |
| 282 | 285 |
| 283 sink_->Start(); | 286 sink_->Start(); |
| 284 sink_started_ = true; | 287 sink_started_ = true; |
| 285 | 288 |
| 286 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", | 289 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", |
| 287 kSinkStarted, kSinkStatesMax); | 290 kSinkStarted, kSinkStatesMax); |
| 288 } | 291 } |
| 289 | 292 |
| 290 } // namespace content | 293 } // namespace content |
| OLD | NEW |