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

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

Issue 9416085: Increase the buffer size in AudioRendererImpl to fix muted playback rate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase ToT 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) 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/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/browser_main_loop.h" 11 #include "content/browser/browser_main_loop.h"
12 #include "content/browser/renderer_host/media/audio_common.h"
13 #include "content/browser/renderer_host/media/audio_sync_reader.h" 12 #include "content/browser/renderer_host/media/audio_sync_reader.h"
14 #include "content/browser/renderer_host/media/media_observer.h" 13 #include "content/browser/renderer_host/media/media_observer.h"
15 #include "content/common/media/audio_messages.h" 14 #include "content/common/media/audio_messages.h"
16 #include "content/public/browser/resource_context.h" 15 #include "content/public/browser/resource_context.h"
17 #include "media/audio/audio_util.h" 16 #include "media/audio/audio_util.h"
18 17
19 using content::BrowserMessageFilter; 18 using content::BrowserMessageFilter;
20 using content::BrowserThread; 19 using content::BrowserThread;
21 20
22 AudioRendererHost::AudioEntry::AudioEntry() 21 AudioRendererHost::AudioEntry::AudioEntry()
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 195
197 void AudioRendererHost::OnCreateStream( 196 void AudioRendererHost::OnCreateStream(
198 int stream_id, const AudioParameters& params) { 197 int stream_id, const AudioParameters& params) {
199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
200 DCHECK(LookupById(stream_id) == NULL); 199 DCHECK(LookupById(stream_id) == NULL);
201 200
202 AudioParameters audio_params(params); 201 AudioParameters audio_params(params);
203 202
204 // Select the hardware packet size if not specified. 203 // Select the hardware packet size if not specified.
205 if (!audio_params.samples_per_packet) { 204 if (!audio_params.samples_per_packet) {
206 audio_params.samples_per_packet = SelectSamplesPerPacket(audio_params); 205 audio_params.samples_per_packet =
206 media::SelectSamplesPerPacket(audio_params.sample_rate);
207 } 207 }
208 uint32 packet_size = audio_params.GetPacketSize(); 208 uint32 packet_size = audio_params.GetPacketSize();
209 209
210 scoped_ptr<AudioEntry> entry(new AudioEntry()); 210 scoped_ptr<AudioEntry> entry(new AudioEntry());
211 211
212 // Create the shared memory and share with the renderer process. 212 // Create the shared memory and share with the renderer process.
213 uint32 shared_memory_size = 213 uint32 shared_memory_size =
214 media::TotalSharedMemorySizeInBytes(packet_size); 214 media::TotalSharedMemorySizeInBytes(packet_size);
215 if (!entry->shared_memory.CreateAndMapAnonymous(shared_memory_size)) { 215 if (!entry->shared_memory.CreateAndMapAnonymous(shared_memory_size)) {
216 // If creation of shared memory failed then send an error message. 216 // If creation of shared memory failed then send an error message.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 return NULL; 389 return NULL;
390 } 390 }
391 391
392 MediaObserver* AudioRendererHost::media_observer() { 392 MediaObserver* AudioRendererHost::media_observer() {
393 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 393 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
394 if (!media_observer_) 394 if (!media_observer_)
395 media_observer_ = resource_context_->GetMediaObserver(); 395 media_observer_ = resource_context_->GetMediaObserver();
396 return media_observer_; 396 return media_observer_;
397 } 397 }
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