diff options
author | rockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-18 16:13:19 +0000 |
---|---|---|
committer | rockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-18 16:13:19 +0000 |
commit | 24da0bdd190adf22b9d240d364f0c757717a5f5a (patch) | |
tree | ae515c4bc5b2d5e53b5bb2515b491df1d5a546b5 /media | |
parent | dc5662c95d6bbf3532bd91aa1ee4e5cbd890dc35 (diff) | |
download | chromium_src-24da0bdd190adf22b9d240d364f0c757717a5f5a.zip chromium_src-24da0bdd190adf22b9d240d364f0c757717a5f5a.tar.gz chromium_src-24da0bdd190adf22b9d240d364f0c757717a5f5a.tar.bz2 |
Revert 264763 "Wire up codec_delay() to MP3StreamParser and FFmp..."
Possible candidate for broken media_unittests:
http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%28dbg%29%281%29/builds/30043/steps/media_unittests/logs/MediaSource_MP3_TimestampOffset_0
> Wire up codec_delay() to MP3StreamParser and FFmpegAudioDecoder.
>
> Allows us to drop silent samples from the decoder after initialization
> and resets.
>
> codec_delay() is always in frames, so I've changed all call sites to use
> frames instead of a TimeDelta.
>
> Coincidentally also fixes an issue where not enough data was dropped from
> Vorbis buffers with negative timestamps.
>
> BUG=360961
> TEST=new pipeline_integration_test
>
> Review URL: https://codereview.chromium.org/239423005
TBR=dalecurtis@chromium.org
Review URL: https://codereview.chromium.org/242203006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/audio_decoder_config.cc | 11 | ||||
-rw-r--r-- | media/base/audio_decoder_config.h | 14 | ||||
-rw-r--r-- | media/ffmpeg/ffmpeg_common.cc | 8 | ||||
-rw-r--r-- | media/filters/decrypting_audio_decoder_unittest.cc | 4 | ||||
-rw-r--r-- | media/filters/decrypting_demuxer_stream.cc | 2 | ||||
-rw-r--r-- | media/filters/ffmpeg_audio_decoder.cc | 44 | ||||
-rw-r--r-- | media/filters/opus_audio_decoder.cc | 21 | ||||
-rw-r--r-- | media/filters/opus_audio_decoder.h | 10 | ||||
-rw-r--r-- | media/filters/pipeline_integration_test.cc | 6 | ||||
-rw-r--r-- | media/formats/mp4/mp4_stream_parser.cc | 2 | ||||
-rw-r--r-- | media/formats/mpeg/adts_stream_parser.cc | 2 | ||||
-rw-r--r-- | media/formats/mpeg/mp3_stream_parser.cc | 3 | ||||
-rw-r--r-- | media/formats/mpeg/mp3_stream_parser_unittest.cc | 2 | ||||
-rw-r--r-- | media/formats/mpeg/mpeg_audio_stream_parser_base.cc | 19 | ||||
-rw-r--r-- | media/formats/mpeg/mpeg_audio_stream_parser_base.h | 7 | ||||
-rw-r--r-- | media/formats/webm/webm_audio_client.cc | 18 |
16 files changed, 77 insertions, 96 deletions
diff --git a/media/base/audio_decoder_config.cc b/media/base/audio_decoder_config.cc index 06a1643..09910ed 100644 --- a/media/base/audio_decoder_config.cc +++ b/media/base/audio_decoder_config.cc @@ -20,8 +20,7 @@ AudioDecoderConfig::AudioDecoderConfig() channel_layout_(CHANNEL_LAYOUT_UNSUPPORTED), samples_per_second_(0), bytes_per_frame_(0), - is_encrypted_(false), - codec_delay_(0) { + is_encrypted_(false) { } AudioDecoderConfig::AudioDecoderConfig(AudioCodec codec, @@ -33,7 +32,7 @@ AudioDecoderConfig::AudioDecoderConfig(AudioCodec codec, bool is_encrypted) { Initialize(codec, sample_format, channel_layout, samples_per_second, extra_data, extra_data_size, is_encrypted, true, - base::TimeDelta(), 0); + base::TimeDelta(), base::TimeDelta()); } void AudioDecoderConfig::Initialize(AudioCodec codec, @@ -45,7 +44,7 @@ void AudioDecoderConfig::Initialize(AudioCodec codec, bool is_encrypted, bool record_stats, base::TimeDelta seek_preroll, - int codec_delay) { + base::TimeDelta codec_delay) { CHECK((extra_data_size != 0) == (extra_data != NULL)); if (record_stats) { @@ -89,7 +88,7 @@ bool AudioDecoderConfig::IsValidConfig() const { samples_per_second_ <= limits::kMaxSampleRate && sample_format_ != kUnknownSampleFormat && seek_preroll_ >= base::TimeDelta() && - codec_delay_ >= 0; + codec_delay_ >= base::TimeDelta(); } bool AudioDecoderConfig::Matches(const AudioDecoderConfig& config) const { @@ -115,7 +114,7 @@ std::string AudioDecoderConfig::AsHumanReadableString() const { << " sample_format: " << sample_format() << " bytes_per_frame: " << bytes_per_frame() << " seek_preroll: " << seek_preroll().InMilliseconds() << "ms" - << " codec_delay: " << codec_delay() + << " codec_delay: " << codec_delay().InMilliseconds() << "ms" << " has extra data? " << (extra_data() ? "true" : "false") << " encrypted? " << (is_encrypted() ? "true" : "false"); return s.str(); diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h index c8c7b47..c529909 100644 --- a/media/base/audio_decoder_config.h +++ b/media/base/audio_decoder_config.h @@ -63,13 +63,13 @@ class MEDIA_EXPORT AudioDecoderConfig { ~AudioDecoderConfig(); - // Resets the internal state of this object. |codec_delay| is in frames. + // Resets the internal state of this object. void Initialize(AudioCodec codec, SampleFormat sample_format, ChannelLayout channel_layout, int samples_per_second, const uint8* extra_data, size_t extra_data_size, bool is_encrypted, bool record_stats, base::TimeDelta seek_preroll, - int codec_delay); + base::TimeDelta codec_delay); // Returns true if this object has appropriate configuration values, false // otherwise. @@ -91,7 +91,7 @@ class MEDIA_EXPORT AudioDecoderConfig { SampleFormat sample_format() const { return sample_format_; } int bytes_per_frame() const { return bytes_per_frame_; } base::TimeDelta seek_preroll() const { return seek_preroll_; } - int codec_delay() const { return codec_delay_; } + base::TimeDelta codec_delay() const { return codec_delay_; } // Optional byte data required to initialize audio decoders such as Vorbis // codebooks. @@ -119,10 +119,10 @@ class MEDIA_EXPORT AudioDecoderConfig { // before the decoded data is valid. base::TimeDelta seek_preroll_; - // |codec_delay_| is the number of frames the decoder should discard before - // returning decoded data. This value can include both decoder delay as well - // as padding added during encoding. - int codec_delay_; + // |codec_delay_| is the overall delay overhead added by the codec while + // encoding. This value should be subtracted from each block's timestamp to + // get the actual timestamp. + base::TimeDelta codec_delay_; // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler // generated copy constructor and assignment operator. Since the extra data is diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index a65d19f..abc2a1a 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc @@ -298,6 +298,12 @@ static void AVCodecContextToAudioDecoderConfig( codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate); } + base::TimeDelta codec_delay; + if (codec_context->delay > 0) { + codec_delay = base::TimeDelta::FromMicroseconds( + codec_context->delay * 1000000.0 / codec_context->sample_rate); + } + config->Initialize(codec, sample_format, channel_layout, @@ -307,7 +313,7 @@ static void AVCodecContextToAudioDecoderConfig( is_encrypted, record_stats, seek_preroll, - codec_context->delay); + codec_delay); if (codec != kCodecOpus) { DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, config->bits_per_channel()); diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc index d7f1f9d..add52b9 100644 --- a/media/filters/decrypting_audio_decoder_unittest.cc +++ b/media/filters/decrypting_audio_decoder_unittest.cc @@ -123,7 +123,7 @@ class DecryptingAudioDecoderTest : public testing::Test { config_.Initialize(kCodecVorbis, kSampleFormatPlanarF32, CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, true, true, - base::TimeDelta(), 0); + base::TimeDelta(), base::TimeDelta()); InitializeAndExpectStatus(config_, PIPELINE_OK); } @@ -131,7 +131,7 @@ class DecryptingAudioDecoderTest : public testing::Test { ReinitializeConfigChange(config_); } - void ReinitializeConfigChange(const AudioDecoderConfig& new_config) { + void ReinitializeConfigChange(AudioDecoderConfig& new_config) { EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kAudio)); EXPECT_CALL(*decryptor_, InitializeAudioDecoder(_, _)) .WillOnce(RunCallback<1>(true)); diff --git a/media/filters/decrypting_demuxer_stream.cc b/media/filters/decrypting_demuxer_stream.cc index 6a1de5f..821ea8b 100644 --- a/media/filters/decrypting_demuxer_stream.cc +++ b/media/filters/decrypting_demuxer_stream.cc @@ -370,7 +370,7 @@ void DecryptingDemuxerStream::InitializeDecoderConfig() { false, // Output audio is not encrypted. false, base::TimeDelta(), - 0); + base::TimeDelta()); break; } diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc index 02af059..45f8dd4 100644 --- a/media/filters/ffmpeg_audio_decoder.cc +++ b/media/filters/ffmpeg_audio_decoder.cc @@ -262,30 +262,22 @@ void FFmpegAudioDecoder::DecodeBuffer( } if (!buffer->end_of_stream()) { - DCHECK(buffer->timestamp() != kNoTimestamp()); - const bool first_buffer = - last_input_timestamp_ == kNoTimestamp() && - output_timestamp_helper_->base_timestamp() == kNoTimestamp(); - if (first_buffer && codec_context_->codec_id == AV_CODEC_ID_VORBIS && + if (last_input_timestamp_ == kNoTimestamp() && + codec_context_->codec_id == AV_CODEC_ID_VORBIS && buffer->timestamp() < base::TimeDelta()) { // Dropping frames for negative timestamps as outlined in section A.2 // in the Vorbis spec. http://xiph.org/vorbis/doc/Vorbis_I_spec.html - DCHECK_EQ(output_frames_to_drop_, 0); - output_frames_to_drop_ = - 0.5 + - -buffer->timestamp().InSecondsF() * config_.samples_per_second(); - - // If we are dropping samples for Vorbis, the timeline always starts at 0. - output_timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); + output_frames_to_drop_ = floor(0.5 + -buffer->timestamp().InSecondsF() * + config_.samples_per_second()); } else { - if (first_buffer) { - output_timestamp_helper_->SetBaseTimestamp(buffer->timestamp()); - } else if (buffer->timestamp() < last_input_timestamp_) { + if (last_input_timestamp_ != kNoTimestamp() && + buffer->timestamp() < last_input_timestamp_) { const base::TimeDelta diff = buffer->timestamp() - last_input_timestamp_; - DLOG(WARNING) << "Input timestamps are not monotonically increasing! " - << " ts " << buffer->timestamp().InMicroseconds() << " us" - << " diff " << diff.InMicroseconds() << " us"; + DLOG(WARNING) + << "Input timestamps are not monotonically increasing! " + << " ts " << buffer->timestamp().InMicroseconds() << " us" + << " diff " << diff.InMicroseconds() << " us"; } last_input_timestamp_ = buffer->timestamp(); @@ -363,6 +355,19 @@ bool FFmpegAudioDecoder::FFmpegDecode( packet.size -= result; packet.data += result; + if (output_timestamp_helper_->base_timestamp() == kNoTimestamp() && + !buffer->end_of_stream()) { + DCHECK(buffer->timestamp() != kNoTimestamp()); + if (output_frames_to_drop_ > 0) { + // Currently Vorbis is the only codec that causes us to drop samples. + // If we have to drop samples it always means the timeline starts at 0. + DCHECK_EQ(codec_context_->codec_id, AV_CODEC_ID_VORBIS); + output_timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); + } else { + output_timestamp_helper_->SetBaseTimestamp(buffer->timestamp()); + } + } + scoped_refptr<AudioBuffer> output; int decoded_frames = 0; int original_frames = 0; @@ -478,7 +483,6 @@ bool FFmpegAudioDecoder::ConfigureDecoder() { av_frame_.reset(av_frame_alloc()); output_timestamp_helper_.reset( new AudioTimestampHelper(config_.samples_per_second())); - ResetTimestampState(); av_sample_format_ = codec_context_->sample_fmt; @@ -492,8 +496,6 @@ bool FFmpegAudioDecoder::ConfigureDecoder() { state_ = kUninitialized; return false; } - - output_frames_to_drop_ = config_.codec_delay(); return true; } diff --git a/media/filters/opus_audio_decoder.cc b/media/filters/opus_audio_decoder.cc index e54bf08..5afc024 100644 --- a/media/filters/opus_audio_decoder.cc +++ b/media/filters/opus_audio_decoder.cc @@ -253,6 +253,7 @@ OpusAudioDecoder::OpusAudioDecoder( opus_decoder_(NULL), last_input_timestamp_(kNoTimestamp()), frames_to_discard_(0), + frame_delay_at_start_(0), start_input_timestamp_(kNoTimestamp()) {} void OpusAudioDecoder::Initialize(const AudioDecoderConfig& config, @@ -336,7 +337,7 @@ void OpusAudioDecoder::DecodeBuffer( start_input_timestamp_ = input->timestamp(); if (last_input_timestamp_ == kNoTimestamp() && input->timestamp() == start_input_timestamp_) { - frames_to_discard_ = config_.codec_delay(); + frames_to_discard_ = frame_delay_at_start_; } last_input_timestamp_ = input->timestamp(); @@ -390,13 +391,17 @@ bool OpusAudioDecoder::ConfigureDecoder() { &opus_extra_data)) return false; - if (config_.codec_delay() <= 0) { + // Convert from seconds to samples. + timestamp_offset_ = config_.codec_delay(); + frame_delay_at_start_ = TimeDeltaToAudioFrames(config_.codec_delay(), + config_.samples_per_second()); + if (timestamp_offset_ <= base::TimeDelta() || frame_delay_at_start_ < 0) { DLOG(ERROR) << "Invalid file. Incorrect value for codec delay: " - << config_.codec_delay(); + << config_.codec_delay().InMicroseconds(); return false; } - if (config_.codec_delay() != opus_extra_data.skip_samples) { + if (frame_delay_at_start_ != opus_extra_data.skip_samples) { DLOG(ERROR) << "Invalid file. Codec Delay in container does not match the " << "value in Opus Extra Data."; return false; @@ -491,12 +496,7 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input, if (output_timestamp_helper_->base_timestamp() == kNoTimestamp() && !input->end_of_stream()) { DCHECK(input->timestamp() != kNoTimestamp()); - // Adjust the timestamp helper so the base timestamp is corrected for frames - // dropped due to codec delay. output_timestamp_helper_->SetBaseTimestamp(input->timestamp()); - output_timestamp_helper_->SetBaseTimestamp( - input->timestamp() - - output_timestamp_helper_->GetFrameDuration(config_.codec_delay())); } // Trim off any extraneous allocation. @@ -529,7 +529,8 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input, } // Assign timestamp and duration to the buffer. - output_buffer->get()->set_timestamp(output_timestamp_helper_->GetTimestamp()); + output_buffer->get()->set_timestamp( + output_timestamp_helper_->GetTimestamp() - timestamp_offset_); output_buffer->get()->set_duration( output_timestamp_helper_->GetFrameDuration(frames_to_output)); output_timestamp_helper_->AddFrames(frames_decoded); diff --git a/media/filters/opus_audio_decoder.h b/media/filters/opus_audio_decoder.h index d0dfcf0..2fad5a8 100644 --- a/media/filters/opus_audio_decoder.h +++ b/media/filters/opus_audio_decoder.h @@ -66,10 +66,16 @@ class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder { // happens. int frames_to_discard_; - // When the input timestamp is |start_input_timestamp_| the decoder needs to - // drop |config_.codec_delay()| frames. + // Number of frames to be discarded at the start of the stream. This value + // is typically the CodecDelay value from the container. This value should + // only be applied when input timestamp is |start_input_timestamp_|. + int frame_delay_at_start_; base::TimeDelta start_input_timestamp_; + // Timestamp to be subtracted from all the frames. This is typically computed + // from the CodecDelay value in the container. + base::TimeDelta timestamp_offset_; + DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); }; diff --git a/media/filters/pipeline_integration_test.cc b/media/filters/pipeline_integration_test.cc index 3fbfb86..c3a3c44b 100644 --- a/media/filters/pipeline_integration_test.cc +++ b/media/filters/pipeline_integration_test.cc @@ -849,7 +849,7 @@ TEST_P(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { TEST_P(PipelineIntegrationTest, MediaSource_MP3) { MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile, GetParam()); - StartHashedPipelineWithMediaSource(&source); + StartPipelineWithMediaSource(&source); source.EndOfStream(); EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); @@ -859,10 +859,6 @@ TEST_P(PipelineIntegrationTest, MediaSource_MP3) { Play(); EXPECT_TRUE(WaitUntilOnEnded()); - - // Verify that codec delay was stripped, if it wasn't the hash would be: - // "5.16,1.25,7.78,4.29,8.98,2.76," - EXPECT_EQ("5.81,2.71,8.97,4.32,7.83,1.12,", GetAudioHash()); } TEST_P(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc index 3136e19..e3b42fef 100644 --- a/media/formats/mp4/mp4_stream_parser.cc +++ b/media/formats/mp4/mp4_stream_parser.cc @@ -252,7 +252,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { codec, sample_format, channel_layout, sample_per_second, extra_data.size() ? &extra_data[0] : NULL, extra_data.size(), is_audio_track_encrypted_, false, base::TimeDelta(), - 0); + base::TimeDelta()); has_audio_ = true; audio_track_id_ = track->header.track_id; } diff --git a/media/formats/mpeg/adts_stream_parser.cc b/media/formats/mpeg/adts_stream_parser.cc index beb9435..5d8c9be 100644 --- a/media/formats/mpeg/adts_stream_parser.cc +++ b/media/formats/mpeg/adts_stream_parser.cc @@ -11,7 +11,7 @@ namespace media { static const uint32 kADTSStartCodeMask = 0xfff00000; ADTSStreamParser::ADTSStreamParser() - : MPEGAudioStreamParserBase(kADTSStartCodeMask, kCodecAAC, 0) {} + : MPEGAudioStreamParserBase(kADTSStartCodeMask, kCodecAAC) {} ADTSStreamParser::~ADTSStreamParser() {} diff --git a/media/formats/mpeg/mp3_stream_parser.cc b/media/formats/mpeg/mp3_stream_parser.cc index f5b7438..9ac19b1 100644 --- a/media/formats/mpeg/mp3_stream_parser.cc +++ b/media/formats/mpeg/mp3_stream_parser.cc @@ -90,10 +90,9 @@ static const int kLayer3 = 1; static const int kBitrateFree = 0; static const int kBitrateBad = 0xf; static const int kSampleRateReserved = 3; -static const int kCodecDelay = 529; MP3StreamParser::MP3StreamParser() - : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3, kCodecDelay) {} + : MPEGAudioStreamParserBase(kMP3StartCodeMask, kCodecMP3) {} MP3StreamParser::~MP3StreamParser() {} diff --git a/media/formats/mpeg/mp3_stream_parser_unittest.cc b/media/formats/mpeg/mp3_stream_parser_unittest.cc index 1638752..c5b5aeb 100644 --- a/media/formats/mpeg/mp3_stream_parser_unittest.cc +++ b/media/formats/mpeg/mp3_stream_parser_unittest.cc @@ -40,7 +40,6 @@ TEST_F(MP3StreamParserTest, UnalignedAppend) { "{ 0K }" "EndOfSegment"; EXPECT_EQ(expected, ParseFile("sfx.mp3", 17)); - EXPECT_GT(last_audio_config().codec_delay(), 0); } // Test parsing with a larger piece size to verify that multiple buffers @@ -56,7 +55,6 @@ TEST_F(MP3StreamParserTest, UnalignedAppend512) { "{ 0K }" "EndOfSegment"; EXPECT_EQ(expected, ParseFile("sfx.mp3", 512)); - EXPECT_GT(last_audio_config().codec_delay(), 0); } TEST_F(MP3StreamParserTest, MetadataParsing) { diff --git a/media/formats/mpeg/mpeg_audio_stream_parser_base.cc b/media/formats/mpeg/mpeg_audio_stream_parser_base.cc index 4d0a202..97a5bac 100644 --- a/media/formats/mpeg/mpeg_audio_stream_parser_base.cc +++ b/media/formats/mpeg/mpeg_audio_stream_parser_base.cc @@ -44,13 +44,11 @@ static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) { } MPEGAudioStreamParserBase::MPEGAudioStreamParserBase(uint32 start_code_mask, - AudioCodec audio_codec, - int codec_delay) + AudioCodec audio_codec) : state_(UNINITIALIZED), in_media_segment_(false), start_code_mask_(start_code_mask), - audio_codec_(audio_codec), - codec_delay_(codec_delay) {} + audio_codec_(audio_codec) {} MPEGAudioStreamParserBase::~MPEGAudioStreamParserBase() {} @@ -201,16 +199,9 @@ int MPEGAudioStreamParserBase::ParseFrame(const uint8* data, } if (!config_.IsValidConfig()) { - config_.Initialize(audio_codec_, - kSampleFormatF32, - channel_layout, - sample_rate, - NULL, - 0, - false, - false, - base::TimeDelta(), - codec_delay_); + config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout, + sample_rate, NULL, 0, false, false, + base::TimeDelta(), base::TimeDelta()); base::TimeDelta base_timestamp; if (timestamp_helper_) diff --git a/media/formats/mpeg/mpeg_audio_stream_parser_base.h b/media/formats/mpeg/mpeg_audio_stream_parser_base.h index 31a1b7c..ec70dd5 100644 --- a/media/formats/mpeg/mpeg_audio_stream_parser_base.h +++ b/media/formats/mpeg/mpeg_audio_stream_parser_base.h @@ -23,11 +23,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { public: // |start_code_mask| is used to find the start of each frame header. Also // referred to as the sync code in the MP3 and ADTS header specifications. - // |codec_delay| is the number of samples the decoder will output before the - // first real frame. - MPEGAudioStreamParserBase(uint32 start_code_mask, - AudioCodec audio_codec, - int codec_delay); + MPEGAudioStreamParserBase(uint32 start_code_mask, AudioCodec audio_codec); virtual ~MPEGAudioStreamParserBase(); // StreamParser implementation. @@ -146,7 +142,6 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { bool in_media_segment_; const uint32 start_code_mask_; const AudioCodec audio_codec_; - const int codec_delay_; DISALLOW_COPY_AND_ASSIGN(MPEGAudioStreamParserBase); }; diff --git a/media/formats/webm/webm_audio_client.cc b/media/formats/webm/webm_audio_client.cc index 6fe9a84..6de4502 100644 --- a/media/formats/webm/webm_audio_client.cc +++ b/media/formats/webm/webm_audio_client.cc @@ -65,27 +65,15 @@ bool WebMAudioClient::InitializeConfig( extra_data_size = codec_private.size(); } - // Convert |codec_delay| from nanoseconds into frames. - int codec_delay_in_frames = 0; - if (codec_delay != -1) { - codec_delay_in_frames = - 0.5 + - samples_per_second * (static_cast<double>(codec_delay) / - base::Time::kNanosecondsPerSecond); - } - config->Initialize( audio_codec, (audio_codec == kCodecOpus) ? kSampleFormatS16 : kSampleFormatPlanarF32, channel_layout, - samples_per_second, - extra_data, - extra_data_size, - is_encrypted, - true, + samples_per_second, extra_data, extra_data_size, is_encrypted, true, base::TimeDelta::FromMicroseconds( (seek_preroll != -1 ? seek_preroll : 0) / 1000), - codec_delay_in_frames); + base::TimeDelta::FromMicroseconds( + (codec_delay != -1 ? codec_delay : 0) / 1000)); return config->IsValidConfig(); } |