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

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

Issue 9479012: Merge 123292 - Increase the buffer size in AudioRendererImpl to fix muted playback rate (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 10 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "content/browser/renderer_host/media/audio_common.h"
12 #include "content/browser/renderer_host/media/audio_sync_reader.h" 11 #include "content/browser/renderer_host/media/audio_sync_reader.h"
13 #include "content/browser/renderer_host/media/media_observer.h" 12 #include "content/browser/renderer_host/media/media_observer.h"
14 #include "content/browser/resource_context.h" 13 #include "content/browser/resource_context.h"
15 #include "content/common/media/audio_messages.h" 14 #include "content/common/media/audio_messages.h"
16 #include "media/audio/audio_util.h" 15 #include "media/audio/audio_util.h"
17 #include "ipc/ipc_logging.h" 16 #include "ipc/ipc_logging.h"
18 17
19 using content::BrowserMessageFilter; 18 using content::BrowserMessageFilter;
20 using content::BrowserThread; 19 using content::BrowserThread;
21 20
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 231
233 void AudioRendererHost::OnCreateStream( 232 void AudioRendererHost::OnCreateStream(
234 int stream_id, const AudioParameters& params, bool low_latency) { 233 int stream_id, const AudioParameters& params, bool low_latency) {
235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
236 DCHECK(LookupById(stream_id) == NULL); 235 DCHECK(LookupById(stream_id) == NULL);
237 236
238 AudioParameters audio_params(params); 237 AudioParameters audio_params(params);
239 238
240 // Select the hardware packet size if not specified. 239 // Select the hardware packet size if not specified.
241 if (!audio_params.samples_per_packet) { 240 if (!audio_params.samples_per_packet) {
242 audio_params.samples_per_packet = SelectSamplesPerPacket(audio_params); 241 audio_params.samples_per_packet =
242 media::SelectSamplesPerPacket(audio_params.sample_rate);
243 } 243 }
244 uint32 packet_size = audio_params.GetPacketSize(); 244 uint32 packet_size = audio_params.GetPacketSize();
245 245
246 scoped_ptr<AudioEntry> entry(new AudioEntry()); 246 scoped_ptr<AudioEntry> entry(new AudioEntry());
247 // Create the shared memory and share with the renderer process. 247 // Create the shared memory and share with the renderer process.
248 uint32 shared_memory_size = packet_size; 248 uint32 shared_memory_size = packet_size;
249 if (low_latency) { 249 if (low_latency) {
250 shared_memory_size = 250 shared_memory_size =
251 media::TotalSharedMemorySizeInBytes(shared_memory_size); 251 media::TotalSharedMemorySizeInBytes(shared_memory_size);
252 } 252 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 return NULL; 466 return NULL;
467 } 467 }
468 468
469 MediaObserver* AudioRendererHost::media_observer() { 469 MediaObserver* AudioRendererHost::media_observer() {
470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
471 if (!media_observer_) 471 if (!media_observer_)
472 media_observer_ = resource_context_->media_observer(); 472 media_observer_ = resource_context_->media_observer();
473 return media_observer_; 473 return media_observer_;
474 } 474 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_input_renderer_host.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698