Bug 1491117 - Do not add crypto info to unencrypted samples from encrypted WebM tracks. r=jya

WebMs with encrypted tracks may have unencrypted samples in these tracks.
Previously we would populate some of the crypto metadata on these samples. This
data was correct, but it was potentially misleading to include crypto metadata on
clear samples.

This changeset alters the behaviour so that we do not populate any such data for
unencrypted packets. This should not alter existing behaviour, notably the
Widevine CDM version 9 should continue to work. However, this change makes our
samples easier to feed to version 10 of the CDM. Without this change, we would
need to do extra conversion steps to appease the new CDM.

Differential Revision: https://phabricator.services.mozilla.com/D6183

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bryce Van Dyk 2018-09-19 17:09:29 +00:00
Родитель 5f3eea312b
Коммит d3c1de1214
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -777,8 +777,7 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType,
}
}
if (packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_UNENCRYPTED ||
packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_ENCRYPTED ||
if (packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_ENCRYPTED ||
packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_PARTITIONED) {
UniquePtr<MediaRawDataWriter> writer(sample->CreateWriter());
unsigned char const* iv;
@ -787,7 +786,12 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType,
writer->mCrypto.mValid = true;
writer->mCrypto.mIVSize = ivLength;
if (ivLength == 0) {
// Frame is not encrypted
// Frame is not encrypted. This shouldn't happen as it means the
// encryption bit is set on a frame with no IV, but we gracefully
// handle incase.
MOZ_ASSERT_UNREACHABLE(
"Unencrypted packets should not have the encryption bit set!");
WEBM_DEBUG("Unencrypted packet with encryption bit set");
writer->mCrypto.mPlainSizes.AppendElement(length);
writer->mCrypto.mEncryptedSizes.AppendElement(0);
} else {