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

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: latest 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>
(...skipping 22 matching lines...) Expand all
33 33
34 // Implementation of AudioInputStream. 34 // Implementation of AudioInputStream.
35 bool Open() override; 35 bool Open() override;
36 void Start(AudioInputCallback* callback) override; 36 void Start(AudioInputCallback* callback) override;
37 void Stop() override; 37 void Stop() override;
38 void Close() override; 38 void Close() override;
39 double GetMaxVolume() override; 39 double GetMaxVolume() override;
40 void SetVolume(double volume) override; 40 void SetVolume(double volume) override;
41 double GetVolume() override; 41 double GetVolume() override;
42 bool IsMuted() override; 42 bool IsMuted() override;
43 pa_threaded_mainloop* GetPAMainloop();
Henrik Grunell 2016/03/10 00:57:07 Empty line before since it's not part of AudioInpu
rchtara 2016/03/10 13:20:34 Done.
44 void SetDefaultSystemDeviceName(const std::string& name);
43 45
44 private: 46 private:
45 // PulseAudio Callbacks. 47 // PulseAudio Callbacks.
46 static void ReadCallback(pa_stream* handle, size_t length, void* user_data); 48 static void ReadCallback(pa_stream* handle, size_t length, void* user_data);
47 static void StreamNotifyCallback(pa_stream* stream, void* user_data); 49 static void StreamNotifyCallback(pa_stream* stream, void* user_data);
48 static void VolumeCallback(pa_context* context, const pa_source_info* info, 50 static void VolumeCallback(pa_context* context, const pa_source_info* info,
49 int error, void* user_data); 51 int error, void* user_data);
50 static void MuteCallback(pa_context* context, 52 static void MuteCallback(pa_context* context,
51 const pa_source_info* info, 53 const pa_source_info* info,
52 int error, 54 int error,
53 void* user_data); 55 void* user_data);
54 56
57 // Get default system input device for the input stream.
58 void GetSystemDefaultInputDevice();
59
55 // Helper for the ReadCallback. 60 // Helper for the ReadCallback.
56 void ReadData(); 61 void ReadData();
57 62
58 // Utility method used by GetVolume() and IsMuted(). 63 // Utility method used by GetVolume() and IsMuted().
59 bool GetSourceInformation(pa_source_info_cb_t callback); 64 bool GetSourceInformation(pa_source_info_cb_t callback);
60 65
61 AudioManagerPulse* audio_manager_; 66 AudioManagerPulse* audio_manager_;
62 AudioInputCallback* callback_; 67 AudioInputCallback* callback_;
63 std::string device_name_; 68 const std::string device_name_;
69 // The name of the system default device. Set by
70 // GetSystemDefaultInputDeviceCallback if |device_name_| is set to be the
71 // default device.
72 std::string default_system_device_name_;
73
64 AudioParameters params_; 74 AudioParameters params_;
65 int channels_; 75 int channels_;
66 double volume_; 76 double volume_;
67 bool stream_started_; 77 bool stream_started_;
68 78
69 // Set to true in IsMuted() if user has muted the selected microphone in the 79 // Set to true in IsMuted() if user has muted the selected microphone in the
70 // sound settings UI. 80 // sound settings UI.
71 bool muted_; 81 bool muted_;
72 82
73 // Holds the data from the OS. 83 // Holds the data from the OS.
74 AudioBlockFifo fifo_; 84 AudioBlockFifo fifo_;
75 85
76 // PulseAudio API structs. 86 // PulseAudio API structs.
77 pa_threaded_mainloop* pa_mainloop_; // Weak. 87 pa_threaded_mainloop* pa_mainloop_; // Weak.
78 pa_context* pa_context_; // Weak. 88 pa_context* pa_context_; // Weak.
79 pa_stream* handle_; 89 pa_stream* handle_;
80 90
81 base::ThreadChecker thread_checker_; 91 base::ThreadChecker thread_checker_;
82 92
83 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); 93 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream);
84 }; 94 };
85 95
86 } // namespace media 96 } // namespace media
87 97
88 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ 98 #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