| 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.h" | 7 #include "base/callback.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 (*subsamples)[i].clear_bytes += nalu_size_diff; | 375 (*subsamples)[i].clear_bytes += nalu_size_diff; |
| 376 } | 376 } |
| 377 | 377 |
| 378 if (runs_->is_keyframe()) { | 378 if (runs_->is_keyframe()) { |
| 379 // If this is a keyframe, we (re-)inject SPS and PPS headers at the start of | 379 // If this is a keyframe, we (re-)inject SPS and PPS headers at the start of |
| 380 // a frame. If subsample info is present, we also update the clear byte | 380 // a frame. If subsample info is present, we also update the clear byte |
| 381 // count for that first subsample. | 381 // count for that first subsample. |
| 382 RCHECK(AVC::InsertParamSetsAnnexB(avc_config, frame_buf, subsamples)); | 382 RCHECK(AVC::InsertParamSetsAnnexB(avc_config, frame_buf, subsamples)); |
| 383 } | 383 } |
| 384 | 384 |
| 385 // TODO(acolwell): Improve IsValidAnnexB() so it can handle encrypted content. | 385 DCHECK(AVC::IsValidAnnexB(*frame_buf, *subsamples)); |
| 386 DCHECK(runs_->is_encrypted() || AVC::IsValidAnnexB(*frame_buf)); | |
| 387 return true; | 386 return true; |
| 388 } | 387 } |
| 389 | 388 |
| 390 bool MP4StreamParser::PrepareAACBuffer( | 389 bool MP4StreamParser::PrepareAACBuffer( |
| 391 const AAC& aac_config, std::vector<uint8>* frame_buf, | 390 const AAC& aac_config, std::vector<uint8>* frame_buf, |
| 392 std::vector<SubsampleEntry>* subsamples) const { | 391 std::vector<SubsampleEntry>* subsamples) const { |
| 393 // Append an ADTS header to every audio sample. | 392 // Append an ADTS header to every audio sample. |
| 394 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf)); | 393 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf)); |
| 395 | 394 |
| 396 // As above, adjust subsample information to account for the headers. AAC is | 395 // As above, adjust subsample information to account for the headers. AAC is |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 runs.AdvanceSample(); | 625 runs.AdvanceSample(); |
| 627 } | 626 } |
| 628 runs.AdvanceRun(); | 627 runs.AdvanceRun(); |
| 629 } | 628 } |
| 630 | 629 |
| 631 return true; | 630 return true; |
| 632 } | 631 } |
| 633 | 632 |
| 634 } // namespace mp4 | 633 } // namespace mp4 |
| 635 } // namespace media | 634 } // namespace media |
| OLD | NEW |