| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 StreamParserBuffer::CopyFrom(adts_frame.data, adts_frame.size, | 203 StreamParserBuffer::CopyFrom(adts_frame.data, adts_frame.size, |
| 204 is_key_frame, DemuxerStream::AUDIO, | 204 is_key_frame, DemuxerStream::AUDIO, |
| 205 kMp2tAudioTrackId); | 205 kMp2tAudioTrackId); |
| 206 stream_parser_buffer->set_timestamp(current_pts); | 206 stream_parser_buffer->set_timestamp(current_pts); |
| 207 stream_parser_buffer->SetDecodeTimestamp( | 207 stream_parser_buffer->SetDecodeTimestamp( |
| 208 DecodeTimestamp::FromPresentationTime(current_pts)); | 208 DecodeTimestamp::FromPresentationTime(current_pts)); |
| 209 stream_parser_buffer->set_duration(frame_duration); | 209 stream_parser_buffer->set_duration(frame_duration); |
| 210 #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES) | 210 #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES) |
| 211 if (use_hls_sample_aes_) { | 211 if (use_hls_sample_aes_) { |
| 212 const DecryptConfig* base_decrypt_config = get_decrypt_config_cb_.Run(); | 212 const DecryptConfig* base_decrypt_config = get_decrypt_config_cb_.Run(); |
| 213 RCHECK(base_decrypt_config); | 213 if (base_decrypt_config) { |
| 214 std::vector<SubsampleEntry> subsamples; | 214 std::vector<SubsampleEntry> subsamples; |
| 215 CalculateSubsamplesForAdtsFrame(adts_frame, &subsamples); | 215 CalculateSubsamplesForAdtsFrame(adts_frame, &subsamples); |
| 216 std::unique_ptr<DecryptConfig> decrypt_config( | 216 std::unique_ptr<DecryptConfig> decrypt_config( |
| 217 new DecryptConfig(base_decrypt_config->key_id(), | 217 new DecryptConfig(base_decrypt_config->key_id(), |
| 218 base_decrypt_config->iv(), subsamples)); | 218 base_decrypt_config->iv(), subsamples)); |
| 219 stream_parser_buffer->set_decrypt_config(std::move(decrypt_config)); | 219 stream_parser_buffer->set_decrypt_config(std::move(decrypt_config)); |
| 220 } |
| 220 } | 221 } |
| 221 #endif | 222 #endif |
| 222 emit_buffer_cb_.Run(stream_parser_buffer); | 223 emit_buffer_cb_.Run(stream_parser_buffer); |
| 223 | 224 |
| 224 // Update the PTS of the next frame. | 225 // Update the PTS of the next frame. |
| 225 audio_timestamp_helper_->AddFrames(kSamplesPerAACFrame); | 226 audio_timestamp_helper_->AddFrames(kSamplesPerAACFrame); |
| 226 | 227 |
| 227 // Skip the current frame. | 228 // Skip the current frame. |
| 228 SkipAdtsFrame(adts_frame); | 229 SkipAdtsFrame(adts_frame); |
| 229 } | 230 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // Audio config notification. | 291 // Audio config notification. |
| 291 last_audio_decoder_config_ = audio_decoder_config; | 292 last_audio_decoder_config_ = audio_decoder_config; |
| 292 new_audio_config_cb_.Run(audio_decoder_config); | 293 new_audio_config_cb_.Run(audio_decoder_config); |
| 293 } | 294 } |
| 294 | 295 |
| 295 return true; | 296 return true; |
| 296 } | 297 } |
| 297 | 298 |
| 298 } // namespace mp2t | 299 } // namespace mp2t |
| 299 } // namespace media | 300 } // namespace media |
| OLD | NEW |