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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 size *= entry->shared_memory_segment_count; | 302 size *= entry->shared_memory_segment_count; |
303 if (!size.IsValid() || | 303 if (!size.IsValid() || |
304 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { | 304 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { |
305 // If creation of shared memory failed then send an error message. | 305 // If creation of shared memory failed then send an error message. |
306 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); | 306 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); |
307 return; | 307 return; |
308 } | 308 } |
309 | 309 |
310 scoped_ptr<AudioInputSyncWriter> writer( | 310 scoped_ptr<AudioInputSyncWriter> writer( |
311 new AudioInputSyncWriter(&entry->shared_memory, | 311 new AudioInputSyncWriter(&entry->shared_memory, |
312 entry->shared_memory_segment_count)); | 312 entry->shared_memory_segment_count, |
| 313 audio_params)); |
313 | 314 |
314 if (!writer->Init()) { | 315 if (!writer->Init()) { |
315 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 316 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
316 return; | 317 return; |
317 } | 318 } |
318 | 319 |
319 // If we have successfully created the SyncWriter then assign it to the | 320 // If we have successfully created the SyncWriter then assign it to the |
320 // entry and construct an AudioInputController. | 321 // entry and construct an AudioInputController. |
321 entry->writer.reset(writer.release()); | 322 entry->writer.reset(writer.release()); |
322 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { | 323 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // TODO(hclam): Implement a faster look up method. | 465 // TODO(hclam): Implement a faster look up method. |
465 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 466 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
466 i != audio_entries_.end(); ++i) { | 467 i != audio_entries_.end(); ++i) { |
467 if (controller == i->second->controller.get()) | 468 if (controller == i->second->controller.get()) |
468 return i->second; | 469 return i->second; |
469 } | 470 } |
470 return NULL; | 471 return NULL; |
471 } | 472 } |
472 | 473 |
473 } // namespace content | 474 } // namespace content |
OLD | NEW |