Index: media/audio/audio_output_resampler.cc |
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc |
index c643b3e672c24ed086c07bf5d19262d396b66697..eef9da5ae120416b127ddd864affd863ae6c257d 100644 |
--- a/media/audio/audio_output_resampler.cc |
+++ b/media/audio/audio_output_resampler.cc |
@@ -33,7 +33,8 @@ class OnMoreDataConverter |
// AudioSourceCallback interface. |
int OnMoreData(AudioBus* dest, |
uint32_t total_bytes_delay, |
- uint32_t frames_skipped) override; |
+ uint32_t frames_skipped, |
+ const AudioTimestamp& timestamp) override; |
void OnError(AudioOutputStream* stream) override; |
// Sets |source_callback_|. If this is not a new object, then Stop() must be |
@@ -72,6 +73,9 @@ class OnMoreDataConverter |
// stream has been stopped. |
bool error_occurred_; |
+ // Information about last recorded stream output position. |
+ AudioTimestamp output_timestamp_; |
+ |
DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter); |
}; |
@@ -348,7 +352,8 @@ OnMoreDataConverter::OnMoreDataConverter(const AudioParameters& input_params, |
source_callback_(nullptr), |
input_bytes_per_frame_(input_params.GetBytesPerFrame()), |
audio_converter_(input_params, output_params, false), |
- error_occurred_(false) {} |
+ error_occurred_(false), |
+ output_timestamp_() {} |
OnMoreDataConverter::~OnMoreDataConverter() { |
// Ensure Stop() has been called so we don't end up with an AudioOutputStream |
@@ -375,7 +380,9 @@ void OnMoreDataConverter::Stop() { |
int OnMoreDataConverter::OnMoreData(AudioBus* dest, |
uint32_t total_bytes_delay, |
- uint32_t frames_skipped) { |
+ uint32_t frames_skipped, |
+ const AudioTimestamp& timestamp) { |
+ output_timestamp_ = timestamp; |
current_total_bytes_delay_ = total_bytes_delay; |
audio_converter_.Convert(dest); |
@@ -394,8 +401,8 @@ double OnMoreDataConverter::ProvideInput(AudioBus* dest, |
(current_total_bytes_delay_ + frames_delayed * input_bytes_per_frame_)); |
// Retrieve data from the original callback. |
- const int frames = |
- source_callback_->OnMoreData(dest, new_total_bytes_delay, 0); |
+ const int frames = source_callback_->OnMoreData(dest, new_total_bytes_delay, |
+ 0, output_timestamp_); |
// Zero any unfilled frames if anything was filled, otherwise we'll just |
// return a volume of zero and let AudioConverter drop the output. |