| 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 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 decrypt_config = runs_->GetDecryptConfig(); | 542 decrypt_config = runs_->GetDecryptConfig(); |
| 543 if (!decrypt_config) { | 543 if (!decrypt_config) { |
| 544 *err = true; | 544 *err = true; |
| 545 return false; | 545 return false; |
| 546 } | 546 } |
| 547 subsamples = decrypt_config->subsamples(); | 547 subsamples = decrypt_config->subsamples(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 std::vector<uint8_t> frame_buf(buf, buf + runs_->sample_size()); | 550 std::vector<uint8_t> frame_buf(buf, buf + runs_->sample_size()); |
| 551 if (video) { | 551 if (video) { |
| 552 if (runs_->video_description().video_codec == kCodecH264 || | 552 DCHECK(runs_->video_description().frame_bitstream_converter); |
| 553 runs_->video_description().video_codec == kCodecHEVC) { | 553 if (!runs_->video_description().frame_bitstream_converter->ConvertFrame( |
| 554 DCHECK(runs_->video_description().frame_bitstream_converter); | 554 &frame_buf, runs_->is_keyframe(), &subsamples)) { |
| 555 if (!runs_->video_description().frame_bitstream_converter->ConvertFrame( | 555 MEDIA_LOG(ERROR, media_log_) |
| 556 &frame_buf, runs_->is_keyframe(), &subsamples)) { | 556 << "Failed to prepare video sample for decode"; |
| 557 MEDIA_LOG(ERROR, media_log_) | 557 *err = true; |
| 558 << "Failed to prepare video sample for decode"; | 558 return false; |
| 559 *err = true; | |
| 560 return false; | |
| 561 } | |
| 562 } | 559 } |
| 563 } | 560 } |
| 564 | 561 |
| 565 if (audio) { | 562 if (audio) { |
| 566 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) && | 563 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) && |
| 567 !PrepareAACBuffer(runs_->audio_description().esds.aac, | 564 !PrepareAACBuffer(runs_->audio_description().esds.aac, |
| 568 &frame_buf, &subsamples)) { | 565 &frame_buf, &subsamples)) { |
| 569 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode"; | 566 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode"; |
| 570 *err = true; | 567 *err = true; |
| 571 return false; | 568 return false; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 runs.AdvanceSample(); | 695 runs.AdvanceSample(); |
| 699 } | 696 } |
| 700 runs.AdvanceRun(); | 697 runs.AdvanceRun(); |
| 701 } | 698 } |
| 702 | 699 |
| 703 return true; | 700 return true; |
| 704 } | 701 } |
| 705 | 702 |
| 706 } // namespace mp4 | 703 } // namespace mp4 |
| 707 } // namespace media | 704 } // namespace media |
| OLD | NEW |