| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Number of samples in the frame. | 32 // Number of samples in the frame. |
| 33 int sample_count; | 33 int sample_count; |
| 34 | 34 |
| 35 // Frame offset in the ES queue. | 35 // Frame offset in the ES queue. |
| 36 int64_t queue_offset; | 36 int64_t queue_offset; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 EsParserMpeg1Audio::EsParserMpeg1Audio( | 39 EsParserMpeg1Audio::EsParserMpeg1Audio( |
| 40 const NewAudioConfigCB& new_audio_config_cb, | 40 const NewAudioConfigCB& new_audio_config_cb, |
| 41 const EmitBufferCB& emit_buffer_cb, | 41 const EmitBufferCB& emit_buffer_cb, |
| 42 const scoped_refptr<MediaLog>& media_log) | 42 MediaLog* media_log) |
| 43 : media_log_(media_log), | 43 : media_log_(media_log), |
| 44 new_audio_config_cb_(new_audio_config_cb), | 44 new_audio_config_cb_(new_audio_config_cb), |
| 45 emit_buffer_cb_(emit_buffer_cb) { | 45 emit_buffer_cb_(emit_buffer_cb) {} |
| 46 } | |
| 47 | 46 |
| 48 EsParserMpeg1Audio::~EsParserMpeg1Audio() { | 47 EsParserMpeg1Audio::~EsParserMpeg1Audio() { |
| 49 } | 48 } |
| 50 | 49 |
| 51 bool EsParserMpeg1Audio::ParseFromEsQueue() { | 50 bool EsParserMpeg1Audio::ParseFromEsQueue() { |
| 52 // Look for every MPEG1 audio frame in the ES buffer. | 51 // Look for every MPEG1 audio frame in the ES buffer. |
| 53 Mpeg1AudioFrame mpeg1audio_frame; | 52 Mpeg1AudioFrame mpeg1audio_frame; |
| 54 while (LookForMpeg1AudioFrame(&mpeg1audio_frame)) { | 53 while (LookForMpeg1AudioFrame(&mpeg1audio_frame)) { |
| 55 // Update the audio configuration if needed. | 54 // Update the audio configuration if needed. |
| 56 DCHECK_GE(mpeg1audio_frame.size, MPEG1AudioStreamParser::kHeaderSize); | 55 DCHECK_GE(mpeg1audio_frame.size, MPEG1AudioStreamParser::kHeaderSize); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 194 } |
| 196 | 195 |
| 197 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( | 196 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( |
| 198 const Mpeg1AudioFrame& mpeg1audio_frame) { | 197 const Mpeg1AudioFrame& mpeg1audio_frame) { |
| 199 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); | 198 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); |
| 200 es_queue_->Pop(mpeg1audio_frame.size); | 199 es_queue_->Pop(mpeg1audio_frame.size); |
| 201 } | 200 } |
| 202 | 201 |
| 203 } // namespace mp2t | 202 } // namespace mp2t |
| 204 } // namespace media | 203 } // namespace media |
| OLD | NEW |