| 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_adts.h" | 5 #include "media/formats/mp2t/es_parser_adts.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); | 194 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); |
| 195 base::TimeDelta frame_duration = | 195 base::TimeDelta frame_duration = |
| 196 audio_timestamp_helper_->GetFrameDuration(kNumberSamplesPerAACFrame); | 196 audio_timestamp_helper_->GetFrameDuration(kNumberSamplesPerAACFrame); |
| 197 | 197 |
| 198 // Emit an audio frame. | 198 // Emit an audio frame. |
| 199 bool is_key_frame = true; | 199 bool is_key_frame = true; |
| 200 scoped_refptr<StreamParserBuffer> stream_parser_buffer = | 200 scoped_refptr<StreamParserBuffer> stream_parser_buffer = |
| 201 StreamParserBuffer::CopyFrom( | 201 StreamParserBuffer::CopyFrom( |
| 202 &raw_es[es_position], | 202 &raw_es[es_position], |
| 203 frame_size, | 203 frame_size, |
| 204 is_key_frame); | 204 is_key_frame, |
| 205 DemuxerStream::AUDIO); |
| 205 stream_parser_buffer->SetDecodeTimestamp(current_pts); | 206 stream_parser_buffer->SetDecodeTimestamp(current_pts); |
| 206 stream_parser_buffer->set_timestamp(current_pts); | 207 stream_parser_buffer->set_timestamp(current_pts); |
| 207 stream_parser_buffer->set_duration(frame_duration); | 208 stream_parser_buffer->set_duration(frame_duration); |
| 208 emit_buffer_cb_.Run(stream_parser_buffer); | 209 emit_buffer_cb_.Run(stream_parser_buffer); |
| 209 | 210 |
| 210 // Update the PTS of the next frame. | 211 // Update the PTS of the next frame. |
| 211 audio_timestamp_helper_->AddFrames(kNumberSamplesPerAACFrame); | 212 audio_timestamp_helper_->AddFrames(kNumberSamplesPerAACFrame); |
| 212 | 213 |
| 213 // Skip the current frame. | 214 // Skip the current frame. |
| 214 es_position += frame_size; | 215 es_position += frame_size; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 for (EsPtsList::iterator it = pts_list_.begin(); it != pts_list_.end(); ++it) | 298 for (EsPtsList::iterator it = pts_list_.begin(); it != pts_list_.end(); ++it) |
| 298 it->first -= nbytes; | 299 it->first -= nbytes; |
| 299 | 300 |
| 300 // Discard |nbytes| of ES. | 301 // Discard |nbytes| of ES. |
| 301 es_byte_queue_.Pop(nbytes); | 302 es_byte_queue_.Pop(nbytes); |
| 302 } | 303 } |
| 303 | 304 |
| 304 } // namespace mp2t | 305 } // namespace mp2t |
| 305 } // namespace media | 306 } // namespace media |
| 306 | 307 |
| OLD | NEW |