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

Side by Side Diff: content/renderer/media/audio_renderer_mixer_manager.cc

Issue 15957002: Allow sample rate pass through on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | media/audio/pulse/audio_manager_pulse.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/media/audio_renderer_mixer_manager.h" 5 #include "content/renderer/media/audio_renderer_mixer_manager.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 "content/renderer/media/audio_device_factory.h" 9 #include "content/renderer/media/audio_device_factory.h"
10 #include "media/audio/audio_output_device.h" 10 #include "media/audio/audio_output_device.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const media::AudioParameters& params) { 45 const media::AudioParameters& params) {
46 const MixerKey key(source_render_view_id, params); 46 const MixerKey key(source_render_view_id, params);
47 base::AutoLock auto_lock(mixers_lock_); 47 base::AutoLock auto_lock(mixers_lock_);
48 48
49 AudioRendererMixerMap::iterator it = mixers_.find(key); 49 AudioRendererMixerMap::iterator it = mixers_.find(key);
50 if (it != mixers_.end()) { 50 if (it != mixers_.end()) {
51 it->second.ref_count++; 51 it->second.ref_count++;
52 return it->second.mixer; 52 return it->second.mixer;
53 } 53 }
54 54
55 // On ChromeOS we can rely on the playback device to handle resampling, so 55 // On ChromeOS and Linux we can rely on the playback device to handle
56 // don't waste cycles on it here. 56 // resampling, so don't waste cycles on it here.
57 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
58 int sample_rate = params.sample_rate(); 58 int sample_rate = params.sample_rate();
59 #else 59 #else
60 int sample_rate = hardware_config_->GetOutputSampleRate(); 60 int sample_rate = hardware_config_->GetOutputSampleRate();
61 #endif 61 #endif
62 62
63 // Create output parameters based on the audio hardware configuration for 63 // Create output parameters based on the audio hardware configuration for
64 // passing on to the output sink. Force to 16-bit output for now since we 64 // passing on to the output sink. Force to 16-bit output for now since we
65 // know that works well for WebAudio and WebRTC. 65 // know that works well for WebAudio and WebRTC.
66 media::AudioParameters output_params( 66 media::AudioParameters output_params(
67 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, params.channel_layout(), 67 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, params.channel_layout(),
(...skipping 30 matching lines...) Expand all
98 98
99 // Only remove the mixer if AudioRendererMixerManager is the last owner. 99 // Only remove the mixer if AudioRendererMixerManager is the last owner.
100 it->second.ref_count--; 100 it->second.ref_count--;
101 if (it->second.ref_count == 0) { 101 if (it->second.ref_count == 0) {
102 delete it->second.mixer; 102 delete it->second.mixer;
103 mixers_.erase(it); 103 mixers_.erase(it);
104 } 104 }
105 } 105 }
106 106
107 } // namespace content 107 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/audio/pulse/audio_manager_pulse.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698