Index: media/filters/ffmpeg_audio_decoder.h |
diff --git a/media/filters/ffmpeg_audio_decoder.h b/media/filters/ffmpeg_audio_decoder.h |
index 46af8f0b2340160d2378d512da9c8f2e6ae95522..c63edaed5ef76a1bccb8cf14a67cdd512bad893f 100644 |
--- a/media/filters/ffmpeg_audio_decoder.h |
+++ b/media/filters/ffmpeg_audio_decoder.h |
@@ -52,13 +52,10 @@ class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { |
void DecodeBuffer(DemuxerStream::Status status, |
const scoped_refptr<DecoderBuffer>& buffer); |
- // Updates the output buffer's duration and timestamp based on the input |
- // buffer. Will fall back to an estimated timestamp if the input lacks a |
- // valid timestamp. |
- void UpdateDurationAndTimestamp(const Buffer* input, DataBuffer* output); |
- |
- // Calculates duration based on size of decoded audio bytes. |
- base::TimeDelta CalculateDuration(int size); |
+ // Returns the timestamp that should be used for the next buffer returned |
+ // via |read_cb_|. It is calculated from |output_timestamp_base_| and |
+ // |total_frames_decoded_|. |
+ base::TimeDelta GetNextOutputTimestamp() const; |
// This is !is_null() iff Initialize() hasn't been called. |
base::Callback<MessageLoop*()> message_loop_factory_cb_; |
@@ -73,7 +70,15 @@ class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { |
ChannelLayout channel_layout_; |
int samples_per_second_; |
- base::TimeDelta estimated_next_timestamp_; |
+ // Used for computing output timestamps. |
+ int bytes_per_frame_; |
+ base::TimeDelta output_timestamp_base_; |
+ double total_frames_decoded_; |
+ base::TimeDelta last_input_timestamp_; |
+ |
+ // Number of output sample bytes to drop before generating |
+ // output buffers. |
+ int output_bytes_to_drop_; |
// Holds decoded audio. |
AVFrame* av_frame_; |