Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |device_name_| to the | |
|
Henrik Grunell
2016/03/09 00:49:17
|device_name_| -> |system_device_name_|
rchtara
2016/03/09 16:16:09
Done.
| |
| 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 | |
|
Henrik Grunell
2016/03/09 00:49:17
Nit: Add "." in end.
rchtara
2016/03/09 16:16:09
Done.
| |
| 63 void GetSystemDefaultInputDevice(); | |
| 64 | |
| 55 // Helper for the ReadCallback. | 65 // Helper for the ReadCallback. |
| 56 void ReadData(); | 66 void ReadData(); |
| 57 | 67 |
| 58 // Utility method used by GetVolume() and IsMuted(). | 68 // Utility method used by GetVolume() and IsMuted(). |
| 59 bool GetSourceInformation(pa_source_info_cb_t callback); | 69 bool GetSourceInformation(pa_source_info_cb_t callback); |
| 60 | 70 |
| 61 AudioManagerPulse* audio_manager_; | 71 AudioManagerPulse* audio_manager_; |
| 62 AudioInputCallback* callback_; | 72 AudioInputCallback* callback_; |
| 63 std::string device_name_; | 73 const std::string device_name_; |
| 74 // The name of the system default device. Returned | |
|
Henrik Grunell
2016/03/09 00:49:17
Change "Returned" -> "Set". Also add that it's set
rchtara
2016/03/09 16:16:09
Done.
| |
| 75 // by GetSystemDefaultOutputDeviceCallback. | |
|
Henrik Grunell
2016/03/09 00:49:17
Nit: "by" fits on first line.
rchtara
2016/03/09 16:16:09
Done.
| |
| 76 std::string default_system_device_name_; | |
| 64 AudioParameters params_; | 77 AudioParameters params_; |
|
Henrik Grunell
2016/03/09 00:49:17
Empty line before params.
rchtara
2016/03/09 16:16:09
Done.
| |
| 65 int channels_; | 78 int channels_; |
| 66 double volume_; | 79 double volume_; |
| 67 bool stream_started_; | 80 bool stream_started_; |
| 68 | 81 |
| 69 // Set to true in IsMuted() if user has muted the selected microphone in the | 82 // Set to true in IsMuted() if user has muted the selected microphone in the |
| 70 // sound settings UI. | 83 // sound settings UI. |
| 71 bool muted_; | 84 bool muted_; |
| 72 | 85 |
| 73 // Holds the data from the OS. | 86 // Holds the data from the OS. |
| 74 AudioBlockFifo fifo_; | 87 AudioBlockFifo fifo_; |
| 75 | 88 |
| 76 // PulseAudio API structs. | 89 // PulseAudio API structs. |
| 77 pa_threaded_mainloop* pa_mainloop_; // Weak. | 90 pa_threaded_mainloop* pa_mainloop_; // Weak. |
| 78 pa_context* pa_context_; // Weak. | 91 pa_context* pa_context_; // Weak. |
| 79 pa_stream* handle_; | 92 pa_stream* handle_; |
| 80 | 93 |
| 81 base::ThreadChecker thread_checker_; | 94 base::ThreadChecker thread_checker_; |
| 82 | 95 |
| 83 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); | 96 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); |
| 84 }; | 97 }; |
| 85 | 98 |
| 86 } // namespace media | 99 } // namespace media |
| 87 | 100 |
| 88 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ | 101 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ |
| OLD | NEW |