| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 size *= entry->shared_memory_segment_count; | 357 size *= entry->shared_memory_segment_count; |
| 358 if (!size.IsValid() || | 358 if (!size.IsValid() || |
| 359 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { | 359 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { |
| 360 // If creation of shared memory failed then send an error message. | 360 // If creation of shared memory failed then send an error message. |
| 361 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); | 361 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); |
| 362 MaybeUnregisterKeyboardMicStream(config); | 362 MaybeUnregisterKeyboardMicStream(config); |
| 363 return; | 363 return; |
| 364 } | 364 } |
| 365 | 365 |
| 366 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( | 366 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( |
| 367 &entry->shared_memory, entry->shared_memory_segment_count, audio_params)); | 367 entry->shared_memory.memory(), entry->shared_memory.requested_size(), |
| 368 entry->shared_memory_segment_count, audio_params)); |
| 368 | 369 |
| 369 if (!writer->Init()) { | 370 if (!writer->Init()) { |
| 370 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 371 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
| 371 MaybeUnregisterKeyboardMicStream(config); | 372 MaybeUnregisterKeyboardMicStream(config); |
| 372 return; | 373 return; |
| 373 } | 374 } |
| 374 | 375 |
| 375 // If we have successfully created the SyncWriter then assign it to the | 376 // If we have successfully created the SyncWriter then assign it to the |
| 376 // entry and construct an AudioInputController. | 377 // entry and construct an AudioInputController. |
| 377 entry->writer.reset(writer.release()); | 378 entry->writer.reset(writer.release()); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 #if defined(OS_CHROMEOS) | 551 #if defined(OS_CHROMEOS) |
| 551 if (config.params.channel_layout() == | 552 if (config.params.channel_layout() == |
| 552 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) { | 553 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) { |
| 553 media_stream_manager_->audio_input_device_manager() | 554 media_stream_manager_->audio_input_device_manager() |
| 554 ->UnregisterKeyboardMicStream(); | 555 ->UnregisterKeyboardMicStream(); |
| 555 } | 556 } |
| 556 #endif | 557 #endif |
| 557 } | 558 } |
| 558 | 559 |
| 559 } // namespace content | 560 } // namespace content |
| OLD | NEW |