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

Unified Diff: media/audio/pulse/pulse_output.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/pulse/pulse_input.cc ('k') | media/audio/pulse/pulse_output.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/pulse/pulse_output.h
diff --git a/media/audio/pulse/pulse_output.h b/media/audio/pulse/pulse_output.h
index ce9a58914ece8af79409b0c537605e650d59060c..49f6abf28d1106789ab452cf21bffa65a4d0725c 100644
--- a/media/audio/pulse/pulse_output.h
+++ b/media/audio/pulse/pulse_output.h
@@ -20,6 +20,7 @@
#ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_
#define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_
+#include <pulse/pulseaudio.h>
#include <stddef.h>
#include <string>
@@ -63,6 +64,20 @@ class PulseAudioOutputStream : public AudioOutputStream {
// Called by PulseAudio when it needs more audio data.
static void StreamRequestCallback(pa_stream* s, size_t len, void* p_this);
+ // pa_context_get_server_info callback. It's used by
+ // GetSystemDefaultOutputDevice to set |default_system_device_name_| to the
+ // default system output device.
+ static void GetSystemDefaultOutputDeviceCallback(pa_context* context,
+ const pa_server_info* info,
+ void* user_data);
+
+ // Initialize |pa_mainloop_| and |pa_context_| and prepare them for creating
+ // an output stream.
+ bool InitializeMainloopAndContext();
+
+ // Get default system output device for the output stream.
+ void GetSystemDefaultOutputDevice();
+
// Fulfill a write request from the write request callback. Outputs silence
// if the request could not be fulfilled.
void FulfillWriteRequest(size_t requested_bytes);
@@ -75,6 +90,10 @@ class PulseAudioOutputStream : public AudioOutputStream {
// The device ID for the device to open.
const std::string device_id_;
+ // The name of the system default device. Set by
+ // GetSystemDefaultOutputDeviceCallback if |device_id_| is set to be the
+ // default device.
+ std::string default_system_device_name_;
// Audio manager that created us. Used to report that we've closed.
AudioManagerBase* manager_;
« no previous file with comments | « media/audio/pulse/pulse_input.cc ('k') | media/audio/pulse/pulse_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698