Skip to content

Commit

Permalink
temp2
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed Aug 26, 2024
1 parent e8e62be commit 16c2b81
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,10 @@ void CSession::ExtractStreamProtectionData(const PLAYLIST::CPeriod::PSSHSet& pss

if (initialRepr->GetContainerType() != ContainerType::MP4)
return;

LOG::LogF(LOGERROR, "Extracting data...");
const bool isForceRefreshPssh = defaultKid.empty();

CStream stream{m_adaptiveTree, psshSet.adaptation_set_, initialRepr};

stream.m_isEnabled = true;
Expand Down Expand Up @@ -1514,7 +1517,7 @@ void CSession::ExtractStreamProtectionData(const PLAYLIST::CPeriod::PSSHSet& pss
}
}

if (initData.empty() || defaultKid.empty())
if (initData.empty() || defaultKid.empty() || isForceRefreshPssh)
{
const std::vector<std::string> systemIds = DRM::UrnsToSystemIds(keySystems);
AP4_Array<AP4_PsshAtom>& pssh{movie->GetPsshAtoms()};
Expand All @@ -1529,10 +1532,10 @@ void CSession::ExtractStreamProtectionData(const PLAYLIST::CPeriod::PSSHSet& pss
if (std::find(systemIds.cbegin(), systemIds.cend(), systemId) != systemIds.cend())
{
const AP4_DataBuffer& dataBuf = psshAtom.GetData();
const std::vector<uint8_t> psshInit{dataBuf.GetData(),
dataBuf.GetData() + dataBuf.GetDataSize()};

initData.clear();
initData.insert(initData.end(), dataBuf.GetData(),
dataBuf.GetData() + dataBuf.GetDataSize());
DRM::MakePssh(psshAtom.GetSystemId(), psshInit, initData);

if (psshAtom.GetKid(0))
{
Expand Down

0 comments on commit 16c2b81

Please sign in to comment.