| Index: trunk/src/media/audio/audio_output_resampler.cc
|
| ===================================================================
|
| --- trunk/src/media/audio/audio_output_resampler.cc (revision 290374)
|
| +++ trunk/src/media/audio/audio_output_resampler.cc (working copy)
|
| @@ -30,7 +30,7 @@
|
|
|
| // AudioSourceCallback interface.
|
| virtual int OnMoreData(AudioBus* dest,
|
| - int total_bytes_delay) OVERRIDE;
|
| + AudioBuffersState buffers_state) OVERRIDE;
|
| virtual void OnError(AudioOutputStream* stream) OVERRIDE;
|
|
|
| // Sets |source_callback_|. If this is not a new object, then Stop() must be
|
| @@ -54,9 +54,9 @@
|
| // Source callback.
|
| AudioOutputStream::AudioSourceCallback* source_callback_;
|
|
|
| - // Last |total_bytes_delay| received via OnMoreData(), used to correct
|
| + // Last AudioBuffersState object received via OnMoreData(), used to correct
|
| // playback delay by ProvideInput() and passed on to |source_callback_|.
|
| - int current_total_bytes_delay_;
|
| + AudioBuffersState current_buffers_state_;
|
|
|
| const int input_bytes_per_second_;
|
|
|
| @@ -327,8 +327,8 @@
|
| }
|
|
|
| int OnMoreDataConverter::OnMoreData(AudioBus* dest,
|
| - int total_bytes_delay) {
|
| - current_total_bytes_delay_ = total_bytes_delay;
|
| + AudioBuffersState buffers_state) {
|
| + current_buffers_state_ = buffers_state;
|
| audio_converter_.Convert(dest);
|
|
|
| // Always return the full number of frames requested, ProvideInput()
|
| @@ -341,12 +341,13 @@
|
| // Adjust playback delay to include |buffer_delay|.
|
| // TODO(dalecurtis): Stop passing bytes around, it doesn't make sense since
|
| // AudioBus is just float data. Use TimeDelta instead.
|
| - int new_total_bytes_delay =
|
| - io_ratio_ * (current_total_bytes_delay_ +
|
| + AudioBuffersState new_buffers_state;
|
| + new_buffers_state.pending_bytes =
|
| + io_ratio_ * (current_buffers_state_.total_bytes() +
|
| buffer_delay.InSecondsF() * input_bytes_per_second_);
|
|
|
| // Retrieve data from the original callback.
|
| - const int frames = source_callback_->OnMoreData(dest, new_total_bytes_delay);
|
| + const int frames = source_callback_->OnMoreData(dest, new_buffers_state);
|
|
|
| // Zero any unfilled frames if anything was filled, otherwise we'll just
|
| // return a volume of zero and let AudioConverter drop the output.
|
|
|