diff --git a/packager/app/test/testdata/bear-320x180-a-wvm-golden.mp4 b/packager/app/test/testdata/bear-320x180-a-wvm-golden.mp4
index 1de4b6a9e8..372bb7827e 100644
Binary files a/packager/app/test/testdata/bear-320x180-a-wvm-golden.mp4 and b/packager/app/test/testdata/bear-320x180-a-wvm-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-320x180-avc3-wvm-golden.mp4 b/packager/app/test/testdata/bear-320x180-avc3-wvm-golden.mp4
index 5dfff29f96..7c24e9e509 100644
Binary files a/packager/app/test/testdata/bear-320x180-avc3-wvm-golden.mp4 and b/packager/app/test/testdata/bear-320x180-avc3-wvm-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-320x180-v-wvm-golden.mp4 b/packager/app/test/testdata/bear-320x180-v-wvm-golden.mp4
index 9e3752e3b3..f2db8721e4 100644
Binary files a/packager/app/test/testdata/bear-320x180-v-wvm-golden.mp4 and b/packager/app/test/testdata/bear-320x180-v-wvm-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd
index 7afe2db741..2c08704556 100644
--- a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd
@@ -10,7 +10,7 @@
output_audio.mp4
-
+
@@ -22,7 +22,7 @@
output_video.mp4
-
+
diff --git a/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4 b/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4
index 1e611f0a64..199276410d 100644
Binary files a/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4 and b/packager/app/test/testdata/bear-320x240-vp9-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-320x240-vp9-golden.mp4 b/packager/app/test/testdata/bear-320x240-vp9-golden.mp4
index eb37055756..a7190fb201 100644
Binary files a/packager/app/test/testdata/bear-320x240-vp9-golden.mp4 and b/packager/app/test/testdata/bear-320x240-vp9-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd
index e076235af7..6dc1619cad 100644
--- a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd
+++ b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd
@@ -6,7 +6,7 @@
output_audio.webm
-
+
@@ -14,7 +14,7 @@
output_video.webm
-
+
diff --git a/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd
index 343e19815b..f68d3d8392 100644
--- a/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-a-wvm-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-wvm-golden.mp4
index d7a846f1b8..c5ec848107 100644
Binary files a/packager/app/test/testdata/bear-640x360-a-wvm-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-wvm-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 b/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4
index 3c4ec7a4b0..84a7c72c98 100644
Binary files a/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 and b/packager/app/test/testdata/bear-640x360-ac3-from-ts-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd
index 95f82e1034..42d7148ecd 100644
--- a/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd
index be8c59ecc9..4de893cb06 100644
--- a/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd
index 4a943da447..088ce48969 100644
--- a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd
@@ -1,7 +1,7 @@
-
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd
index d53ce856cc..9b31d76eed 100644
--- a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd
index 3fc1016025..1532a60109 100644
--- a/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd
index 3fd3a0c4a8..c5f0dae86d 100644
--- a/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd
index 5a14de9678..c374be4333 100644
--- a/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd
index 8280a41d19..868c42aada 100644
--- a/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-golden.mpd b/packager/app/test/testdata/bear-640x360-av-golden.mpd
index 7ca5c607af..6e8cd992f3 100644
--- a/packager/app/test/testdata/bear-640x360-av-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd
index b904b4dde3..9849d82ef7 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-golden.mpd
@@ -7,10 +7,11 @@
AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA==
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd
index 7358bb9452..41e66c930f 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-non-iop-golden.mpd
@@ -3,14 +3,15 @@
-
+
AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA==
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd
index e9c4348da4..e9af6691d3 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-golden.mpd
@@ -5,10 +5,11 @@
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd
index 9265f2e191..59ef0f3a3d 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-no-pssh-golden.mpd
@@ -5,10 +5,11 @@
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd
index 81eb4d90d5..1244a592b8 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-cenc-rotation-non-iop-golden.mpd
@@ -3,12 +3,13 @@
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-golden.mpd
index 4faf8e66e8..5a0e4cdfca 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-golden.mpd
@@ -3,10 +3,11 @@
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd
index 4cd8f2669c..55f6ce4224 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd
@@ -1,12 +1,13 @@
-
-
+
+
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd
index 377d854878..a4c435e0b0 100644
--- a/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd
@@ -1,12 +1,13 @@
-
+
-
+
-
+
+
diff --git a/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd b/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd
index 641a9c4b2f..1a9fb6efcf 100644
--- a/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-por-golden.mpd b/packager/app/test/testdata/bear-640x360-av-por-golden.mpd
index 641a9c4b2f..1a9fb6efcf 100644
--- a/packager/app/test/testdata/bear-640x360-av-por-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-por-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd
index 3b1204aa54..8f9472fd1e 100644
--- a/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd
index 9bd9928649..1a4c7f37c2 100644
--- a/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd
index d1d8946925..5d16b77220 100644
--- a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd
index a42099b0ca..aa49b8ae1b 100644
--- a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-avc3-wvm-golden.mp4 b/packager/app/test/testdata/bear-640x360-avc3-wvm-golden.mp4
index 1c0e5237cf..9553f9bd8d 100644
Binary files a/packager/app/test/testdata/bear-640x360-avc3-wvm-golden.mp4 and b/packager/app/test/testdata/bear-640x360-avc3-wvm-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-avt-golden.mpd b/packager/app/test/testdata/bear-640x360-avt-golden.mpd
index eee7f2db58..0160496a93 100644
--- a/packager/app/test/testdata/bear-640x360-avt-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-avt-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-ec3-v-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-ec3-v-cenc-golden.mp4
index e883a5eac5..ea10e135b3 100644
Binary files a/packager/app/test/testdata/bear-640x360-ec3-v-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-ec3-v-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-ec3-v-mp4-cenc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-ec3-v-mp4-cenc-golden.m3u8
index cdf5fa0ee4..2eddc6f85a 100644
--- a/packager/app/test/testdata/bear-640x360-ec3-v-mp4-cenc-golden.m3u8
+++ b/packager/app/test/testdata/bear-640x360-ec3-v-mp4-cenc-golden.m3u8
@@ -5,7 +5,7 @@
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="output_video.mp4",BYTERANGE="1091@0"
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity"
-#EXTINF:1.001,
+#EXTINF:1.068,
#EXT-X-BYTERANGE:93805@1159
output_video.mp4
#EXTINF:1.001,
diff --git a/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mp4
index ba921f6214..b98897e81a 100644
Binary files a/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd
index b8cf07df80..af7f20c348 100644
--- a/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-hevc-golden.mp4 b/packager/app/test/testdata/bear-640x360-hevc-golden.mp4
index 69170b8652..b18ed17f70 100644
Binary files a/packager/app/test/testdata/bear-640x360-hevc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-hevc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cbc1-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cbc1-golden.mp4
index 1edc8ecddc..8cbfc316ca 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cbc1-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cbc1-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cbcs-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cbcs-golden.mp4
index 246a814ab0..59c5ade794 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cbcs-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cbcs-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cenc-ad_cues-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cenc-ad_cues-golden.mp4
index 43bfd90f1f..cebb14a0e8 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cenc-ad_cues-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cenc-ad_cues-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cenc-golden.mp4
index 43bfd90f1f..cebb14a0e8 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cenc-no-clear-lead-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cenc-no-clear-lead-golden.mp4
index 95418131de..60f4e6f5b3 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cenc-no-clear-lead-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cenc-no-clear-lead-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cenc-no-pssh-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cenc-no-pssh-golden.mp4
index 17b831df78..daececa166 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cenc-no-pssh-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cenc-no-pssh-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-cens-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cens-golden.mp4
index adee9cfc8c..07f0dc14dc 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-cens-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-cens-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4
index 62124d237d..6964da6920 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-from-ts-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-golden.mp4
index a4315c32cb..9ea15d763d 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-golden.mpd b/packager/app/test/testdata/bear-640x360-v-golden.mpd
index b9db914379..ae604225bb 100644
--- a/packager/app/test/testdata/bear-640x360-v-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-v-golden.mpd
@@ -1,6 +1,6 @@
-
+
diff --git a/packager/app/test/testdata/bear-640x360-v-live-ad_cues-golden-1.m4s b/packager/app/test/testdata/bear-640x360-v-live-ad_cues-golden-1.m4s
index e8a21a613c..82605ec2c3 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-live-ad_cues-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-v-live-ad_cues-golden-1.m4s differ
diff --git a/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-1.m4s b/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-1.m4s
index c8e0ec8cfa..eddc48d4b1 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-1.m4s differ
diff --git a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-1.m4s b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-1.m4s
index 5ff1a7ced3..6fcbc85250 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-1.m4s differ
diff --git a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-1.m4s b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-1.m4s
index c8e0ec8cfa..eddc48d4b1 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-1.m4s differ
diff --git a/packager/app/test/testdata/bear-640x360-v-live-golden-1.m4s b/packager/app/test/testdata/bear-640x360-v-live-golden-1.m4s
index e8a21a613c..82605ec2c3 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-live-golden-1.m4s and b/packager/app/test/testdata/bear-640x360-v-live-golden-1.m4s differ
diff --git a/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8 b/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8
index 99442c7fdd..74b9eaed2f 100644
--- a/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8
+++ b/packager/app/test/testdata/bear-640x360-v-mp4-cenc-ad_cues-golden.m3u8
@@ -5,7 +5,7 @@
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="output_video.mp4",BYTERANGE="1091@0"
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity"
-#EXTINF:1.001,
+#EXTINF:1.068,
#EXT-X-BYTERANGE:99313@1159
output_video.mp4
#EXTINF:1.001,
diff --git a/packager/app/test/testdata/bear-640x360-v-mp4-cenc-golden.m3u8 b/packager/app/test/testdata/bear-640x360-v-mp4-cenc-golden.m3u8
index 2cfe6ed71d..e9bf00a372 100644
--- a/packager/app/test/testdata/bear-640x360-v-mp4-cenc-golden.m3u8
+++ b/packager/app/test/testdata/bear-640x360-v-mp4-cenc-golden.m3u8
@@ -5,7 +5,7 @@
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="output_video.mp4",BYTERANGE="1091@0"
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity"
-#EXTINF:1.001,
+#EXTINF:1.068,
#EXT-X-BYTERANGE:99313@1159
output_video.mp4
#EXTINF:1.001,
diff --git a/packager/app/test/testdata/bear-640x360-v-mp4-golden.m3u8 b/packager/app/test/testdata/bear-640x360-v-mp4-golden.m3u8
index 0f3fbe7f5a..2c0c3d4ea0 100644
--- a/packager/app/test/testdata/bear-640x360-v-mp4-golden.m3u8
+++ b/packager/app/test/testdata/bear-640x360-v-mp4-golden.m3u8
@@ -4,7 +4,7 @@
#EXT-X-TARGETDURATION:2
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="video-init.mp4"
-#EXTINF:1.001,
+#EXTINF:1.068,
video-1.m4s
#EXTINF:1.001,
video-2.m4s
diff --git a/packager/app/test/testdata/bear-640x360-v-trick-1-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-trick-1-cenc-golden.mp4
index c6251150ff..ce0e437d68 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-trick-1-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-trick-1-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-trick-1-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-trick-1-golden.mp4
index 60407efb5f..0473a61a76 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-trick-1-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-trick-1-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-trick-2-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-trick-2-cenc-golden.mp4
index e4d1f9556e..09bc5d4668 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-trick-2-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-trick-2-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-trick-2-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-trick-2-golden.mp4
index 078bad9cc8..5279433a2b 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-trick-2-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-trick-2-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8 b/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8
index bfd8860da6..6d0b158b5c 100644
--- a/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8
+++ b/packager/app/test/testdata/bear-640x360-v-ts-to-mp4-golden.m3u8
@@ -4,7 +4,7 @@
#EXT-X-TARGETDURATION:2
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="output_video.mp4",BYTERANGE="823@0"
-#EXTINF:1.001,
+#EXTINF:1.068,
#EXT-X-BYTERANGE:99313@891
output_video.mp4
#EXTINF:1.001,
diff --git a/packager/app/test/testdata/bear-640x360-v-wvm-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-wvm-golden.mp4
index ba70a00d9b..11b3f13f93 100644
Binary files a/packager/app/test/testdata/bear-640x360-v-wvm-golden.mp4 and b/packager/app/test/testdata/bear-640x360-v-wvm-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4
index 8c3c919a13..dbfd1689cc 100644
Binary files a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd
index c16081d09c..aa01398514 100644
--- a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd
@@ -9,7 +9,7 @@
output_video.mp4
-
+
diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd
index 2aea967717..0b3ec13441 100644
--- a/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd
@@ -8,7 +8,7 @@
output_video.webm
-
+
diff --git a/packager/app/test/testdata/bear-640x360-vp8-golden.mp4 b/packager/app/test/testdata/bear-640x360-vp8-golden.mp4
index 8c51125bac..e5033f940a 100644
Binary files a/packager/app/test/testdata/bear-640x360-vp8-golden.mp4 and b/packager/app/test/testdata/bear-640x360-vp8-golden.mp4 differ
diff --git a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd
index 27a9bea604..555d6c283c 100644
--- a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd
+++ b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd
@@ -5,7 +5,7 @@
output_video.webm
-
+
diff --git a/packager/app/test/testdata/bear-avc3-wvm-golden.mpd b/packager/app/test/testdata/bear-avc3-wvm-golden.mpd
index a44577f4b0..66b6b9bf71 100644
--- a/packager/app/test/testdata/bear-avc3-wvm-golden.mpd
+++ b/packager/app/test/testdata/bear-avc3-wvm-golden.mpd
@@ -1,17 +1,17 @@
-
+
output_0.mp4
-
+
output_2.mp4
-
+
@@ -20,14 +20,14 @@
output_1.mp4
-
+
output_3.mp4
-
+
diff --git a/packager/app/test/testdata/bear-wvm-golden.mpd b/packager/app/test/testdata/bear-wvm-golden.mpd
index bb0cd8b4d2..7abea46a19 100644
--- a/packager/app/test/testdata/bear-wvm-golden.mpd
+++ b/packager/app/test/testdata/bear-wvm-golden.mpd
@@ -1,17 +1,17 @@
-
+
output_0.mp4
-
+
output_2.mp4
-
+
@@ -20,14 +20,14 @@
output_1.mp4
-
+
output_3.mp4
-
+
diff --git a/packager/media/formats/mp4/fragmenter.cc b/packager/media/formats/mp4/fragmenter.cc
index 166abb4c79..d637e467ce 100644
--- a/packager/media/formats/mp4/fragmenter.cc
+++ b/packager/media/formats/mp4/fragmenter.cc
@@ -6,6 +6,7 @@
#include "packager/media/formats/mp4/fragmenter.h"
+#include
#include
#include "packager/media/base/audio_stream_info.h"
@@ -150,6 +151,24 @@ Status Fragmenter::FinalizeFragment() {
return status;
}
+ if (first_fragment_) {
+ // Chrome (as of v66 https://crbug.com/398141) does not like negative values
+ // for adjusted dts = dts + Period@start (0 for first Period)
+ // - presentationTimeOffset
+ // Since |earliest_presentation_time| of the first fragment will be used to
+ // set presentationTimeOffset, the adjusted dts can become negative for the
+ // frames in the first segment in the first Period. To avoid seeing that,
+ // |earliest_presentation_time| is adjusted so it is not larger than the
+ // dts.
+ const int64_t dts = traf_->decode_time.decode_time;
+ if (earliest_presentation_time_ > dts) {
+ const uint64_t delta = earliest_presentation_time_ - dts;
+ earliest_presentation_time_ = dts;
+ fragment_duration_ += delta;
+ }
+ first_fragment_ = false;
+ }
+
// Optimize trun box.
traf_->runs[0].sample_count =
static_cast(traf_->runs[0].sample_sizes.size());
@@ -208,7 +227,7 @@ Status Fragmenter::FinalizeFragment() {
return Status::OK;
}
-void Fragmenter::GenerateSegmentReference(SegmentReference* reference) {
+void Fragmenter::GenerateSegmentReference(SegmentReference* reference) const {
// NOTE: Daisy chain is not supported currently.
reference->reference_type = false;
reference->subsegment_duration = fragment_duration_;
@@ -275,7 +294,7 @@ Status Fragmenter::FinalizeFragmentForEncryption() {
return Status::OK;
}
-bool Fragmenter::StartsWithSAP() {
+bool Fragmenter::StartsWithSAP() const {
DCHECK(!traf_->runs.empty());
uint32_t start_sample_flag;
if (traf_->runs[0].flags & TrackFragmentRun::kSampleFlagsPresentMask) {
diff --git a/packager/media/formats/mp4/fragmenter.h b/packager/media/formats/mp4/fragmenter.h
index 8870077754..4edf5c116b 100644
--- a/packager/media/formats/mp4/fragmenter.h
+++ b/packager/media/formats/mp4/fragmenter.h
@@ -51,7 +51,7 @@ class Fragmenter {
Status FinalizeFragment();
/// Fill @a reference with current fragment information.
- void GenerateSegmentReference(SegmentReference* reference);
+ void GenerateSegmentReference(SegmentReference* reference) const;
void ClearFragmentFinalized() { fragment_finalized_ = false; }
@@ -88,7 +88,7 @@ class Fragmenter {
private:
Status FinalizeFragmentForEncryption();
// Check if the current fragment starts with SAP.
- bool StartsWithSAP();
+ bool StartsWithSAP() const;
std::shared_ptr stream_info_;
bool use_decoding_timestamp_in_timeline_;
@@ -98,6 +98,7 @@ class Fragmenter {
bool fragment_finalized_;
uint64_t fragment_duration_;
int64_t earliest_presentation_time_;
+ bool first_fragment_ = true;
int64_t first_sap_time_;
std::unique_ptr data_;
// Saves key frames information, for Video.
diff --git a/packager/media/formats/mp4/single_segment_segmenter.cc b/packager/media/formats/mp4/single_segment_segmenter.cc
index 409cdac680..7c54d9235a 100644
--- a/packager/media/formats/mp4/single_segment_segmenter.cc
+++ b/packager/media/formats/mp4/single_segment_segmenter.cc
@@ -196,25 +196,7 @@ Status SingleSegmentSegmenter::DoFinalizeSegment() {
vod_sidx_.reset(new SegmentIndex());
vod_sidx_->reference_id = sidx()->reference_id;
vod_sidx_->timescale = sidx()->timescale;
-
- if (vod_ref.earliest_presentation_time > 0) {
- const double starting_time_in_seconds =
- static_cast(vod_ref.earliest_presentation_time) /
- GetReferenceTimeScale();
- // Give a warning if it is significant.
- if (starting_time_in_seconds > 0.5) {
- // Note that DASH IF player requires presentationTimeOffset to be set in
- // Segment{Base,List,Template} if there is non-zero starting time. Since
- // current Chromium's MSE implementation uses DTS, the player expects
- // DTS to be used.
- LOG(WARNING) << "Warning! Non-zero starting time (in seconds): "
- << starting_time_in_seconds
- << ". Manual adjustment of presentationTimeOffset in "
- "mpd might be necessary.";
- }
- }
- // Force earliest_presentation_time to start from 0 for VOD.
- vod_sidx_->earliest_presentation_time = 0;
+ vod_sidx_->earliest_presentation_time = vod_ref.earliest_presentation_time;
}
vod_sidx_->references.push_back(vod_ref);
diff --git a/packager/mpd/base/mpd_builder.cc b/packager/mpd/base/mpd_builder.cc
index b1fc1656d7..c3853478f3 100644
--- a/packager/mpd/base/mpd_builder.cc
+++ b/packager/mpd/base/mpd_builder.cc
@@ -338,7 +338,6 @@ bool MpdBuilder::GetEarliestTimestamp(double* timestamp_seconds) {
void MpdBuilder::UpdatePeriodDurationAndPresentationTimestamp() {
DCHECK_EQ(MpdType::kStatic, mpd_options_.mpd_type);
- bool first_period = true;
for (const auto& period : periods_) {
std::list video_representations;
std::list non_video_representations;
@@ -378,21 +377,6 @@ void MpdBuilder::UpdatePeriodDurationAndPresentationTimestamp() {
period->set_duration_seconds(*latest_end_time - *earliest_start_time);
double presentation_time_offset = *earliest_start_time;
- if (first_period) {
- first_period = false;
- // Chrome does not like negative dts (https://crbug.com/398141).
- // Always set presentationTimeOffset (pto) to 0 for the first period as it
- // may result in an error on Chrome v63.0.3239.132 if it sets to a non
- // zero value.
- // It is fine with subsequent periods as the actual offset applied takes
- // Period@start into consideration:
- // offset = Period@start - presentationTimeOffset
- // The result timestamp with offset applied is close to Period@start, so
- // it is unlikely to result in a negative dts value.
- // TODO(kqyang): Set the pto to |dts| instead of always setting it to 0 to
- // workaround Chrome negative DTS bug.
- presentation_time_offset = 0;
- }
for (const auto& adaptation_set : period->GetAdaptationSets()) {
for (const auto& representation : adaptation_set->GetRepresentations()) {
representation->SetPresentationTimeOffset(presentation_time_offset);
diff --git a/packager/mpd/base/mpd_builder_unittest.cc b/packager/mpd/base/mpd_builder_unittest.cc
index 288354025c..49fb4fc72d 100644
--- a/packager/mpd/base/mpd_builder_unittest.cc
+++ b/packager/mpd/base/mpd_builder_unittest.cc
@@ -174,6 +174,29 @@ TEST_F(OnDemandMpdBuilderTest, MediaInfoMissingBandwidth) {
ASSERT_FALSE(mpd_.ToString(&mpd_doc));
}
+TEST_F(OnDemandMpdBuilderTest, CheckXmlTest) {
+ // Disable pto adjustment.
+ FLAGS_pto_adjustment = 0;
+
+ const double kPeriod1StartTimeSeconds = 0.0;
+
+ // Actual period duration is determined by the segments not by the period
+ // start time above, which only provides an anchor point.
+ const double kPeriod1SegmentStartSeconds = 0.2;
+ const double kPeriod1SegmentDurationSeconds = 3.0;
+
+ Period* period = mpd_.GetOrCreatePeriod(kPeriod1StartTimeSeconds);
+ AddSegmentToPeriod(kPeriod1SegmentStartSeconds,
+ kPeriod1SegmentDurationSeconds, period);
+
+ std::string mpd_doc;
+ ASSERT_TRUE(mpd_.ToString(&mpd_doc));
+ EXPECT_THAT(mpd_doc, HasSubstr("\n"));
+ EXPECT_THAT(mpd_doc,
+ HasSubstr(""));
+}
+
TEST_F(OnDemandMpdBuilderTest, MultiplePeriodTest) {
const double kPeriodStartTimeSeconds = 1.0;
Period* period = mpd_.GetOrCreatePeriod(kPeriodStartTimeSeconds);
@@ -226,17 +249,19 @@ TEST_F(OnDemandMpdBuilderTest, MultiplePeriodCheckXmlTest) {
std::string mpd_doc;
ASSERT_TRUE(mpd_.ToString(&mpd_doc));
EXPECT_THAT(mpd_doc, HasSubstr("\n"));
+ EXPECT_THAT(mpd_doc,
+ HasSubstr(""));
+ EXPECT_THAT(mpd_doc, HasSubstr("\n"));
EXPECT_THAT(
mpd_doc,
- HasSubstr(""));
- EXPECT_THAT(mpd_doc, HasSubstr("\n"));
- EXPECT_THAT(mpd_doc,
- HasSubstr(""));
+ HasSubstr(""));
EXPECT_THAT(mpd_doc, HasSubstr("\n"));
- EXPECT_THAT(mpd_doc,
- HasSubstr(""));
+ EXPECT_THAT(
+ mpd_doc,
+ HasSubstr(""));
}
TEST_F(LiveMpdBuilderTest, MultiplePeriodCheckXmlTest) {