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/browser/renderer_host/media/audio_input_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (LookupById(stream_id) != NULL) { | 260 if (LookupById(stream_id) != NULL) { |
261 SendErrorMessage(stream_id, STREAM_ALREADY_EXISTS); | 261 SendErrorMessage(stream_id, STREAM_ALREADY_EXISTS); |
262 return; | 262 return; |
263 } | 263 } |
264 | 264 |
265 media::AudioParameters audio_params(config.params); | 265 media::AudioParameters audio_params(config.params); |
266 if (media_stream_manager_->audio_input_device_manager()-> | 266 if (media_stream_manager_->audio_input_device_manager()-> |
267 ShouldUseFakeDevice()) { | 267 ShouldUseFakeDevice()) { |
268 audio_params.Reset( | 268 audio_params.Reset( |
269 media::AudioParameters::AUDIO_FAKE, | 269 media::AudioParameters::AUDIO_FAKE, |
270 config.params.channel_layout(), config.params.channels(), 0, | 270 config.params.channel_layout(), config.params.channels(), |
271 config.params.sample_rate(), config.params.bits_per_sample(), | 271 config.params.sample_rate(), config.params.bits_per_sample(), |
272 config.params.frames_per_buffer()); | 272 config.params.frames_per_buffer()); |
273 } | 273 } |
274 | 274 |
275 // Check if we have the permission to open the device and which device to use. | 275 // Check if we have the permission to open the device and which device to use. |
276 std::string device_name; | 276 std::string device_name; |
277 std::string device_id = media::AudioManagerBase::kDefaultDeviceId; | 277 std::string device_id = media::AudioManagerBase::kDefaultDeviceId; |
278 if (audio_params.format() != media::AudioParameters::AUDIO_FAKE) { | 278 if (audio_params.format() != media::AudioParameters::AUDIO_FAKE) { |
279 const StreamDeviceInfo* info = media_stream_manager_-> | 279 const StreamDeviceInfo* info = media_stream_manager_-> |
280 audio_input_device_manager()->GetOpenedDeviceInfoById(session_id); | 280 audio_input_device_manager()->GetOpenedDeviceInfoById(session_id); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // TODO(hclam): Implement a faster look up method. | 464 // TODO(hclam): Implement a faster look up method. |
465 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 465 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
466 i != audio_entries_.end(); ++i) { | 466 i != audio_entries_.end(); ++i) { |
467 if (controller == i->second->controller.get()) | 467 if (controller == i->second->controller.get()) |
468 return i->second; | 468 return i->second; |
469 } | 469 } |
470 return NULL; | 470 return NULL; |
471 } | 471 } |
472 | 472 |
473 } // namespace content | 473 } // namespace content |
OLD | NEW |