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

Unified Diff: media/audio/pulse/pulse_util.h

Issue 10952024: Adding pulseaudio input support to chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased and addressed Dale's final comments. Created 7 years, 10 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_stub_header.fragment ('k') | media/audio/pulse/pulse_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6443f3c571b0636b5575a1282dce36692a1cb1a1
--- /dev/null
+++ b/media/audio/pulse/pulse_util.h
@@ -0,0 +1,54 @@
+// 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 {
+
+namespace pulse {
+
+// A helper class that acquires pa_threaded_mainloop_lock() while in scope.
+class AutoPulseLock {
+ public:
+ explicit AutoPulseLock(pa_threaded_mainloop* pa_mainloop)
+ : pa_mainloop_(pa_mainloop) {
+ pa_threaded_mainloop_lock(pa_mainloop_);
+ }
+
+ ~AutoPulseLock() {
+ pa_threaded_mainloop_unlock(pa_mainloop_);
+ }
+
+ 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 pulse
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_
« no previous file with comments | « media/audio/pulse/pulse_stub_header.fragment ('k') | media/audio/pulse/pulse_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698