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

Unified Diff: media/base/audio_discard_helper.h

Issue 251893002: Support start trimming post-decoding. Use it with FFmpegDemuxer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 8 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/base/audio_discard_helper.h
diff --git a/media/base/audio_discard_helper.h b/media/base/audio_discard_helper.h
index 388cbd421a380f8ac5646ac3c87dc060bb04774f..deeb45f37ea8eef4600f0142bfbe7ec1eef0ba3f 100644
--- a/media/base/audio_discard_helper.h
+++ b/media/base/audio_discard_helper.h
@@ -9,17 +9,31 @@
#include "base/time/time.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/buffers.h"
+#include "media/base/decoder_buffer.h"
#include "media/base/media_export.h"
namespace media {
class AudioBuffer;
-class DecoderBuffer;
// Helper class for managing timestamps and discard events around decoding.
class MEDIA_EXPORT AudioDiscardHelper {
public:
- explicit AudioDiscardHelper(int sample_rate);
+ // |sample_rate| is the sample rate of decoded data which will be handed into
+ // the ProcessBuffers() call.
+ //
+ // |decoder_delay| is the number of frames a decoder will output before data
+ // corresponding to the first encoded buffer is output. Callers only need to
+ // specify this if the decoder inserts frames which have no corresponding
+ // encoded buffer.
+ //
+ // For example, most MP3 decoders will output 529 junk frames before the data
+ // corresponding to the first encoded buffer is output. These frames are not
+ // represented in the encoded data stream and instead are an artifact of how
+ // most MP3 decoders work. See http://lame.sourceforge.net/tech-FAQ.txt
+ //
+ // NOTE: End discard is only supported when there is no |decoder_delay|.
+ AudioDiscardHelper(int sample_rate, size_t decoder_delay);
~AudioDiscardHelper();
// Converts a TimeDelta to a frame count based on the constructed sample rate.
@@ -50,11 +64,15 @@ class MEDIA_EXPORT AudioDiscardHelper {
private:
const int sample_rate_;
+ const size_t decoder_delay_;
AudioTimestampHelper timestamp_helper_;
size_t discard_frames_;
base::TimeDelta last_input_timestamp_;
+ bool delayed_discard_;
+ DecoderBuffer::DiscardPadding delayed_discard_padding_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDiscardHelper);
};

Powered by Google App Engine
This is Rietveld 408576698