diff --git a/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 b/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 index 3522370065..646ae1c329 100644 Binary files a/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 and b/packager/app/test/testdata/bear-320x240-opus-cenc-golden.mp4 differ 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 3b3ccc2494..1e611f0a64 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-640x360-a-cbc1-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 index 4425400231..afd156b3f3 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cbc1-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 index 54071c85a3..e185a9f9f8 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cbcs-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 index e072c4019c..46e073eefe 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cenc-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 index 870e1cb3b3..fd6baf5aa9 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cenc-no-clear-lead-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 index d7fc496a8f..8da4e3efaf 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cenc-no-pssh-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 b/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 index b51c81193c..87236142e2 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 and b/packager/app/test/testdata/bear-640x360-a-cens-golden.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-init.mp4 index 5b8b64992e..8baf873921 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-init.mp4 and b/packager/app/test/testdata/bear-640x360-a-live-cenc-golden-init.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-init.mp4 index 1b003c389d..e0d23b00ae 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-init.mp4 and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-golden-init.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-init.mp4 index 1b003c389d..e0d23b00ae 100644 Binary files a/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-init.mp4 and b/packager/app/test/testdata/bear-640x360-a-live-cenc-rotation-no-pssh-golden-init.mp4 differ 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 ca1335d15e..ba921f6214 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-v-cbc1-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cbc1-golden.mp4 index 52993506af..1edc8ecddc 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 8bc2ea5aec..246a814ab0 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-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-cenc-golden.mp4 index 7573a77be8..43bfd90f1f 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 01bcc6be51..95418131de 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 69b13ea7c5..17b831df78 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 2f4f828aa0..adee9cfc8c 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-live-cenc-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-init.mp4 index 08e6c418ad..69d5615bdb 100644 Binary files a/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-init.mp4 and b/packager/app/test/testdata/bear-640x360-v-live-cenc-golden-init.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-init.mp4 index c3a9ab7a21..cfbd64015f 100644 Binary files a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-init.mp4 and b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-golden-init.mp4 differ diff --git a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-init.mp4 b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-init.mp4 index c3a9ab7a21..cfbd64015f 100644 Binary files a/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-init.mp4 and b/packager/app/test/testdata/bear-640x360-v-live-cenc-rotation-no-pssh-golden-init.mp4 differ 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 2a96070111..c6251150ff 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-2-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-v-trick-2-cenc-golden.mp4 index e8daf0b08e..e4d1f9556e 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-vp8-cenc-golden.mp4 b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mp4 index 6608e03f64..8c3c919a13 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/media/formats/mp4/box_definitions.cc b/packager/media/formats/mp4/box_definitions.cc index bf94410b8b..331c0c2fb9 100644 --- a/packager/media/formats/mp4/box_definitions.cc +++ b/packager/media/formats/mp4/box_definitions.cc @@ -1556,16 +1556,14 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) { RCHECK(buffer->PrepareChildren()); - if (format == FOURCC_encv) { - if (buffer->Reading()) { - // Continue scanning until a supported protection scheme is found, or - // until we run out of protection schemes. - while (!IsProtectionSchemeSupported(sinf.type.type)) - RCHECK(buffer->ReadWriteChild(&sinf)); - } else { - DCHECK(IsProtectionSchemeSupported(sinf.type.type)); + // This has to happen before reading codec configuration box as the actual + // format is read from sinf.format.format, which is needed to parse the codec + // configuration box. + if (format == FOURCC_encv && buffer->Reading()) { + // Continue scanning until a supported protection scheme is found, or + // until we run out of protection schemes. + while (!IsProtectionSchemeSupported(sinf.type.type)) RCHECK(buffer->ReadWriteChild(&sinf)); - } } const FourCC actual_format = GetActualFormat(); @@ -1575,10 +1573,19 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) { DCHECK_EQ(codec_configuration.box_type, GetCodecConfigurationBoxType(actual_format)); } - DCHECK_NE(codec_configuration.box_type, FOURCC_NULL); + if (codec_configuration.box_type == FOURCC_NULL) + return false; RCHECK(buffer->ReadWriteChild(&codec_configuration)); RCHECK(buffer->TryReadWriteChild(&pixel_aspect)); + + // Somehow Edge does not support having sinf box before codec_configuration, + // box, so just do it in the end of VideoSampleEntry. See + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/ + if (format == FOURCC_encv && !buffer->Reading()) { + DCHECK(IsProtectionSchemeSupported(sinf.type.type)); + RCHECK(buffer->ReadWriteChild(&sinf)); + } return true; } @@ -1805,6 +1812,16 @@ bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) { samplerate >>= 16; RCHECK(buffer->PrepareChildren()); + + RCHECK(buffer->TryReadWriteChild(&esds)); + RCHECK(buffer->TryReadWriteChild(&ddts)); + RCHECK(buffer->TryReadWriteChild(&dac3)); + RCHECK(buffer->TryReadWriteChild(&dec3)); + RCHECK(buffer->TryReadWriteChild(&dops)); + + // Somehow Edge does not support having sinf box before codec_configuration, + // box, so just do it in the end of AudioSampleEntry. See + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/ if (format == FOURCC_enca) { if (buffer->Reading()) { // Continue scanning until a supported protection scheme is found, or @@ -1816,12 +1833,6 @@ bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) { RCHECK(buffer->ReadWriteChild(&sinf)); } } - - RCHECK(buffer->TryReadWriteChild(&esds)); - RCHECK(buffer->TryReadWriteChild(&ddts)); - RCHECK(buffer->TryReadWriteChild(&dac3)); - RCHECK(buffer->TryReadWriteChild(&dec3)); - RCHECK(buffer->TryReadWriteChild(&dops)); return true; }