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

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

Issue 1998173002: Use "application default" audio device as default PulseAudio device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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 | « no previous file | media/audio/pulse/pulse_input.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 #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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // PulseAudio Callbacks. 45 // PulseAudio Callbacks.
46 static void ReadCallback(pa_stream* handle, size_t length, void* user_data); 46 static void ReadCallback(pa_stream* handle, size_t length, void* user_data);
47 static void StreamNotifyCallback(pa_stream* stream, void* user_data); 47 static void StreamNotifyCallback(pa_stream* stream, void* user_data);
48 static void VolumeCallback(pa_context* context, const pa_source_info* info, 48 static void VolumeCallback(pa_context* context, const pa_source_info* info,
49 int error, void* user_data); 49 int error, void* user_data);
50 static void MuteCallback(pa_context* context, 50 static void MuteCallback(pa_context* context,
51 const pa_source_info* info, 51 const pa_source_info* info,
52 int error, 52 int error,
53 void* user_data); 53 void* user_data);
54 54
55 // pa_context_get_server_info callback. It's used by
56 // GetSystemDefaultInputDevice to set |default_system_device_name_| to the
57 // default system input device.
58 static void GetSystemDefaultInputDeviceCallback(pa_context* context,
59 const pa_server_info* info,
60 void* user_data);
61
62 // Get default system input device for the input stream.
63 void GetSystemDefaultInputDevice();
64
65 // Helper for the ReadCallback. 55 // Helper for the ReadCallback.
66 void ReadData(); 56 void ReadData();
67 57
68 // Utility method used by GetVolume() and IsMuted(). 58 // Utility method used by GetVolume() and IsMuted().
69 bool GetSourceInformation(pa_source_info_cb_t callback); 59 bool GetSourceInformation(pa_source_info_cb_t callback);
70 60
71 AudioManagerPulse* audio_manager_; 61 AudioManagerPulse* audio_manager_;
72 AudioInputCallback* callback_; 62 AudioInputCallback* callback_;
73 const std::string device_name_; 63 std::string device_name_;
74 // The name of the system default device. Set by
75 // GetSystemDefaultInputDeviceCallback if |device_name_| is set to be the
76 // default device.
77 std::string default_system_device_name_;
78
79 AudioParameters params_; 64 AudioParameters params_;
80 int channels_; 65 int channels_;
81 double volume_; 66 double volume_;
82 bool stream_started_; 67 bool stream_started_;
83 68
84 // Set to true in IsMuted() if user has muted the selected microphone in the 69 // Set to true in IsMuted() if user has muted the selected microphone in the
85 // sound settings UI. 70 // sound settings UI.
86 bool muted_; 71 bool muted_;
87 72
88 // Holds the data from the OS. 73 // Holds the data from the OS.
89 AudioBlockFifo fifo_; 74 AudioBlockFifo fifo_;
90 75
91 // PulseAudio API structs. 76 // PulseAudio API structs.
92 pa_threaded_mainloop* pa_mainloop_; // Weak. 77 pa_threaded_mainloop* pa_mainloop_; // Weak.
93 pa_context* pa_context_; // Weak. 78 pa_context* pa_context_; // Weak.
94 pa_stream* handle_; 79 pa_stream* handle_;
95 80
96 base::ThreadChecker thread_checker_; 81 base::ThreadChecker thread_checker_;
97 82
98 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); 83 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream);
99 }; 84 };
100 85
101 } // namespace media 86 } // namespace media
102 87
103 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ 88 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/pulse/pulse_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698