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

Side by Side Diff: media/audio/pulse/pulse_util.cc

Issue 1892433002: Moving device description utils from AudioManager[Base] into AudioDeviceDescription; to be shared b… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 4 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
« no previous file with comments | « media/audio/pulse/pulse_output.cc ('k') | media/audio/win/audio_low_latency_input_win.h » ('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 "media/audio/pulse/pulse_util.h" 5 #include "media/audio/pulse/pulse_util.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "media/audio/audio_manager_base.h" 12 #include "media/audio/audio_device_description.h"
13 #include "media/base/audio_parameters.h" 13 #include "media/base/audio_parameters.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 namespace pulse { 17 namespace pulse {
18 18
19 namespace { 19 namespace {
20 20
21 #if defined(GOOGLE_CHROME_BUILD) 21 #if defined(GOOGLE_CHROME_BUILD)
22 static const char kBrowserDisplayName[] = "google-chrome"; 22 static const char kBrowserDisplayName[] = "google-chrome";
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 bool CreateInputStream(pa_threaded_mainloop* mainloop, 164 bool CreateInputStream(pa_threaded_mainloop* mainloop,
165 pa_context* context, 165 pa_context* context,
166 pa_stream** stream, 166 pa_stream** stream,
167 const AudioParameters& params, 167 const AudioParameters& params,
168 const std::string& device_id, 168 const std::string& device_id,
169 pa_stream_notify_cb_t stream_callback, 169 pa_stream_notify_cb_t stream_callback,
170 void* user_data) { 170 void* user_data) {
171 DCHECK(mainloop); 171 DCHECK(mainloop);
172 DCHECK(context); 172 DCHECK(context);
173 DCHECK_NE(device_id, AudioManagerBase::kDefaultDeviceId); 173 DCHECK_NE(device_id, AudioDeviceDescription::kDefaultDeviceId);
174 174
175 // Set sample specifications. 175 // Set sample specifications.
176 pa_sample_spec sample_specifications; 176 pa_sample_spec sample_specifications;
177 sample_specifications.format = BitsToPASampleFormat( 177 sample_specifications.format = BitsToPASampleFormat(
178 params.bits_per_sample()); 178 params.bits_per_sample());
179 sample_specifications.rate = params.sample_rate(); 179 sample_specifications.rate = params.sample_rate();
180 sample_specifications.channels = params.channels(); 180 sample_specifications.channels = params.channels();
181 181
182 // Get channel mapping and open recording stream. 182 // Get channel mapping and open recording stream.
183 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap( 183 pa_channel_map source_channel_map = ChannelLayoutToPAChannelMap(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 pa_context* context, 233 pa_context* context,
234 pa_stream** stream, 234 pa_stream** stream,
235 const AudioParameters& params, 235 const AudioParameters& params,
236 const std::string& device_id, 236 const std::string& device_id,
237 const std::string& app_name, 237 const std::string& app_name,
238 pa_stream_notify_cb_t stream_callback, 238 pa_stream_notify_cb_t stream_callback,
239 pa_stream_request_cb_t write_callback, 239 pa_stream_request_cb_t write_callback,
240 void* user_data) { 240 void* user_data) {
241 DCHECK(mainloop); 241 DCHECK(mainloop);
242 DCHECK(context); 242 DCHECK(context);
243 DCHECK(device_id != AudioManagerBase::kDefaultDeviceId); 243 DCHECK(device_id != AudioDeviceDescription::kDefaultDeviceId);
244 244
245 // Set sample specifications. 245 // Set sample specifications.
246 pa_sample_spec sample_specifications; 246 pa_sample_spec sample_specifications;
247 sample_specifications.format = BitsToPASampleFormat( 247 sample_specifications.format = BitsToPASampleFormat(
248 params.bits_per_sample()); 248 params.bits_per_sample());
249 sample_specifications.rate = params.sample_rate(); 249 sample_specifications.rate = params.sample_rate();
250 sample_specifications.channels = params.channels(); 250 sample_specifications.channels = params.channels();
251 251
252 // Get channel mapping. 252 // Get channel mapping.
253 pa_channel_map* map = NULL; 253 pa_channel_map* map = NULL;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 316
317 return true; 317 return true;
318 } 318 }
319 319
320 #undef RETURN_ON_FAILURE 320 #undef RETURN_ON_FAILURE
321 321
322 } // namespace pulse 322 } // namespace pulse
323 323
324 } // namespace media 324 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/pulse/pulse_output.cc ('k') | media/audio/win/audio_low_latency_input_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698