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

Side by Side Diff: media/audio/pulse/pulse_input.h

Issue 1711823004: Let default device in PulseAudio be the system default device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | media/audio/pulse/pulse_input.cc » ('j') | media/audio/pulse/pulse_input.cc » ('J')
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 #ifndef MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ 5 #ifndef MEDIA_AUDIO_PULSE_PULSE_INPUT_H_
6 #define MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ 6 #define MEDIA_AUDIO_PULSE_PULSE_INPUT_H_
7 7
8 #include <pulse/pulseaudio.h> 8 #include <pulse/pulseaudio.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "media/audio/agc_audio_stream.h" 14 #include "media/audio/agc_audio_stream.h"
15 #include "media/audio/audio_device_name.h" 15 #include "media/audio/audio_device_name.h"
16 #include "media/audio/audio_io.h" 16 #include "media/audio/audio_io.h"
17 #include "media/audio/audio_parameters.h" 17 #include "media/audio/audio_parameters.h"
18 #include "media/audio/pulse/pulse_util.h"
Henrik Grunell 2016/03/07 11:37:17 Is this needed?
rchtara 2016/03/08 17:28:16 Done.
18 #include "media/base/audio_block_fifo.h" 19 #include "media/base/audio_block_fifo.h"
19 20
20 namespace media { 21 namespace media {
21 22
22 class AudioManagerPulse; 23 class AudioManagerPulse;
23 24
24 class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> { 25 class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> {
25 public: 26 public:
26 PulseAudioInputStream(AudioManagerPulse* audio_manager, 27 PulseAudioInputStream(AudioManagerPulse* audio_manager,
27 const std::string& device_name, 28 const std::string& device_name,
(...skipping 17 matching lines...) Expand all
45 // PulseAudio Callbacks. 46 // PulseAudio Callbacks.
46 static void ReadCallback(pa_stream* handle, size_t length, void* user_data); 47 static void ReadCallback(pa_stream* handle, size_t length, void* user_data);
47 static void StreamNotifyCallback(pa_stream* stream, void* user_data); 48 static void StreamNotifyCallback(pa_stream* stream, void* user_data);
48 static void VolumeCallback(pa_context* context, const pa_source_info* info, 49 static void VolumeCallback(pa_context* context, const pa_source_info* info,
49 int error, void* user_data); 50 int error, void* user_data);
50 static void MuteCallback(pa_context* context, 51 static void MuteCallback(pa_context* context,
51 const pa_source_info* info, 52 const pa_source_info* info,
52 int error, 53 int error,
53 void* user_data); 54 void* user_data);
54 55
56 // pa_context_get_server_info callback. It's used by
57 // UseSystemDefaultInputDevice to set |device_name_| to the
58 // default system input device.
59 static void UseSystemDefaultInputDeviceCallback(pa_context* context,
60 const pa_server_info* info,
61 void* user_data);
62
63 // Use default system input device for the input stream.
64 void UseSystemDefaultInputDevice();
65
55 // Helper for the ReadCallback. 66 // Helper for the ReadCallback.
56 void ReadData(); 67 void ReadData();
57 68
58 // Utility method used by GetVolume() and IsMuted(). 69 // Utility method used by GetVolume() and IsMuted().
59 bool GetSourceInformation(pa_source_info_cb_t callback); 70 bool GetSourceInformation(pa_source_info_cb_t callback);
60 71
61 AudioManagerPulse* audio_manager_; 72 AudioManagerPulse* audio_manager_;
62 AudioInputCallback* callback_; 73 AudioInputCallback* callback_;
63 std::string device_name_; 74 std::string device_name_;
Henrik Grunell 2016/03/07 11:37:17 Change this to const.
rchtara 2016/03/08 17:28:16 Done.
64 AudioParameters params_; 75 AudioParameters params_;
65 int channels_; 76 int channels_;
66 double volume_; 77 double volume_;
67 bool stream_started_; 78 bool stream_started_;
68 79
69 // Set to true in IsMuted() if user has muted the selected microphone in the 80 // Set to true in IsMuted() if user has muted the selected microphone in the
70 // sound settings UI. 81 // sound settings UI.
71 bool muted_; 82 bool muted_;
72 83
73 // Holds the data from the OS. 84 // Holds the data from the OS.
74 AudioBlockFifo fifo_; 85 AudioBlockFifo fifo_;
75 86
76 // PulseAudio API structs. 87 // PulseAudio API structs.
77 pa_threaded_mainloop* pa_mainloop_; // Weak. 88 pa_threaded_mainloop* pa_mainloop_; // Weak.
78 pa_context* pa_context_; // Weak. 89 pa_context* pa_context_; // Weak.
79 pa_stream* handle_; 90 pa_stream* handle_;
80 91
81 base::ThreadChecker thread_checker_; 92 base::ThreadChecker thread_checker_;
82 93
83 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); 94 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream);
84 }; 95 };
85 96
86 } // namespace media 97 } // namespace media
87 98
88 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ 99 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/pulse/pulse_input.cc » ('j') | media/audio/pulse/pulse_input.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698