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

Side by Side Diff: media/audio/pulse/pulse_input.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/audio_manager_pulse.cc ('k') | media/audio/pulse/pulse_output.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 "media/audio/pulse/pulse_input.h" 5 #include "media/audio/pulse/pulse_input.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 "media/audio/audio_device_description.h"
10 #include "media/audio/pulse/audio_manager_pulse.h" 11 #include "media/audio/pulse/audio_manager_pulse.h"
11 #include "media/audio/pulse/pulse_util.h" 12 #include "media/audio/pulse/pulse_util.h"
12 13
13 namespace media { 14 namespace media {
14 15
15 using pulse::AutoPulseLock; 16 using pulse::AutoPulseLock;
16 using pulse::WaitForOperationCompletion; 17 using pulse::WaitForOperationCompletion;
17 18
18 // Number of blocks of buffers used in the |fifo_|. 19 // Number of blocks of buffers used in the |fifo_|.
19 const int kNumberOfBlocksBufferInFifo = 2; 20 const int kNumberOfBlocksBufferInFifo = 2;
(...skipping 25 matching lines...) Expand all
45 PulseAudioInputStream::~PulseAudioInputStream() { 46 PulseAudioInputStream::~PulseAudioInputStream() {
46 // All internal structures should already have been freed in Close(), 47 // All internal structures should already have been freed in Close(),
47 // which calls AudioManagerPulse::Release which deletes this object. 48 // which calls AudioManagerPulse::Release which deletes this object.
48 DCHECK(!handle_); 49 DCHECK(!handle_);
49 } 50 }
50 51
51 bool PulseAudioInputStream::Open() { 52 bool PulseAudioInputStream::Open() {
52 DCHECK(thread_checker_.CalledOnValidThread()); 53 DCHECK(thread_checker_.CalledOnValidThread());
53 AutoPulseLock auto_lock(pa_mainloop_); 54 AutoPulseLock auto_lock(pa_mainloop_);
54 std::string device_name_to_use = device_name_; 55 std::string device_name_to_use = device_name_;
55 if (device_name_ == AudioManagerBase::kDefaultDeviceId) { 56 if (device_name_ == AudioDeviceDescription::kDefaultDeviceId) {
56 GetSystemDefaultInputDevice(); 57 GetSystemDefaultInputDevice();
57 device_name_to_use = default_system_device_name_; 58 device_name_to_use = default_system_device_name_;
58 } 59 }
59 60
60 if (!pulse::CreateInputStream(pa_mainloop_, pa_context_, &handle_, params_, 61 if (!pulse::CreateInputStream(pa_mainloop_, pa_context_, &handle_, params_,
61 device_name_to_use, &StreamNotifyCallback, 62 device_name_to_use, &StreamNotifyCallback,
62 this)) { 63 this)) {
63 return false; 64 return false;
64 } 65 }
65 66
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 return false; 354 return false;
354 355
355 size_t index = pa_stream_get_device_index(handle_); 356 size_t index = pa_stream_get_device_index(handle_);
356 pa_operation* operation = 357 pa_operation* operation =
357 pa_context_get_source_info_by_index(pa_context_, index, callback, this); 358 pa_context_get_source_info_by_index(pa_context_, index, callback, this);
358 WaitForOperationCompletion(pa_mainloop_, operation); 359 WaitForOperationCompletion(pa_mainloop_, operation);
359 return true; 360 return true;
360 } 361 }
361 362
362 } // namespace media 363 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/pulse/audio_manager_pulse.cc ('k') | media/audio/pulse/pulse_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698