Skip to content

Commit

Permalink
fix: Restore support for legacy FairPlay system ID (#1357)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cosmin authored Feb 28, 2024
1 parent 9be7c2b commit 4d22e99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packager/hls/base/simple_hls_notifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions packager/media/base/protection_system_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4d22e99

Please sign in to comment.