| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/formats/mp2t/es_parser_mpeg1audio.h" | 5 #include "media/formats/mp2t/es_parser_mpeg1audio.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (!UpdateAudioConfiguration(mpeg1audio_frame.data)) | 57 if (!UpdateAudioConfiguration(mpeg1audio_frame.data)) |
| 58 return false; | 58 return false; |
| 59 | 59 |
| 60 // Get the PTS & the duration of this access unit. | 60 // Get the PTS & the duration of this access unit. |
| 61 TimingDesc current_timing_desc = | 61 TimingDesc current_timing_desc = |
| 62 GetTimingDescriptor(mpeg1audio_frame.queue_offset); | 62 GetTimingDescriptor(mpeg1audio_frame.queue_offset); |
| 63 if (current_timing_desc.pts != kNoTimestamp()) | 63 if (current_timing_desc.pts != kNoTimestamp()) |
| 64 audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts); | 64 audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts); |
| 65 | 65 |
| 66 if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp()) { | 66 if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp()) { |
| 67 DVLOG(1) << "Audio frame with unknown timestamp"; | 67 DVLOG(1) << "Skip audio frame with unknown timestamp"; |
| 68 return false; | 68 SkipMpeg1AudioFrame(mpeg1audio_frame); |
| 69 continue; |
| 69 } | 70 } |
| 70 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); | 71 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); |
| 71 base::TimeDelta frame_duration = | 72 base::TimeDelta frame_duration = |
| 72 audio_timestamp_helper_->GetFrameDuration( | 73 audio_timestamp_helper_->GetFrameDuration( |
| 73 mpeg1audio_frame.sample_count); | 74 mpeg1audio_frame.sample_count); |
| 74 | 75 |
| 75 // Emit an audio frame. | 76 // Emit an audio frame. |
| 76 bool is_key_frame = true; | 77 bool is_key_frame = true; |
| 77 | 78 |
| 78 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId | 79 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 202 } |
| 202 | 203 |
| 203 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( | 204 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( |
| 204 const Mpeg1AudioFrame& mpeg1audio_frame) { | 205 const Mpeg1AudioFrame& mpeg1audio_frame) { |
| 205 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); | 206 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); |
| 206 es_queue_->Pop(mpeg1audio_frame.size); | 207 es_queue_->Pop(mpeg1audio_frame.size); |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace mp2t | 210 } // namespace mp2t |
| 210 } // namespace media | 211 } // namespace media |
| OLD | NEW |