Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: media/audio/audio_output_resampler.cc

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove AudioBufferState since ledger code is no longer built in Chrome. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_output_resampler.cc
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc
index cf966e0b6ea9c6f0cdc48663cc7e9175b58cedf8..d73c8b4df8e1cd143533a078a7d39c367e0d1c9c 100644
--- a/media/audio/audio_output_resampler.cc
+++ b/media/audio/audio_output_resampler.cc
@@ -30,7 +30,7 @@ class OnMoreDataConverter
// AudioSourceCallback interface.
virtual int OnMoreData(AudioBus* dest,
- AudioBuffersState buffers_state) OVERRIDE;
+ int total_bytes_delay) 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 @@ class OnMoreDataConverter
// Source callback.
AudioOutputStream::AudioSourceCallback* source_callback_;
- // Last AudioBuffersState object received via OnMoreData(), used to correct
+ // Last |total_bytes_delay| received via OnMoreData(), used to correct
// playback delay by ProvideInput() and passed on to |source_callback_|.
- AudioBuffersState current_buffers_state_;
+ int current_total_bytes_delay_;
const int input_bytes_per_second_;
@@ -327,8 +327,8 @@ void OnMoreDataConverter::Stop() {
}
int OnMoreDataConverter::OnMoreData(AudioBus* dest,
- AudioBuffersState buffers_state) {
- current_buffers_state_ = buffers_state;
+ int total_bytes_delay) {
+ current_total_bytes_delay_ = total_bytes_delay;
audio_converter_.Convert(dest);
// Always return the full number of frames requested, ProvideInput()
@@ -341,13 +341,12 @@ double OnMoreDataConverter::ProvideInput(AudioBus* dest,
// 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.
- AudioBuffersState new_buffers_state;
- new_buffers_state.pending_bytes =
- io_ratio_ * (current_buffers_state_.total_bytes() +
+ int new_total_bytes_delay =
+ io_ratio_ * (current_total_bytes_delay_ +
buffer_delay.InSecondsF() * input_bytes_per_second_);
// Retrieve data from the original callback.
- const int frames = source_callback_->OnMoreData(dest, new_buffers_state);
+ const int frames = source_callback_->OnMoreData(dest, new_total_bytes_delay);
// Zero any unfilled frames if anything was filled, otherwise we'll just
// return a volume of zero and let AudioConverter drop the output.

Powered by Google App Engine
This is Rietveld 408576698