| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (!buffer_size) { | 78 if (!buffer_size) { |
| 79 DLOG(ERROR) << "Unsupported sample-rate: " << sample_rate; | 79 DLOG(ERROR) << "Unsupported sample-rate: " << sample_rate; |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 media::AudioParameters::Format format = | 83 media::AudioParameters::Format format = |
| 84 media::AudioParameters::AUDIO_PCM_LOW_LATENCY; | 84 media::AudioParameters::AUDIO_PCM_LOW_LATENCY; |
| 85 | 85 |
| 86 // bits_per_sample is always 16 for now. | 86 // bits_per_sample is always 16 for now. |
| 87 int bits_per_sample = 16; | 87 int bits_per_sample = 16; |
| 88 | 88 int channels = ChannelLayoutToChannelCount(channel_layout); |
| 89 params_.Reset(format, channel_layout, 0, sample_rate, bits_per_sample, | 89 params_.Reset(format, channel_layout, channels, 0, |
| 90 buffer_size); | 90 sample_rate, bits_per_sample, buffer_size); |
| 91 buffer_.reset(new int16[params_.frames_per_buffer() * params_.channels()]); | 91 buffer_.reset(new int16[params_.frames_per_buffer() * params_.channels()]); |
| 92 | 92 |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 int16* buffer() const { return buffer_.get(); } | 96 int16* buffer() const { return buffer_.get(); } |
| 97 const media::AudioParameters& params() const { return params_; } | 97 const media::AudioParameters& params() const { return params_; } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 ~ConfiguredBuffer() {} | 100 ~ConfiguredBuffer() {} |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 for (SinkList::const_iterator it = sinks.begin(); it != sinks.end(); ++it) | 394 for (SinkList::const_iterator it = sinks.begin(); it != sinks.end(); ++it) |
| 395 (*it)->OnCaptureDeviceStopped(); | 395 (*it)->OnCaptureDeviceStopped(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 media::AudioParameters WebRtcAudioCapturer::audio_parameters() const { | 398 media::AudioParameters WebRtcAudioCapturer::audio_parameters() const { |
| 399 base::AutoLock auto_lock(lock_); | 399 base::AutoLock auto_lock(lock_); |
| 400 return buffer_->params(); | 400 return buffer_->params(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace content | 403 } // namespace content |
| OLD | NEW |