Workaround Edge problem with non-zero clear lead

Somehow Edge requires sinf box to be put after avcC box:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/

b/37913785

Change-Id: I201c96768328b3910001dba49a9ddda7f06f3c20
This commit is contained in:
KongQun Yang 2017-07-06 11:53:44 -07:00
parent 627af1558e
commit 11210b400a
25 changed files with 27 additions and 16 deletions

View File

@ -1556,16 +1556,14 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(buffer->PrepareChildren()); RCHECK(buffer->PrepareChildren());
if (format == FOURCC_encv) { // This has to happen before reading codec configuration box as the actual
if (buffer->Reading()) { // format is read from sinf.format.format, which is needed to parse the codec
// Continue scanning until a supported protection scheme is found, or // configuration box.
// until we run out of protection schemes. if (format == FOURCC_encv && buffer->Reading()) {
while (!IsProtectionSchemeSupported(sinf.type.type)) // Continue scanning until a supported protection scheme is found, or
RCHECK(buffer->ReadWriteChild(&sinf)); // until we run out of protection schemes.
} else { while (!IsProtectionSchemeSupported(sinf.type.type))
DCHECK(IsProtectionSchemeSupported(sinf.type.type));
RCHECK(buffer->ReadWriteChild(&sinf)); RCHECK(buffer->ReadWriteChild(&sinf));
}
} }
const FourCC actual_format = GetActualFormat(); const FourCC actual_format = GetActualFormat();
@ -1575,10 +1573,19 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
DCHECK_EQ(codec_configuration.box_type, DCHECK_EQ(codec_configuration.box_type,
GetCodecConfigurationBoxType(actual_format)); 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->ReadWriteChild(&codec_configuration));
RCHECK(buffer->TryReadWriteChild(&pixel_aspect)); 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; return true;
} }
@ -1805,6 +1812,16 @@ bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
samplerate >>= 16; samplerate >>= 16;
RCHECK(buffer->PrepareChildren()); 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 (format == FOURCC_enca) {
if (buffer->Reading()) { if (buffer->Reading()) {
// Continue scanning until a supported protection scheme is found, or // 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->ReadWriteChild(&sinf));
} }
} }
RCHECK(buffer->TryReadWriteChild(&esds));
RCHECK(buffer->TryReadWriteChild(&ddts));
RCHECK(buffer->TryReadWriteChild(&dac3));
RCHECK(buffer->TryReadWriteChild(&dec3));
RCHECK(buffer->TryReadWriteChild(&dops));
return true; return true;
} }