Index: media/audio/mac/audio_output_mac.h |
diff --git a/media/audio/mac/audio_output_mac.h b/media/audio/mac/audio_output_mac.h |
index 031dc3f60d53b1e400711ad3c27e0da9183b3b1d..8d18c3eeb0dab720b508c96d4adcafe9795505c0 100644 |
--- a/media/audio/mac/audio_output_mac.h |
+++ b/media/audio/mac/audio_output_mac.h |
@@ -9,6 +9,7 @@ |
#include <AudioToolbox/AudioQueue.h> |
#include <AudioUnit/AudioUnit.h> |
+#include "base/synchronization/lock.h" |
#include "media/audio/audio_io.h" |
#include "media/audio/audio_parameters.h" |
@@ -52,12 +53,19 @@ class PCMQueueOutAudioOutputStream : public AudioOutputStream { |
// Called when an error occurs. |
void HandleError(OSStatus err); |
+ // Atomic operations for setting/getting the source callback. |
+ void SetSource(AudioSourceCallback* source); |
+ AudioSourceCallback* GetSource(); |
+ |
// Structure that holds the stream format details such as bitrate. |
AudioStreamBasicDescription format_; |
// Handle to the OS audio queue object. |
AudioQueueRef audio_queue_; |
// Array of pointers to the OS managed audio buffers. |
AudioQueueBufferRef buffer_[kNumBuffers]; |
+ // Mutex for the |source_| to implment atomic set and get. |
+ // It is important to NOT wait on any other locks while this is held. |
+ base::Lock source_lock_; |
// Pointer to the object that will provide the audio samples. |
AudioSourceCallback* source_; |
// Our creator, the audio manager needs to be notified when we close. |