fix: Restore support for legacy FairPlay system ID (#1357)

Fixes #1356 which was caused by the fix in #1281 which updated this to
use the correct FairPlay system ID. However since old versions
recognized the previous system ID this restores support for it to avoid
breaking clients.
This commit is contained in:
Cosmin Stejerean 2024-02-28 15:45:03 -08:00 committed by GitHub
parent 9be7c2b1ac
commit 4d22e99f8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -58,6 +58,12 @@ bool IsFairPlaySystemId(const std::vector<uint8_t>& system_id) {
media::kFairPlaySystemId);
}
bool IsLegacyFairPlaySystemId(const std::vector<uint8_t>& system_id) {
return system_id.size() == std::size(media::kLegacyFairPlaySystemId) &&
std::equal(system_id.begin(), system_id.end(),
media::kLegacyFairPlaySystemId);
}
bool IsPlayReadySystemId(const std::vector<uint8_t>& system_id) {
return system_id.size() == std::size(media::kPlayReadySystemId) &&
std::equal(system_id.begin(), system_id.end(),
@ -462,7 +468,7 @@ bool SimpleHlsNotifier::NotifyEncryptionUpdate(
iv, "identity", "", media_playlist.get());
return true;
}
if (IsFairPlaySystemId(system_id)) {
if (IsFairPlaySystemId(system_id) || IsLegacyFairPlaySystemId(system_id)) {
std::string key_uri = hls_params().key_uri;
if (key_uri.empty()) {
// Use key_id as the key_uri. The player needs to have custom logic to

View File

@ -23,6 +23,12 @@ const uint8_t kFairPlaySystemId[] = {0x94, 0xCE, 0x86, 0xFB, 0x07, 0xFF,
0x4F, 0x43, 0xAD, 0xB8, 0x93, 0xD2,
0xFA, 0x96, 0x8C, 0xA2};
// this is a legacy system ID used for FairPlay in old packager versions, kept
// for backwards compatibility only
const uint8_t kLegacyFairPlaySystemId[] = {0x29, 0x70, 0x1F, 0xE4, 0x3C, 0xC7,
0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90,
0xC7, 0x43, 0x9A, 0x47};
// Marlin Adaptive Streaming Specification Simple Profile, V1.0.
const uint8_t kMarlinSystemId[] = {0x5E, 0x62, 0x9A, 0xF5, 0x38, 0xDA,
0x40, 0x63, 0x89, 0x77, 0x97, 0xFF,