Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host.cc

Issue 1538563002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fix. git cl format. Rebase. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/media/capture/web_contents_audio_muter.cc ('k') | content/browser/renderer_host/media/audio_sync_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698