Index: media/audio/pulse/pulse_util.h |
diff --git a/media/audio/pulse/pulse_util.h b/media/audio/pulse/pulse_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5df4c0336b28a5641dd9ca08523f104b7086928d |
--- /dev/null |
+++ b/media/audio/pulse/pulse_util.h |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
+#define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
+ |
+#include <pulse/pulseaudio.h> |
+ |
+#include "base/basictypes.h" |
+#include "media/audio/audio_device_name.h" |
+#include "media/base/channel_layout.h" |
+ |
+namespace media { |
+ |
DaleCurtis
2013/02/20 00:17:38
WDYT about putting these in a pulse sub-namespace
no longer working on chromium
2013/02/20 14:43:38
Done with adding the media::pulse namespace
|
+// A helper class that acquires pa_threaded_mainloop_lock() while in scope. |
+class AutoPulseLock { |
DaleCurtis
2013/02/20 00:17:38
Just inline the implementation like base/lock.h
no longer working on chromium
2013/02/20 14:43:38
Done.
|
+ public: |
+ explicit AutoPulseLock(pa_threaded_mainloop* pa_mainloop); |
+ ~AutoPulseLock(); |
+ |
+ private: |
+ pa_threaded_mainloop* pa_mainloop_; |
+ DISALLOW_COPY_AND_ASSIGN(AutoPulseLock); |
+}; |
+ |
+// Triggers pa_threaded_mainloop_signal() to avoid deadlocks. |
+void StreamSuccessCallback(pa_stream* s, int error, void* mainloop); |
+void ContextStateCallback(pa_context* context, void* mainloop); |
+ |
+pa_sample_format_t BitsToPASampleFormat(int bits_per_sample); |
+ |
+pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout); |
+ |
+void WaitForOperationCompletion(pa_threaded_mainloop* pa_mainloop, |
+ pa_operation* operation); |
+ |
+int GetHardwareLatencyInBytes(pa_stream* stream, |
+ int sample_rate, |
+ int bytes_per_frame); |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |