| Index: content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| diff --git a/content/renderer/pepper/pepper_media_stream_audio_track_host.h b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| index 348103c9928c55faa4c7beca1e0259b2347e07a4..5456cc7ec21902bb1704091ff0966a2029d582c0 100644
|
| --- a/content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| +++ b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| @@ -45,11 +45,11 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
|
| void EnqueueBuffer(int32_t index);
|
|
|
| // This function is called on the main thread.
|
| - void Configure(int32_t number_of_buffers);
|
| + void Configure(int32_t number_of_buffers, int32_t duration);
|
|
|
| private:
|
| // Initializes buffers on the main thread.
|
| - void SetFormatOnMainThread(int bytes_per_second);
|
| + void SetFormatOnMainThread(int bytes_per_second, int bytes_per_frame);
|
|
|
| void InitBuffers();
|
|
|
| @@ -69,6 +69,9 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
|
| // host_->buffer_manager() to read some buffer properties. It is safe
|
| // because the buffer_manager()'s properties will not be changed after
|
| // initialization.
|
| + // TODO(amistry): The last statement above is not true. The user can
|
| + // configure the audio track at any time, which may involve changing both
|
| + // the number and size of buffers.
|
| PepperMediaStreamAudioTrackHost* host_;
|
|
|
| // Timestamp of the next received audio buffer.
|
| @@ -92,12 +95,28 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
|
| // Access only on the audio thread.
|
| uint32_t buffer_data_size_;
|
|
|
| - // A lock to protect the index queue |buffers_|.
|
| + // Index of the currently active buffer.
|
| + // Access only on the audio thread.
|
| + int active_buffer_index_;
|
| +
|
| + // Pointer to the currently active buffer. Used to detect when buffers
|
| + // change.
|
| + // Access only on the audio thread.
|
| + void* active_buffer_ptr_;
|
| +
|
| + // Current offset, in bytes, within the currently active buffer.
|
| + // Access only on the audio thread.
|
| + uint32_t active_buffer_offset_;
|
| +
|
| + // A lock to protect the index queue |buffers_| and |output_buffer_size_|.
|
| base::Lock lock_;
|
|
|
| // A queue for free buffer indices.
|
| std::deque<int32_t> buffers_;
|
|
|
| + // Intended size of each output buffer.
|
| + int32_t output_buffer_size_;
|
| +
|
| scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_;
|
|
|
| base::ThreadChecker audio_thread_checker_;
|
| @@ -110,6 +129,12 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
|
| // Number of bytes per second.
|
| int bytes_per_second_;
|
|
|
| + // Number of bytes per frame = channels * bytes per sample.
|
| + int bytes_per_frame_;
|
| +
|
| + // User-configured buffer duration, in milliseconds.
|
| + int32_t user_buffer_duration_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(AudioSink);
|
| };
|
|
|
|
|