| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); | 140 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); |
| 141 base::TimeDelta frame_duration = | 141 base::TimeDelta frame_duration = |
| 142 audio_timestamp_helper_->GetFrameDuration(kSamplesPerAACFrame); | 142 audio_timestamp_helper_->GetFrameDuration(kSamplesPerAACFrame); |
| 143 | 143 |
| 144 // Emit an audio frame. | 144 // Emit an audio frame. |
| 145 bool is_key_frame = true; | 145 bool is_key_frame = true; |
| 146 | 146 |
| 147 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId | 147 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| 148 // type and allow multiple audio tracks. See https://crbug.com/341581. | 148 // type and allow multiple audio tracks. See https://crbug.com/341581. |
| 149 scoped_refptr<StreamParserBuffer> stream_parser_buffer = | 149 scoped_refptr<StreamParserBuffer> stream_parser_buffer = |
| 150 StreamParserBuffer::CopyFrom( | 150 StreamParserBuffer::CopyFrom(adts_frame.data, adts_frame.size, |
| 151 adts_frame.data, | 151 is_key_frame, DemuxerStream::AUDIO, |
| 152 adts_frame.size, | 152 kMp2tAudioTrackId); |
| 153 is_key_frame, | |
| 154 DemuxerStream::AUDIO, 0); | |
| 155 stream_parser_buffer->set_timestamp(current_pts); | 153 stream_parser_buffer->set_timestamp(current_pts); |
| 156 stream_parser_buffer->SetDecodeTimestamp( | 154 stream_parser_buffer->SetDecodeTimestamp( |
| 157 DecodeTimestamp::FromPresentationTime(current_pts)); | 155 DecodeTimestamp::FromPresentationTime(current_pts)); |
| 158 stream_parser_buffer->set_duration(frame_duration); | 156 stream_parser_buffer->set_duration(frame_duration); |
| 159 emit_buffer_cb_.Run(stream_parser_buffer); | 157 emit_buffer_cb_.Run(stream_parser_buffer); |
| 160 | 158 |
| 161 // Update the PTS of the next frame. | 159 // Update the PTS of the next frame. |
| 162 audio_timestamp_helper_->AddFrames(kSamplesPerAACFrame); | 160 audio_timestamp_helper_->AddFrames(kSamplesPerAACFrame); |
| 163 | 161 |
| 164 // Skip the current frame. | 162 // Skip the current frame. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // Audio config notification. | 204 // Audio config notification. |
| 207 last_audio_decoder_config_ = audio_decoder_config; | 205 last_audio_decoder_config_ = audio_decoder_config; |
| 208 new_audio_config_cb_.Run(audio_decoder_config); | 206 new_audio_config_cb_.Run(audio_decoder_config); |
| 209 } | 207 } |
| 210 | 208 |
| 211 return true; | 209 return true; |
| 212 } | 210 } |
| 213 | 211 |
| 214 } // namespace mp2t | 212 } // namespace mp2t |
| 215 } // namespace media | 213 } // namespace media |
| OLD | NEW |