From ef81be5f7b5c24fdda779cee272bb45777b7800e Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 14 Mar 2016 17:42:40 -0700 Subject: [PATCH] Fix a subsample incorrect size bug in mp4 encryption Clear size was not correctly calculated for non-video slice nal units. Change-Id: I8371973a4ae346cbe4c1891ab274fb7a86983db8 --- .../bear-640x360-hevc-v-cenc-golden.mp4 | Bin 92793 -> 92793 bytes .../formats/mp4/encrypting_fragmenter.cc | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packager/app/test/testdata/bear-640x360-hevc-v-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-hevc-v-cenc-golden.mp4 index 49051edf819e7918dbb0b378faaffd901f4437a6..fef674ed99cf6e6bbe0176c84ece2bbc02797042 100644 GIT binary patch delta 290 zcmex)h4tqZ)(vaQ8RI9fEth8$nS8cfUs00*2#ifk&CD$<%@`ONE0Or-K)&^4*$REZ zn@FP842%qaCdXFjGfGbG1>IM{DKbf~uUvLYOs25Ol)nwmF zea5!UwUv|G8PlcL5|{zwM^1SCL_ delta 290 zcmex)h4tqZ)(vaQ8KWn!Eth8$n0&TeUs06-2#ifk&CD$<%@`ONOOg2IK)(58*$REZ zt4N~O42%pvCdXFjGm1{`1IM{DJ(;&sUvLAGs25Ol*<{~J zea5EEwUv|G8Iz_9GBWB5?n6=&1XR;EJrE=ujU*ff6jq-;5hN^wBpd~F*`MhbLBd~= jgyVq1OQs7lG3qm(o$d&v1m%!qQ-QL_w>L5|{zwM^0vkaj diff --git a/packager/media/formats/mp4/encrypting_fragmenter.cc b/packager/media/formats/mp4/encrypting_fragmenter.cc index 1138da290b..0abfa2cde0 100644 --- a/packager/media/formats/mp4/encrypting_fragmenter.cc +++ b/packager/media/formats/mp4/encrypting_fragmenter.cc @@ -257,7 +257,8 @@ Status EncryptingFragmenter::EncryptSample(scoped_refptr sample) { accumulated_clear_bytes = 0; } else { // For non-video-slice NAL units, don't encrypt. - accumulated_clear_bytes += nalu.header_size() + nalu.payload_size(); + accumulated_clear_bytes += + nalu_length_size_ + nalu.header_size() + nalu.payload_size(); } } if (result != NaluReader::kEOStream)