| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 DVLOG(LOG_LEVEL_ES) << "Emit frame: stream_pos=" << current_access_unit_pos_ | 272 DVLOG(LOG_LEVEL_ES) << "Emit frame: stream_pos=" << current_access_unit_pos_ |
| 273 << " size=" << access_unit_size; | 273 << " size=" << access_unit_size; |
| 274 int es_size; | 274 int es_size; |
| 275 const uint8_t* es; | 275 const uint8_t* es; |
| 276 es_queue_->PeekAt(current_access_unit_pos_, &es, &es_size); | 276 es_queue_->PeekAt(current_access_unit_pos_, &es, &es_size); |
| 277 CHECK_GE(es_size, access_unit_size); | 277 CHECK_GE(es_size, access_unit_size); |
| 278 | 278 |
| 279 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId | 279 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| 280 // type and allow multiple video tracks. See https://crbug.com/341581. | 280 // type and allow multiple video tracks. See https://crbug.com/341581. |
| 281 scoped_refptr<StreamParserBuffer> stream_parser_buffer = | 281 scoped_refptr<StreamParserBuffer> stream_parser_buffer = |
| 282 StreamParserBuffer::CopyFrom( | 282 StreamParserBuffer::CopyFrom(es, access_unit_size, is_key_frame, |
| 283 es, | 283 DemuxerStream::VIDEO, kMp2tVideoTrackId); |
| 284 access_unit_size, | |
| 285 is_key_frame, | |
| 286 DemuxerStream::VIDEO, | |
| 287 0); | |
| 288 stream_parser_buffer->SetDecodeTimestamp(current_timing_desc.dts); | 284 stream_parser_buffer->SetDecodeTimestamp(current_timing_desc.dts); |
| 289 stream_parser_buffer->set_timestamp(current_timing_desc.pts); | 285 stream_parser_buffer->set_timestamp(current_timing_desc.pts); |
| 290 return es_adapter_.OnNewBuffer(stream_parser_buffer); | 286 return es_adapter_.OnNewBuffer(stream_parser_buffer); |
| 291 } | 287 } |
| 292 | 288 |
| 293 bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps, | 289 bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps, |
| 294 const EncryptionScheme& scheme) { | 290 const EncryptionScheme& scheme) { |
| 295 // Set the SAR to 1 when not specified in the H264 stream. | 291 // Set the SAR to 1 when not specified in the H264 stream. |
| 296 int sar_width = (sps->sar_width == 0) ? 1 : sps->sar_width; | 292 int sar_width = (sps->sar_width == 0) ? 1 : sps->sar_width; |
| 297 int sar_height = (sps->sar_height == 0) ? 1 : sps->sar_height; | 293 int sar_height = (sps->sar_height == 0) ? 1 : sps->sar_height; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 << " height=" << sps->sar_height; | 340 << " height=" << sps->sar_height; |
| 345 last_video_decoder_config_ = video_decoder_config; | 341 last_video_decoder_config_ = video_decoder_config; |
| 346 es_adapter_.OnConfigChanged(video_decoder_config); | 342 es_adapter_.OnConfigChanged(video_decoder_config); |
| 347 } | 343 } |
| 348 | 344 |
| 349 return true; | 345 return true; |
| 350 } | 346 } |
| 351 | 347 |
| 352 } // namespace mp2t | 348 } // namespace mp2t |
| 353 } // namespace media | 349 } // namespace media |
| OLD | NEW |