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