Skip to content

Commit

Permalink
[HLSTree] Moved back insert psshset to EXTINF parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed May 16, 2024
1 parent 03f2154 commit 5020ca8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/parser/HLSTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,17 +607,6 @@ void adaptive::CHLSTree::FixDiscSequence(std::stringstream& streamData, uint32_t
newSegment->m_endPts = startPts + durMs;
newSegment->m_number = currentSegNumber++;


if (currentEncryptionType == EncryptionType::AES128 && psshSetPos == PSSHSET_POS_DEFAULT)
{
if (!m_currentKidUrl.empty())
{
psshSetPos = InsertPsshSet(StreamType::NOTYPE, period, adp, m_currentPssh,
m_currentDefaultKID, m_currentKidUrl, m_currentIV);
}
}
newSegment->pssh_set_ = psshSetPos;

// Reset EXT-X-PROGRAM-DATE-TIME, some playlists do not have this tag on each segment
programDateTime = NO_VALUE;
}
Expand Down Expand Up @@ -691,6 +680,18 @@ void adaptive::CHLSTree::FixDiscSequence(std::stringstream& streamData, uint32_t

newSegment->url = line;

// The EXT-X-KEY tag might appear before or after the EXTINF tag
// so its needed process it just before add the segment to timeline
if (currentEncryptionType == EncryptionType::AES128 && psshSetPos == PSSHSET_POS_DEFAULT)
{
if (!m_currentKidUrl.empty())
{
psshSetPos = InsertPsshSet(StreamType::NOTYPE, period, adp, m_currentPssh,
m_currentDefaultKID, m_currentKidUrl, m_currentIV);
}
}
newSegment->pssh_set_ = psshSetPos;

newSegments.GetData().emplace_back(*newSegment);
newSegment.reset();
}
Expand Down

0 comments on commit 5020ca8

Please sign in to comment.