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/mp4/mp4_stream_parser.h" | 5 #include "media/formats/mp4/mp4_stream_parser.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 natural_size = | 297 natural_size = |
298 GetNaturalSize(visible_rect.size(), entry.pixel_aspect.h_spacing, | 298 GetNaturalSize(visible_rect.size(), entry.pixel_aspect.h_spacing, |
299 entry.pixel_aspect.v_spacing); | 299 entry.pixel_aspect.v_spacing); |
300 } else if (track->header.width && track->header.height) { | 300 } else if (track->header.width && track->header.height) { |
301 natural_size = | 301 natural_size = |
302 gfx::Size(track->header.width, track->header.height); | 302 gfx::Size(track->header.width, track->header.height); |
303 } | 303 } |
304 | 304 |
305 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; | 305 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; |
306 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_; | 306 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_; |
307 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, PIXEL_FORMAT_YV12, | 307 video_config.Initialize(entry.video_codec, entry.video_codec_profile, |
308 COLOR_SPACE_HD_REC709, coded_size, visible_rect, | 308 PIXEL_FORMAT_YV12, COLOR_SPACE_HD_REC709, |
309 natural_size, | 309 coded_size, visible_rect, natural_size, |
310 // No decoder-specific buffer needed for AVC; | 310 // No decoder-specific buffer needed for AVC; |
311 // SPS/PPS are embedded in the video stream | 311 // SPS/PPS are embedded in the video stream |
312 NULL, 0, is_video_track_encrypted_); | 312 NULL, 0, is_video_track_encrypted_); |
313 has_video_ = true; | 313 has_video_ = true; |
314 video_track_id_ = track->header.track_id; | 314 video_track_id_ = track->header.track_id; |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 RCHECK(config_cb_.Run(audio_config, video_config, TextTrackConfigMap())); | 318 RCHECK(config_cb_.Run(audio_config, video_config, TextTrackConfigMap())); |
319 | 319 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return false; | 470 return false; |
471 } | 471 } |
472 subsamples = decrypt_config->subsamples(); | 472 subsamples = decrypt_config->subsamples(); |
473 } | 473 } |
474 | 474 |
475 std::vector<uint8> frame_buf(buf, buf + runs_->sample_size()); | 475 std::vector<uint8> frame_buf(buf, buf + runs_->sample_size()); |
476 if (video) { | 476 if (video) { |
477 DCHECK(runs_->video_description().frame_bitstream_converter); | 477 DCHECK(runs_->video_description().frame_bitstream_converter); |
478 if (!runs_->video_description().frame_bitstream_converter->ConvertFrame( | 478 if (!runs_->video_description().frame_bitstream_converter->ConvertFrame( |
479 &frame_buf, runs_->is_keyframe(), &subsamples)) { | 479 &frame_buf, runs_->is_keyframe(), &subsamples)) { |
480 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AVC sample for decode"; | 480 MEDIA_LOG(ERROR, media_log_) |
| 481 << "Failed to prepare video sample for decode"; |
481 *err = true; | 482 *err = true; |
482 return false; | 483 return false; |
483 } | 484 } |
484 } | 485 } |
485 | 486 |
486 if (audio) { | 487 if (audio) { |
487 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) && | 488 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) && |
488 !PrepareAACBuffer(runs_->audio_description().esds.aac, | 489 !PrepareAACBuffer(runs_->audio_description().esds.aac, |
489 &frame_buf, &subsamples)) { | 490 &frame_buf, &subsamples)) { |
490 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode"; | 491 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode"; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 runs.AdvanceSample(); | 620 runs.AdvanceSample(); |
620 } | 621 } |
621 runs.AdvanceRun(); | 622 runs.AdvanceRun(); |
622 } | 623 } |
623 | 624 |
624 return true; | 625 return true; |
625 } | 626 } |
626 | 627 |
627 } // namespace mp4 | 628 } // namespace mp4 |
628 } // namespace media | 629 } // namespace media |
OLD | NEW |