| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 const std::string& device_unique_id) { | 516 const std::string& device_unique_id) { |
| 517 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 517 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 518 | 518 |
| 519 // media::AudioParameters is validated in the deserializer. | 519 // media::AudioParameters is validated in the deserializer. |
| 520 if (LookupById(stream_id) != NULL) { | 520 if (LookupById(stream_id) != NULL) { |
| 521 SendErrorMessage(stream_id); | 521 SendErrorMessage(stream_id); |
| 522 return; | 522 return; |
| 523 } | 523 } |
| 524 | 524 |
| 525 // Create the shared memory and share with the renderer process. | 525 // Create the shared memory and share with the renderer process. |
| 526 uint32 shared_memory_size = AudioBus::CalculateMemorySize(params); | 526 uint32 shared_memory_size = sizeof(AudioOutputBufferParameters) + |
| 527 AudioBus::CalculateMemorySize(params); |
| 527 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 528 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
| 528 if (!shared_memory->CreateAndMapAnonymous(shared_memory_size)) { | 529 if (!shared_memory->CreateAndMapAnonymous(shared_memory_size)) { |
| 529 SendErrorMessage(stream_id); | 530 SendErrorMessage(stream_id); |
| 530 return; | 531 return; |
| 531 } | 532 } |
| 532 | 533 |
| 533 scoped_ptr<AudioSyncReader> reader( | 534 scoped_ptr<AudioSyncReader> reader( |
| 534 new AudioSyncReader(shared_memory.get(), params)); | 535 new AudioSyncReader(shared_memory.get(), params)); |
| 535 if (!reader->Init()) { | 536 if (!reader->Init()) { |
| 536 SendErrorMessage(stream_id); | 537 SendErrorMessage(stream_id); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 callback.Run(false, device_info); | 792 callback.Run(false, device_info); |
| 792 } | 793 } |
| 793 | 794 |
| 794 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 795 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
| 795 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 796 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 796 const auto& i = authorizations_.find(stream_id); | 797 const auto& i = authorizations_.find(stream_id); |
| 797 return i != authorizations_.end(); | 798 return i != authorizations_.end(); |
| 798 } | 799 } |
| 799 | 800 |
| 800 } // namespace content | 801 } // namespace content |
| OLD | NEW |