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