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/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 size *= entry->shared_memory_segment_count; | 420 size *= entry->shared_memory_segment_count; |
421 if (!size.IsValid() || | 421 if (!size.IsValid() || |
422 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { | 422 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { |
423 // If creation of shared memory failed then send an error message. | 423 // If creation of shared memory failed then send an error message. |
424 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); | 424 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); |
425 MaybeUnregisterKeyboardMicStream(config); | 425 MaybeUnregisterKeyboardMicStream(config); |
426 return; | 426 return; |
427 } | 427 } |
428 | 428 |
429 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( | 429 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( |
430 &entry->shared_memory, entry->shared_memory_segment_count, audio_params)); | 430 entry->shared_memory.memory(), entry->shared_memory.requested_size(), |
| 431 entry->shared_memory_segment_count, audio_params)); |
431 | 432 |
432 if (!writer->Init()) { | 433 if (!writer->Init()) { |
433 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 434 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
434 MaybeUnregisterKeyboardMicStream(config); | 435 MaybeUnregisterKeyboardMicStream(config); |
435 return; | 436 return; |
436 } | 437 } |
437 | 438 |
438 // If we have successfully created the SyncWriter then assign it to the | 439 // If we have successfully created the SyncWriter then assign it to the |
439 // entry and construct an AudioInputController. | 440 // entry and construct an AudioInputController. |
440 entry->writer.reset(writer.release()); | 441 entry->writer.reset(writer.release()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 BrowserThread::PostTask( | 721 BrowserThread::PostTask( |
721 BrowserThread::FILE, | 722 BrowserThread::FILE, |
722 FROM_HERE, | 723 FROM_HERE, |
723 base::Bind(&DeleteInputDebugWriterOnFileThread, | 724 base::Bind(&DeleteInputDebugWriterOnFileThread, |
724 base::Passed(entry->input_debug_writer.Pass()))); | 725 base::Passed(entry->input_debug_writer.Pass()))); |
725 } | 726 } |
726 } | 727 } |
727 #endif // defined(ENABLE_WEBRTC) | 728 #endif // defined(ENABLE_WEBRTC) |
728 | 729 |
729 } // namespace content | 730 } // namespace content |
OLD | NEW |