From 4d22e99f8e7777557f5de3d5439f7e7b397e4323 Mon Sep 17 00:00:00 2001 From: Cosmin Stejerean Date: Wed, 28 Feb 2024 15:45:03 -0800 Subject: [PATCH] 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. --- packager/hls/base/simple_hls_notifier.cc | 8 +++++++- packager/media/base/protection_system_ids.h | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packager/hls/base/simple_hls_notifier.cc b/packager/hls/base/simple_hls_notifier.cc index f016a7a3d5..2ab7087aa5 100644 --- a/packager/hls/base/simple_hls_notifier.cc +++ b/packager/hls/base/simple_hls_notifier.cc @@ -58,6 +58,12 @@ bool IsFairPlaySystemId(const std::vector& system_id) { media::kFairPlaySystemId); } +bool IsLegacyFairPlaySystemId(const std::vector& 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& 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 diff --git a/packager/media/base/protection_system_ids.h b/packager/media/base/protection_system_ids.h index 92dd923565..5ddaf8cb07 100644 --- a/packager/media/base/protection_system_ids.h +++ b/packager/media/base/protection_system_ids.h @@ -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,