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

Side by Side 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: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void DoReset(const base::Closure& closure); 45 void DoReset(const base::Closure& closure);
46 void DoRead(const ReadCB& read_cb); 46 void DoRead(const ReadCB& read_cb);
47 void DoDecodeBuffer(DemuxerStream::Status status, 47 void DoDecodeBuffer(DemuxerStream::Status status,
48 const scoped_refptr<DecoderBuffer>& input); 48 const scoped_refptr<DecoderBuffer>& input);
49 49
50 // Reads from the demuxer stream with corresponding callback method. 50 // Reads from the demuxer stream with corresponding callback method.
51 void ReadFromDemuxerStream(); 51 void ReadFromDemuxerStream();
52 void DecodeBuffer(DemuxerStream::Status status, 52 void DecodeBuffer(DemuxerStream::Status status,
53 const scoped_refptr<DecoderBuffer>& buffer); 53 const scoped_refptr<DecoderBuffer>& buffer);
54 54
55 // Updates the output buffer's duration and timestamp based on the input 55 base::TimeDelta GetNextOutputTimestamp() const;
scherkus (not reviewing) 2012/07/26 01:43:08 docs
acolwell GONE FROM CHROMIUM 2012/07/27 20:45:29 Done.
56 // buffer. Will fall back to an estimated timestamp if the input lacks a
57 // valid timestamp.
58 void UpdateDurationAndTimestamp(const Buffer* input, DataBuffer* output);
59
60 // Calculates duration based on size of decoded audio bytes.
61 base::TimeDelta CalculateDuration(int size);
62 56
63 // This is !is_null() iff Initialize() hasn't been called. 57 // This is !is_null() iff Initialize() hasn't been called.
64 base::Callback<MessageLoop*()> message_loop_factory_cb_; 58 base::Callback<MessageLoop*()> message_loop_factory_cb_;
65 MessageLoop* message_loop_; 59 MessageLoop* message_loop_;
66 60
67 scoped_refptr<DemuxerStream> demuxer_stream_; 61 scoped_refptr<DemuxerStream> demuxer_stream_;
68 StatisticsCB statistics_cb_; 62 StatisticsCB statistics_cb_;
69 AVCodecContext* codec_context_; 63 AVCodecContext* codec_context_;
70 64
71 // Decoded audio format. 65 // Decoded audio format.
72 int bits_per_channel_; 66 int bits_per_channel_;
73 ChannelLayout channel_layout_; 67 ChannelLayout channel_layout_;
74 int samples_per_second_; 68 int samples_per_second_;
75 69
76 base::TimeDelta estimated_next_timestamp_; 70 int bytes_per_frame_;
scherkus (not reviewing) 2012/07/26 01:43:08 nit: I'd add one-liner comment describing what the
acolwell GONE FROM CHROMIUM 2012/07/27 20:45:29 Done.
71 base::TimeDelta total_frames_base_;
scherkus (not reviewing) 2012/07/26 01:43:08 when I read "total_frames_base_" I thought it had
acolwell GONE FROM CHROMIUM 2012/07/27 20:45:29 Done.
72 int64 total_frames_decoded_;
73 base::TimeDelta last_input_timestamp_;
77 74
78 // Holds decoded audio. 75 // Holds decoded audio.
79 AVFrame* av_frame_; 76 AVFrame* av_frame_;
80 77
81 ReadCB read_cb_; 78 ReadCB read_cb_;
82 79
83 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); 80 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
84 }; 81 };
85 82
86 } // namespace media 83 } // namespace media
87 84
88 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 85 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | media/filters/ffmpeg_audio_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698