Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 379983002: Fix AnnexB validation logic to work with encrypted content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comment Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/formats/mp4/avc_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 (*subsamples)[i].clear_bytes += nalu_size_diff; 376 (*subsamples)[i].clear_bytes += nalu_size_diff;
377 } 377 }
378 378
379 if (runs_->is_keyframe()) { 379 if (runs_->is_keyframe()) {
380 // If this is a keyframe, we (re-)inject SPS and PPS headers at the start of 380 // If this is a keyframe, we (re-)inject SPS and PPS headers at the start of
381 // a frame. If subsample info is present, we also update the clear byte 381 // a frame. If subsample info is present, we also update the clear byte
382 // count for that first subsample. 382 // count for that first subsample.
383 RCHECK(AVC::InsertParamSetsAnnexB(avc_config, frame_buf, subsamples)); 383 RCHECK(AVC::InsertParamSetsAnnexB(avc_config, frame_buf, subsamples));
384 } 384 }
385 385
386 // TODO(acolwell): Improve IsValidAnnexB() so it can handle encrypted content. 386 DCHECK(AVC::IsValidAnnexB(*frame_buf, *subsamples));
387 DCHECK(runs_->is_encrypted() || AVC::IsValidAnnexB(*frame_buf));
388 return true; 387 return true;
389 } 388 }
390 389
391 bool MP4StreamParser::PrepareAACBuffer( 390 bool MP4StreamParser::PrepareAACBuffer(
392 const AAC& aac_config, std::vector<uint8>* frame_buf, 391 const AAC& aac_config, std::vector<uint8>* frame_buf,
393 std::vector<SubsampleEntry>* subsamples) const { 392 std::vector<SubsampleEntry>* subsamples) const {
394 // Append an ADTS header to every audio sample. 393 // Append an ADTS header to every audio sample.
395 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf)); 394 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf));
396 395
397 // As above, adjust subsample information to account for the headers. AAC is 396 // As above, adjust subsample information to account for the headers. AAC is
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 runs.AdvanceSample(); 626 runs.AdvanceSample();
628 } 627 }
629 runs.AdvanceRun(); 628 runs.AdvanceRun();
630 } 629 }
631 630
632 return true; 631 return true;
633 } 632 }
634 633
635 } // namespace mp4 634 } // namespace mp4
636 } // namespace media 635 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/avc_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698