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

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

Issue 1487983002: 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: Fix in Windows unit test. 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 const std::string& device_unique_id) { 531 const std::string& device_unique_id) {
532 DCHECK_CURRENTLY_ON(BrowserThread::IO); 532 DCHECK_CURRENTLY_ON(BrowserThread::IO);
533 533
534 // media::AudioParameters is validated in the deserializer. 534 // media::AudioParameters is validated in the deserializer.
535 if (LookupById(stream_id) != NULL) { 535 if (LookupById(stream_id) != NULL) {
536 SendErrorMessage(stream_id); 536 SendErrorMessage(stream_id);
537 return; 537 return;
538 } 538 }
539 539
540 // Create the shared memory and share with the renderer process. 540 // Create the shared memory and share with the renderer process.
541 uint32 shared_memory_size = AudioBus::CalculateMemorySize(params); 541 uint32 shared_memory_size = sizeof(media::AudioOutputBufferParameters) +
542 AudioBus::CalculateMemorySize(params);
542 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); 543 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
543 if (!shared_memory->CreateAndMapAnonymous(shared_memory_size)) { 544 if (!shared_memory->CreateAndMapAnonymous(shared_memory_size)) {
544 SendErrorMessage(stream_id); 545 SendErrorMessage(stream_id);
545 return; 546 return;
546 } 547 }
547 548
548 scoped_ptr<AudioSyncReader> reader( 549 scoped_ptr<AudioSyncReader> reader(
549 new AudioSyncReader(shared_memory.get(), params)); 550 new AudioSyncReader(shared_memory.get(), params));
550 if (!reader->Init()) { 551 if (!reader->Init()) {
551 SendErrorMessage(stream_id); 552 SendErrorMessage(stream_id);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 callback.Run(false, device_info); 809 callback.Run(false, device_info);
809 } 810 }
810 811
811 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { 812 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) {
812 DCHECK_CURRENTLY_ON(BrowserThread::IO); 813 DCHECK_CURRENTLY_ON(BrowserThread::IO);
813 const auto& i = authorizations_.find(stream_id); 814 const auto& i = authorizations_.find(stream_id);
814 return i != authorizations_.end(); 815 return i != authorizations_.end();
815 } 816 }
816 817
817 } // namespace content 818 } // 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