| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 size *= entry->shared_memory_segment_count; | 425 size *= entry->shared_memory_segment_count; |
| 426 if (!size.IsValid() || | 426 if (!size.IsValid() || |
| 427 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { | 427 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { |
| 428 // If creation of shared memory failed then send an error message. | 428 // If creation of shared memory failed then send an error message. |
| 429 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); | 429 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); |
| 430 MaybeUnregisterKeyboardMicStream(config); | 430 MaybeUnregisterKeyboardMicStream(config); |
| 431 return; | 431 return; |
| 432 } | 432 } |
| 433 | 433 |
| 434 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( | 434 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( |
| 435 &entry->shared_memory, entry->shared_memory_segment_count, audio_params)); | 435 entry->shared_memory.memory(), entry->shared_memory.requested_size(), |
| 436 entry->shared_memory_segment_count, audio_params)); |
| 436 | 437 |
| 437 if (!writer->Init()) { | 438 if (!writer->Init()) { |
| 438 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 439 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
| 439 MaybeUnregisterKeyboardMicStream(config); | 440 MaybeUnregisterKeyboardMicStream(config); |
| 440 return; | 441 return; |
| 441 } | 442 } |
| 442 | 443 |
| 443 // If we have successfully created the SyncWriter then assign it to the | 444 // If we have successfully created the SyncWriter then assign it to the |
| 444 // entry and construct an AudioInputController. | 445 // entry and construct an AudioInputController. |
| 445 entry->writer.reset(writer.release()); | 446 entry->writer.reset(writer.release()); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 BrowserThread::PostTask( | 726 BrowserThread::PostTask( |
| 726 BrowserThread::FILE, | 727 BrowserThread::FILE, |
| 727 FROM_HERE, | 728 FROM_HERE, |
| 728 base::Bind(&DeleteInputDebugWriterOnFileThread, | 729 base::Bind(&DeleteInputDebugWriterOnFileThread, |
| 729 base::Passed(entry->input_debug_writer.Pass()))); | 730 base::Passed(entry->input_debug_writer.Pass()))); |
| 730 } | 731 } |
| 731 } | 732 } |
| 732 #endif // defined(ENABLE_WEBRTC) | 733 #endif // defined(ENABLE_WEBRTC) |
| 733 | 734 |
| 734 } // namespace content | 735 } // namespace content |
| OLD | NEW |