Index: media/audio/pulse/pulse_output.h |
=================================================================== |
--- media/audio/pulse/pulse_output.h (revision 110923) |
+++ media/audio/pulse/pulse_output.h (working copy) |
@@ -12,9 +12,7 @@ |
// on the same thread that created the object. |
// |
// WARNING: This object blocks on internal PulseAudio calls in Open() while |
-// waiting for PulseAudio's context structure to be ready. It also blocks in |
-// inside PulseAudio in Start() and repeated during playback, waiting for |
-// PulseAudio write callbacks to occur. |
+// waiting for PulseAudio's context structure to be ready. |
#ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
#define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
@@ -62,54 +60,41 @@ |
private: |
// PulseAudio Callbacks. |
- static void ContextStateCallback(pa_context* context, void* state_addr); |
+ static void ContextStateCallback(pa_context* context, void* user_data); |
static void WriteRequestCallback(pa_stream* playback_handle, size_t length, |
- void* stream_addr); |
+ void* user_data); |
- // Iterate the PulseAudio mainloop to get write requests. |
- void WaitForWriteRequest(); |
- |
- // Get another packet from the data source and write it to the client buffer. |
- bool BufferPacketFromSource(); |
- |
- // Fulfill a write request from the write request callback. If the write |
+ // Fulfills a write request from the write request callback. If the write |
// can't be finished a first, post a new attempt to the message loop. |
void FulfillWriteRequest(size_t requested_bytes); |
- // Write data from the client buffer to the PulseAudio stream. |
- void WriteToStream(size_t bytes_to_write, size_t* bytes_written); |
- |
- // API for Proxying calls to the AudioSourceCallback provided during Start(). |
- uint32 RunDataCallback(uint8* dest, uint32 max_size, |
- AudioBuffersState buffers_state); |
- |
// Close() helper function to free internal structs. |
void Reset(); |
// Configuration constants from the constructor. Referencable by all threads |
// since they are constants. |
- const ChannelLayout channel_layout_; |
- const uint32 channel_count_; |
+ const uint32 channels_; |
const pa_sample_format_t sample_format_; |
const uint32 sample_rate_; |
const uint32 bytes_per_frame_; |
+ const uint32 packet_size_; |
+ const uint32 frames_per_packet_; |
// Audio manager that created us. Used to report that we've closed. |
AudioManagerPulse* manager_; |
// PulseAudio API structs. |
pa_context* pa_context_; |
- pa_mainloop* pa_mainloop_; |
+ pa_threaded_mainloop* pa_mainloop_; |
// Handle to the actual PulseAudio playback stream. |
pa_stream* playback_handle_; |
// Device configuration data. Populated after Open() completes. |
- uint32 packet_size_; |
- uint32 frames_per_packet_; |
+ uint32 pa_buffer_size_; |
// Client side audio buffer feeding pulse audio's server side buffer. |
- scoped_ptr<media::SeekableBuffer> client_buffer_; |
+ scoped_ptr<media::SeekableBuffer> buffer_; |
// Float representation of volume from 0.0 to 1.0. |
float volume_; |
@@ -119,9 +104,8 @@ |
// entered an unrecoverable error state, or the Close() has executed. |
bool stream_stopped_; |
- // Whether or not PulseAudio has called the WriteCallback for the most recent |
- // set of pa_mainloop iterations. |
- bool write_callback_handled_; |
+ // Flag indicating the state of the context has been changed. |
+ bool context_state_changed_; |
// Message loop used to post WaitForWriteTasks. Used to prevent blocking on |
// the audio thread while waiting for PulseAudio write callbacks. |