Enable splice frames and partial appends for AAC; with test!

Fingers crossed, hopefully all known bugs are fixed.

BUG=356073,371633,369204
TEST=new unittest.

Review URL: https://codereview.chromium.org/278673003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274457 0039d316-1c4b-4281-b951-d872f2087c98
parent a3069e22
......@@ -860,15 +860,13 @@ bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config,
DCHECK_EQ(state_, UNINITIALIZED);
// On platforms which support splice frames, enable splice frames and
// partial append window support for a limited set of codecs.
// TODO(dalecurtis): Verify this works for codecs other than MP3 and Vorbis.
// Right now we want to be extremely conservative to ensure we don't break
// the world.
const bool mp3_or_vorbis =
config.codec() == kCodecMP3 || config.codec() == kCodecVorbis;
splice_frames_enabled_ = splice_frames_enabled_ && mp3_or_vorbis;
// partial append window support for most codecs (notably: not opus).
const bool codec_supported = config.codec() == kCodecMP3 ||
config.codec() == kCodecAAC ||
config.codec() == kCodecVorbis;
splice_frames_enabled_ = splice_frames_enabled_ && codec_supported;
partial_append_window_trimming_enabled_ =
splice_frames_enabled_ && mp3_or_vorbis;
splice_frames_enabled_ && codec_supported;
stream_.reset(
new SourceBufferStream(config, log_cb, splice_frames_enabled_));
......
......@@ -919,24 +919,35 @@ TEST_P(PipelineIntegrationTest, MediaSource_ADTS) {
TEST_P(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) {
MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile, GetParam());
StartPipelineWithMediaSource(&source);
StartHashedPipelineWithMediaSource(&source);
EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds());
// Trim off multiple frames off the beginning of the segment which will cause
// the first decoded frame to be incorrect if preroll isn't implemented.
const base::TimeDelta adts_preroll_duration =
base::TimeDelta::FromSecondsD(2.5 * 1024 / 44100);
const base::TimeDelta append_time =
source.last_timestamp_offset() - adts_preroll_duration;
scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.adts");
source.AppendAtTime(
source.last_timestamp_offset() - base::TimeDelta::FromMilliseconds(10),
second_file->data(),
second_file->data_size());
source.AppendAtTimeWithWindow(append_time,
append_time + adts_preroll_duration,
kInfiniteDuration(),
second_file->data(),
second_file->data_size());
source.EndOfStream();
EXPECT_EQ(640, source.last_timestamp_offset().InMilliseconds());
EXPECT_EQ(592, source.last_timestamp_offset().InMilliseconds());
EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
EXPECT_EQ(640, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
EXPECT_EQ(592, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
Play();
EXPECT_TRUE(WaitUntilOnEnded());
// Verify preroll is stripped.
EXPECT_EQ("-0.06,0.97,-0.90,-0.70,-0.53,-0.34,", GetAudioHash());
}
TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment