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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 audio_timestamp_helper_->SetBaseTimestamp(pts_list_.front().second); | 190 audio_timestamp_helper_->SetBaseTimestamp(pts_list_.front().second); |
191 pts_list_.pop_front(); | 191 pts_list_.pop_front(); |
192 } | 192 } |
193 | 193 |
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 |
| 201 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| 202 // type and allow multiple audio tracks. See https://crbug.com/341581. |
200 scoped_refptr<StreamParserBuffer> stream_parser_buffer = | 203 scoped_refptr<StreamParserBuffer> stream_parser_buffer = |
201 StreamParserBuffer::CopyFrom( | 204 StreamParserBuffer::CopyFrom( |
202 &raw_es[es_position], | 205 &raw_es[es_position], |
203 frame_size, | 206 frame_size, |
204 is_key_frame); | 207 is_key_frame, |
| 208 DemuxerStream::AUDIO, 0); |
205 stream_parser_buffer->SetDecodeTimestamp(current_pts); | 209 stream_parser_buffer->SetDecodeTimestamp(current_pts); |
206 stream_parser_buffer->set_timestamp(current_pts); | 210 stream_parser_buffer->set_timestamp(current_pts); |
207 stream_parser_buffer->set_duration(frame_duration); | 211 stream_parser_buffer->set_duration(frame_duration); |
208 emit_buffer_cb_.Run(stream_parser_buffer); | 212 emit_buffer_cb_.Run(stream_parser_buffer); |
209 | 213 |
210 // Update the PTS of the next frame. | 214 // Update the PTS of the next frame. |
211 audio_timestamp_helper_->AddFrames(kNumberSamplesPerAACFrame); | 215 audio_timestamp_helper_->AddFrames(kNumberSamplesPerAACFrame); |
212 | 216 |
213 // Skip the current frame. | 217 // Skip the current frame. |
214 es_position += frame_size; | 218 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) | 301 for (EsPtsList::iterator it = pts_list_.begin(); it != pts_list_.end(); ++it) |
298 it->first -= nbytes; | 302 it->first -= nbytes; |
299 | 303 |
300 // Discard |nbytes| of ES. | 304 // Discard |nbytes| of ES. |
301 es_byte_queue_.Pop(nbytes); | 305 es_byte_queue_.Pop(nbytes); |
302 } | 306 } |
303 | 307 |
304 } // namespace mp2t | 308 } // namespace mp2t |
305 } // namespace media | 309 } // namespace media |
306 | 310 |
OLD | NEW |