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

Unified Diff: media/formats/mp4/avc.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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp4/avc.h ('k') | media/formats/mp4/avc_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/avc.cc
diff --git a/media/formats/mp4/avc.cc b/media/formats/mp4/avc.cc
index 6c2bc2a6fcabab937df14a2fdf78f9bdc43ce90b..4a9a880a9b5326e184fbf808f436d08a764acfcc 100644
--- a/media/formats/mp4/avc.cc
+++ b/media/formats/mp4/avc.cc
@@ -76,11 +76,11 @@ bool AVC::ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer) {
bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config,
std::vector<uint8>* buffer,
std::vector<SubsampleEntry>* subsamples) {
- DCHECK(AVC::IsValidAnnexB(*buffer));
+ DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples));
scoped_ptr<H264Parser> parser(new H264Parser());
const uint8* start = &(*buffer)[0];
- parser->SetStream(start, buffer->size());
+ parser->SetEncryptedStream(start, buffer->size(), *subsamples);
H264NALU nalu;
if (parser->AdvanceToNextNALU(&nalu) != H264Parser::kOk)
@@ -126,7 +126,7 @@ bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config,
buffer->insert(config_insert_point,
param_sets.begin(), param_sets.end());
- DCHECK(AVC::IsValidAnnexB(*buffer));
+ DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples));
return true;
}
@@ -171,11 +171,13 @@ bool AVC::ConvertConfigToAnnexB(
}
// Verifies AnnexB NALU order according to ISO/IEC 14496-10 Section 7.4.1.2.3
-bool AVC::IsValidAnnexB(const std::vector<uint8>& buffer) {
- return IsValidAnnexB(&buffer[0], buffer.size());
+bool AVC::IsValidAnnexB(const std::vector<uint8>& buffer,
+ const std::vector<SubsampleEntry>& subsamples) {
+ return IsValidAnnexB(&buffer[0], buffer.size(), subsamples);
}
-bool AVC::IsValidAnnexB(const uint8* buffer, size_t size) {
+bool AVC::IsValidAnnexB(const uint8* buffer, size_t size,
+ const std::vector<SubsampleEntry>& subsamples) {
DVLOG(1) << __FUNCTION__;
DCHECK(buffer);
@@ -183,7 +185,7 @@ bool AVC::IsValidAnnexB(const uint8* buffer, size_t size) {
return true;
H264Parser parser;
- parser.SetStream(buffer, size);
+ parser.SetEncryptedStream(buffer, size, subsamples);
typedef enum {
kAUDAllowed,
@@ -305,6 +307,5 @@ bool AVC::IsValidAnnexB(const uint8* buffer, size_t size) {
return order_state >= kAfterFirstVCL;
}
-
} // namespace mp4
} // namespace media
« no previous file with comments | « media/formats/mp4/avc.h ('k') | media/formats/mp4/avc_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698