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_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 const std::string& device_unique_id) { | 562 const std::string& device_unique_id) { |
563 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 563 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
564 | 564 |
565 // media::AudioParameters is validated in the deserializer. | 565 // media::AudioParameters is validated in the deserializer. |
566 if (LookupById(stream_id) != NULL) { | 566 if (LookupById(stream_id) != NULL) { |
567 SendErrorMessage(stream_id); | 567 SendErrorMessage(stream_id); |
568 return; | 568 return; |
569 } | 569 } |
570 | 570 |
571 // Create the shared memory and share with the renderer process. | 571 // Create the shared memory and share with the renderer process. |
572 uint32 shared_memory_size = AudioBus::CalculateMemorySize(params); | 572 uint32 shared_memory_size = sizeof(media::AudioOutputBufferParameters) + |
| 573 AudioBus::CalculateMemorySize(params); |
573 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 574 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
574 if (!shared_memory->CreateAndMapAnonymous(shared_memory_size)) { | 575 if (!shared_memory->CreateAndMapAnonymous(shared_memory_size)) { |
575 SendErrorMessage(stream_id); | 576 SendErrorMessage(stream_id); |
576 return; | 577 return; |
577 } | 578 } |
578 | 579 |
579 scoped_ptr<AudioSyncReader> reader( | 580 scoped_ptr<AudioSyncReader> reader( |
580 new AudioSyncReader(shared_memory.get(), params)); | 581 new AudioSyncReader(shared_memory.get(), params)); |
581 if (!reader->Init()) { | 582 if (!reader->Init()) { |
582 SendErrorMessage(stream_id); | 583 SendErrorMessage(stream_id); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 callback.Run(false, device_info); | 840 callback.Run(false, device_info); |
840 } | 841 } |
841 | 842 |
842 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 843 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
843 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 844 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
844 const auto& i = authorizations_.find(stream_id); | 845 const auto& i = authorizations_.find(stream_id); |
845 return i != authorizations_.end(); | 846 return i != authorizations_.end(); |
846 } | 847 } |
847 | 848 |
848 } // namespace content | 849 } // namespace content |
OLD | NEW |