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

Side by Side 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: moved the pulse code to AudioManagerPulse, and addressed Dale's 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_AUDIO_PULSE_PULSE_UTIL_H_
6 #define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_
7
8 #include <pulse/pulseaudio.h>
9
10 #include "base/basictypes.h"
11 #include "media/audio/audio_device_name.h"
12 #include "media/base/channel_layout.h"
13
14 namespace media {
15
16 // A helper class that acquires pa_threaded_mainloop_lock() while in scope.
17 class AutoPulseLock {
18 public:
19 explicit AutoPulseLock(pa_threaded_mainloop* pa_mainloop)
20 : pa_mainloop_(pa_mainloop) {
21 pa_threaded_mainloop_lock(pa_mainloop_);
22 }
23
24 ~AutoPulseLock() {
25 pa_threaded_mainloop_unlock(pa_mainloop_);
26 }
27
28 private:
29 pa_threaded_mainloop* pa_mainloop_;
30 DISALLOW_COPY_AND_ASSIGN(AutoPulseLock);
31 };
32
33 // Triggers pa_threaded_mainloop_signal() to avoid deadlocks.
34 void StreamSuccessCallback(pa_stream* s, int error, void* mainloop);
35
36 // Triggers pa_threaded_mainloop_signal() to avoid deadlocks.
37 void ContextStateCallback(pa_context* context, void* user_data);
38
39 pa_sample_format_t BitsToPASampleFormat(int bits_per_sample);
40
41 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout);
42
43 void WaitForOperationCompletion(pa_threaded_mainloop* pa_mainloop,
44 pa_operation* operation);
45
46 int GetHardwareLatencyInBytes(pa_stream* stream,
47 int sample_rate,
48 int bytes_per_frame);
49
50 } // namespace media
51
52 #endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698