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

Unified Diff: media/formats/mp2t/es_parser_adts.cc

Issue 2063443002: Return parsed sample frequency of ADTS header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SBR Created 4 years, 6 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/formats/mp2t/es_parser_adts.cc
diff --git a/media/formats/mp2t/es_parser_adts.cc b/media/formats/mp2t/es_parser_adts.cc
index b620a9866319bd37fbb2de1a6fcaba37e2d3db70..cd8d3886d0593a558d01c49d2b5fb0d384d90ca2 100644
--- a/media/formats/mp2t/es_parser_adts.cc
+++ b/media/formats/mp2t/es_parser_adts.cc
@@ -177,7 +177,9 @@ void EsParserAdts::ResetInternal() {
bool EsParserAdts::UpdateAudioConfiguration(const uint8_t* adts_header) {
AudioDecoderConfig audio_decoder_config;
- if (!ParseAdtsHeader(adts_header, sbr_in_mimetype_, &audio_decoder_config))
+ size_t orig_sample_rate = 0;
+ if (!ParseAdtsHeader(adts_header, sbr_in_mimetype_, &audio_decoder_config,
+ &orig_sample_rate))
return false;
if (!audio_decoder_config.Matches(last_audio_decoder_config_)) {
@@ -191,19 +193,15 @@ bool EsParserAdts::UpdateAudioConfiguration(const uint8_t* adts_header) {
// doubled in ParseAdtsHeader above, but AudioTimestampHelper should still
// use the original sample rate to compute audio timestamps and durations
// correctly.
- int samples_per_second = sbr_in_mimetype_
- ? audio_decoder_config.samples_per_second() / 2
- : audio_decoder_config.samples_per_second();
+
// Reset the timestamp helper to use a new time scale.
if (audio_timestamp_helper_ &&
audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) {
base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp();
- audio_timestamp_helper_.reset(
- new AudioTimestampHelper(samples_per_second));
+ audio_timestamp_helper_.reset(new AudioTimestampHelper(orig_sample_rate));
audio_timestamp_helper_->SetBaseTimestamp(base_timestamp);
} else {
- audio_timestamp_helper_.reset(
- new AudioTimestampHelper(samples_per_second));
+ audio_timestamp_helper_.reset(new AudioTimestampHelper(orig_sample_rate));
}
// Audio config notification.
last_audio_decoder_config_ = audio_decoder_config;

Powered by Google App Engine
This is Rietveld 408576698