| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 decrypt_config = runs_->GetDecryptConfig(); | 503 decrypt_config = runs_->GetDecryptConfig(); |
| 504 if (!decrypt_config) { | 504 if (!decrypt_config) { |
| 505 *err = true; | 505 *err = true; |
| 506 return false; | 506 return false; |
| 507 } | 507 } |
| 508 subsamples = decrypt_config->subsamples(); | 508 subsamples = decrypt_config->subsamples(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 std::vector<uint8_t> frame_buf(buf, buf + runs_->sample_size()); | 511 std::vector<uint8_t> frame_buf(buf, buf + runs_->sample_size()); |
| 512 if (video) { | 512 if (video) { |
| 513 DCHECK(runs_->video_description().frame_bitstream_converter); | 513 if (runs_->video_description().video_codec == kCodecH264 || |
| 514 if (!runs_->video_description().frame_bitstream_converter->ConvertFrame( | 514 runs_->video_description().video_codec == kCodecHEVC) { |
| 515 &frame_buf, runs_->is_keyframe(), &subsamples)) { | 515 DCHECK(runs_->video_description().frame_bitstream_converter); |
| 516 MEDIA_LOG(ERROR, media_log_) | 516 if (!runs_->video_description().frame_bitstream_converter->ConvertFrame( |
| 517 << "Failed to prepare video sample for decode"; | 517 &frame_buf, runs_->is_keyframe(), &subsamples)) { |
| 518 *err = true; | 518 MEDIA_LOG(ERROR, media_log_) |
| 519 return false; | 519 << "Failed to prepare video sample for decode"; |
| 520 *err = true; |
| 521 return false; |
| 522 } |
| 520 } | 523 } |
| 521 } | 524 } |
| 522 | 525 |
| 523 if (audio) { | 526 if (audio) { |
| 524 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) && | 527 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) && |
| 525 !PrepareAACBuffer(runs_->audio_description().esds.aac, | 528 !PrepareAACBuffer(runs_->audio_description().esds.aac, |
| 526 &frame_buf, &subsamples)) { | 529 &frame_buf, &subsamples)) { |
| 527 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode"; | 530 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode"; |
| 528 *err = true; | 531 *err = true; |
| 529 return false; | 532 return false; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 runs.AdvanceSample(); | 659 runs.AdvanceSample(); |
| 657 } | 660 } |
| 658 runs.AdvanceRun(); | 661 runs.AdvanceRun(); |
| 659 } | 662 } |
| 660 | 663 |
| 661 return true; | 664 return true; |
| 662 } | 665 } |
| 663 | 666 |
| 664 } // namespace mp4 | 667 } // namespace mp4 |
| 665 } // namespace media | 668 } // namespace media |
| OLD | NEW |