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_UTIL_H_ | 5 #ifndef MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
6 #define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | 6 #define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
7 | 7 |
8 #include <pulse/pulseaudio.h> | 8 #include <pulse/pulseaudio.h> |
9 | 9 |
| 10 #include <string> |
| 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/time/time.h" |
11 #include "media/audio/audio_device_name.h" | 14 #include "media/audio/audio_device_name.h" |
12 #include "media/base/channel_layout.h" | 15 #include "media/base/channel_layout.h" |
13 | 16 |
14 namespace media { | 17 namespace media { |
15 | 18 |
16 class AudioParameters; | 19 class AudioParameters; |
17 | 20 |
18 namespace pulse { | 21 namespace pulse { |
19 | 22 |
20 // A helper class that acquires pa_threaded_mainloop_lock() while in scope. | 23 // A helper class that acquires pa_threaded_mainloop_lock() while in scope. |
(...skipping 17 matching lines...) Expand all Loading... |
38 void StreamSuccessCallback(pa_stream* s, int error, void* mainloop); | 41 void StreamSuccessCallback(pa_stream* s, int error, void* mainloop); |
39 void ContextStateCallback(pa_context* context, void* mainloop); | 42 void ContextStateCallback(pa_context* context, void* mainloop); |
40 | 43 |
41 pa_sample_format_t BitsToPASampleFormat(int bits_per_sample); | 44 pa_sample_format_t BitsToPASampleFormat(int bits_per_sample); |
42 | 45 |
43 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout); | 46 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout); |
44 | 47 |
45 void WaitForOperationCompletion(pa_threaded_mainloop* mainloop, | 48 void WaitForOperationCompletion(pa_threaded_mainloop* mainloop, |
46 pa_operation* operation); | 49 pa_operation* operation); |
47 | 50 |
| 51 base::TimeDelta GetHardwareLatency(pa_stream* stream); |
| 52 |
48 int GetHardwareLatencyInBytes(pa_stream* stream, | 53 int GetHardwareLatencyInBytes(pa_stream* stream, |
49 int sample_rate, | 54 int sample_rate, |
50 int bytes_per_frame); | 55 int bytes_per_frame); |
51 | 56 |
52 // Create a recording stream for the threaded mainloop, return true if success, | 57 // Create a recording stream for the threaded mainloop, return true if success, |
53 // otherwise false. |mainloop| and |context| have to be from a valid Pulse | 58 // otherwise false. |mainloop| and |context| have to be from a valid Pulse |
54 // threaded mainloop and the handle of the created stream will be returned by | 59 // threaded mainloop and the handle of the created stream will be returned by |
55 // |stream|. | 60 // |stream|. |
56 bool CreateInputStream(pa_threaded_mainloop* mainloop, | 61 bool CreateInputStream(pa_threaded_mainloop* mainloop, |
57 pa_context* context, | 62 pa_context* context, |
(...skipping 15 matching lines...) Expand all Loading... |
73 const std::string& app_name, | 78 const std::string& app_name, |
74 pa_stream_notify_cb_t stream_callback, | 79 pa_stream_notify_cb_t stream_callback, |
75 pa_stream_request_cb_t write_callback, | 80 pa_stream_request_cb_t write_callback, |
76 void* user_data); | 81 void* user_data); |
77 | 82 |
78 } // namespace pulse | 83 } // namespace pulse |
79 | 84 |
80 } // namespace media | 85 } // namespace media |
81 | 86 |
82 #endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | 87 #endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
OLD | NEW |