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_h264.h" | 5 #include "media/formats/mp2t/es_parser_h264.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 es_queue_->Trim(current_access_unit_pos_); | 228 es_queue_->Trim(current_access_unit_pos_); |
229 | 229 |
230 return true; | 230 return true; |
231 } | 231 } |
232 | 232 |
233 bool EsParserH264::EmitFrame(int64_t access_unit_pos, | 233 bool EsParserH264::EmitFrame(int64_t access_unit_pos, |
234 int access_unit_size, | 234 int access_unit_size, |
235 bool is_key_frame, | 235 bool is_key_frame, |
236 int pps_id) { | 236 int pps_id) { |
237 // Get the access unit timing info. | 237 // Get the access unit timing info. |
238 // Note: |current_timing_desc.pts| might be |kNoTimestamp()| at this point | 238 // Note: |current_timing_desc.pts| might be |kNoTimestamp| at this point |
239 // if: | 239 // if: |
240 // - the stream is not fully MPEG-2 compliant. | 240 // - the stream is not fully MPEG-2 compliant. |
241 // - or if the stream relies on H264 VUI parameters to compute the timestamps. | 241 // - or if the stream relies on H264 VUI parameters to compute the timestamps. |
242 // See H.222 spec: section 2.7.5 "Conditional coding of timestamps". | 242 // See H.222 spec: section 2.7.5 "Conditional coding of timestamps". |
243 // This part is not yet implemented in EsParserH264. | 243 // This part is not yet implemented in EsParserH264. |
244 // |es_adapter_| will take care of the missing timestamps. | 244 // |es_adapter_| will take care of the missing timestamps. |
245 TimingDesc current_timing_desc = GetTimingDescriptor(access_unit_pos); | 245 TimingDesc current_timing_desc = GetTimingDescriptor(access_unit_pos); |
246 DVLOG_IF(1, current_timing_desc.pts == kNoTimestamp()) | 246 DVLOG_IF(1, current_timing_desc.pts == kNoTimestamp) << "Missing timestamp"; |
247 << "Missing timestamp"; | |
248 | 247 |
249 // If only the PTS is provided, copy the PTS into the DTS. | 248 // If only the PTS is provided, copy the PTS into the DTS. |
250 if (current_timing_desc.dts == kNoDecodeTimestamp()) { | 249 if (current_timing_desc.dts == kNoDecodeTimestamp()) { |
mmoroz
2016/07/19 08:50:33
The same question, don't we replace this as well?
| |
251 current_timing_desc.dts = | 250 current_timing_desc.dts = |
252 DecodeTimestamp::FromPresentationTime(current_timing_desc.pts); | 251 DecodeTimestamp::FromPresentationTime(current_timing_desc.pts); |
253 } | 252 } |
254 | 253 |
255 // Update the video decoder configuration if needed. | 254 // Update the video decoder configuration if needed. |
256 const H264PPS* pps = h264_parser_->GetPPS(pps_id); | 255 const H264PPS* pps = h264_parser_->GetPPS(pps_id); |
257 if (!pps) { | 256 if (!pps) { |
258 // Only accept an invalid PPS at the beginning when the stream | 257 // Only accept an invalid PPS at the beginning when the stream |
259 // does not necessarily start with an SPS/PPS/IDR. | 258 // does not necessarily start with an SPS/PPS/IDR. |
260 // In this case, the initial frames are conveyed to the upper layer with | 259 // In this case, the initial frames are conveyed to the upper layer with |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 << " height=" << sps->sar_height; | 344 << " height=" << sps->sar_height; |
346 last_video_decoder_config_ = video_decoder_config; | 345 last_video_decoder_config_ = video_decoder_config; |
347 es_adapter_.OnConfigChanged(video_decoder_config); | 346 es_adapter_.OnConfigChanged(video_decoder_config); |
348 } | 347 } |
349 | 348 |
350 return true; | 349 return true; |
351 } | 350 } |
352 | 351 |
353 } // namespace mp2t | 352 } // namespace mp2t |
354 } // namespace media | 353 } // namespace media |
OLD | NEW |