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

Unified Diff: media/filters/ffmpeg_audio_decoder.h

Issue 10831020: Refactor FFmpegAudioDecoder output timestamp logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Dale's comments Created 8 years, 4 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
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698