| Index: media/base/audio_splicer.h
|
| diff --git a/media/base/audio_splicer.h b/media/base/audio_splicer.h
|
| index 50445b2d54c889018341772e7d2b686ce1fe84e3..510ec0e3d6ff4cfe1f37a3a5c488ac632bbf052c 100644
|
| --- a/media/base/audio_splicer.h
|
| +++ b/media/base/audio_splicer.h
|
| @@ -5,16 +5,16 @@
|
| #ifndef MEDIA_BASE_AUDIO_SPLICER_H_
|
| #define MEDIA_BASE_AUDIO_SPLICER_H_
|
|
|
| -#include <deque>
|
| -
|
| #include "base/memory/ref_counted.h"
|
| -#include "media/base/audio_timestamp_helper.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/time/time.h"
|
| #include "media/base/media_export.h"
|
|
|
| namespace media {
|
|
|
| class AudioBuffer;
|
| -class AudioDecoderConfig;
|
| +class AudioBus;
|
| +class AudioStreamSanitizer;
|
|
|
| // Helper class that handles filling gaps and resolving overlaps.
|
| class MEDIA_EXPORT AudioSplicer {
|
| @@ -22,8 +22,8 @@ class MEDIA_EXPORT AudioSplicer {
|
| AudioSplicer(int samples_per_second);
|
| ~AudioSplicer();
|
|
|
| - // Resets the splicer state by clearing the output buffers queue,
|
| - // and resetting the timestamp helper.
|
| + // Resets the splicer state by clearing the output buffers queue, and
|
| + // resetting the timestamp helper.
|
| void Reset();
|
|
|
| // Adds a new buffer full of samples or end of stream buffer to the splicer.
|
| @@ -34,23 +34,30 @@ class MEDIA_EXPORT AudioSplicer {
|
| // Returns true if the splicer has a buffer to return.
|
| bool HasNextBuffer() const;
|
|
|
| - // Removes the next buffer from the output buffer queue and returns it.
|
| - // This should only be called if HasNextBuffer() returns true.
|
| + // Removes the next buffer from the output buffer queue and returns it; this
|
| + // should only be called if HasNextBuffer() returns true.
|
| scoped_refptr<AudioBuffer> GetNextBuffer();
|
|
|
| - private:
|
| - void AddOutputBuffer(const scoped_refptr<AudioBuffer>& buffer);
|
| -
|
| - AudioTimestampHelper output_timestamp_helper_;
|
| + // Indicates that overlapping buffers are coming up and should be crossfaded.
|
| + // Once set, all buffers encountered after |splice_timestamp| will be queued
|
| + // internally until at least 5ms of overlapping buffers are received (or end
|
| + // of stream, whichever comes first).
|
| + void SetSpliceTimestamp(base::TimeDelta splice_timestamp);
|
|
|
| - // Minimum gap size needed before the splicer will take action to
|
| - // fill a gap. This avoids periodically inserting and then dropping samples
|
| - // when the buffer timestamps are slightly off because of timestamp rounding
|
| - // in the source content. Unit is frames.
|
| - int min_gap_size_;
|
| -
|
| - std::deque<scoped_refptr<AudioBuffer> > output_buffers_;
|
| - bool received_end_of_stream_;
|
| + private:
|
| + // Extracts the crossfade from |pre_splice_sanitizer_| and
|
| + // |post_splice_sanitizer_| respectively. Transfers partially consumed
|
| + // buffers into |sanitizer_| and drops consumed buffers.
|
| + void ExtractCrossfadeFromPreroll(AudioBus* output_bus);
|
| + // In addition to the above, transfers unused buffers into |sanitizer_|.
|
| + void ExtractCrossfadeFromPostroll(AudioBus* output_bus);
|
| +
|
| + scoped_ptr<AudioStreamSanitizer> sanitizer_;
|
| + scoped_ptr<AudioStreamSanitizer> pre_splice_sanitizer_;
|
| + scoped_ptr<AudioStreamSanitizer> post_splice_sanitizer_;
|
| +
|
| + base::TimeDelta splice_timestamp_;
|
| + const int crossfade_frame_count_;
|
|
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSplicer);
|
| };
|
|
|