Skip to content

Commit

Permalink
Add constant value for key size
Browse files Browse the repository at this point in the history
  • Loading branch information
jedekar committed Jan 12, 2024
1 parent 4dee600 commit 94ddbd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packager/live_packager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,22 @@ void FillPSSHBoxByDRM(const media::ProtectionSystemSpecificInfo& pssh_info,
}

Status PSSHGeneratorInput::Validate() const {
constexpr int kKeySize = 16;

if (encryption_scheme != EncryptionSchemeFourCC::CBCS &&
encryption_scheme != EncryptionSchemeFourCC::CENC) {
LOG(WARNING) << "invalid encryption scheme in PSSH generator input";
return Status(error::INVALID_ARGUMENT,
"invalid encryption scheme in PSSH generator input");
}

if (key.size() != 16) {
if (key.size() != kKeySize) {
LOG(WARNING) << "invalid key length in PSSH generator input";
return Status(error::INVALID_ARGUMENT,
"invalid key length in PSSH generator input");
}

if (key_id.size() != 16) {
if (key_id.size() != kKeySize) {
LOG(WARNING) << "invalid key id length in PSSH generator input";
return Status(error::INVALID_ARGUMENT,
"invalid key id length in PSSH generator input");
Expand All @@ -482,7 +484,7 @@ Status PSSHGeneratorInput::Validate() const {
}

for (size_t i = 0; i < key_ids.size(); ++i) {
if (key_ids[i].size() != 16) {
if (key_ids[i].size() != kKeySize) {
LOG(WARNING) << "invalid key id length in key ids array in PSSH "
"generator input, index " +
std::to_string(i);
Expand Down

0 comments on commit 94ddbd8

Please sign in to comment.