Chromium Code Reviews| 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 f2a284a2004587c6a660009cd34efb878a1c0f2c..1c0f41eea2e525abdddaaa501081c5bc944463c0 100644 |
| --- a/media/formats/mp2t/es_parser_adts.cc |
| +++ b/media/formats/mp2t/es_parser_adts.cc |
| @@ -118,24 +118,13 @@ EsParserAdts::EsParserAdts( |
| bool sbr_in_mimetype) |
| : new_audio_config_cb_(new_audio_config_cb), |
| emit_buffer_cb_(emit_buffer_cb), |
| - sbr_in_mimetype_(sbr_in_mimetype), |
| - es_queue_(new media::OffsetByteQueue()) { |
| + sbr_in_mimetype_(sbr_in_mimetype) { |
| } |
| EsParserAdts::~EsParserAdts() { |
| } |
| -bool EsParserAdts::Parse(const uint8* buf, int size, |
| - base::TimeDelta pts, |
| - DecodeTimestamp dts) { |
| - // The incoming PTS applies to the access unit that comes just after |
| - // the beginning of |buf|. |
| - if (pts != kNoTimestamp()) |
| - pts_list_.push_back(EsPts(es_queue_->tail(), pts)); |
| - |
| - // Copy the input data to the ES buffer. |
| - es_queue_->Push(buf, size); |
| - |
| +bool EsParserAdts::ParseFromEsQueue() { |
| // Look for every ADTS frame in the ES buffer. |
| AdtsFrame adts_frame; |
| while (LookForAdtsFrame(&adts_frame)) { |
| @@ -145,11 +134,10 @@ bool EsParserAdts::Parse(const uint8* buf, int size, |
| return false; |
| // Get the PTS & the duration of this access unit. |
| - while (!pts_list_.empty() && |
| - pts_list_.front().first <= adts_frame.queue_offset) { |
| - audio_timestamp_helper_->SetBaseTimestamp(pts_list_.front().second); |
| - pts_list_.pop_front(); |
| - } |
| + TimingDesc current_timing_desc = |
| + GetTimingDescriptor(adts_frame.queue_offset); |
| + if (current_timing_desc.pts != kNoTimestamp()) |
| + audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts); |
| if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp()) { |
| DVLOG(1) << "Audio frame with unknown timestamp"; |
| @@ -188,8 +176,7 @@ void EsParserAdts::Flush() { |
| } |
| void EsParserAdts::Reset() { |
| - es_queue_.reset(new media::OffsetByteQueue()); |
| - pts_list_.clear(); |
| + EsParser::Reset(); |
|
wolenetz
2014/08/26 23:01:44
This seems fragile to require overriding method to
damienv1
2014/08/27 16:23:43
Done.
|
| last_audio_decoder_config_ = AudioDecoderConfig(); |
| } |