Skip to content

Commit

Permalink
[Cleanup] Removed isDrmChanged variables
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed Apr 24, 2024
1 parent 15865fc commit db83a63
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
3 changes: 1 addition & 2 deletions src/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,9 +943,8 @@ void CSession::PrepareStream(CStream* stream)
// Download the manifest only at first start of the stream
if (startEvent == EVENT_TYPE::STREAM_START)
{
bool noop;
m_adaptiveTree->PrepareRepresentation(stream->m_adStream.getPeriod(),
stream->m_adStream.getAdaptationSet(), repr, noop,
stream->m_adStream.getAdaptationSet(), repr,
SEGMENT_NO_NUMBER);
}

Expand Down
3 changes: 1 addition & 2 deletions src/common/AdaptiveStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,7 @@ bool AdaptiveStream::ensureSegment()
{
// On manifests type like HLS we need also to get update segments
// because need to be downloaded/parsed from different child manifest files
bool isDrmChanged;
m_tree->PrepareRepresentation(current_period_, current_adp_, newRep, isDrmChanged,
m_tree->PrepareRepresentation(current_period_, current_adp_, newRep,
current_rep_->getCurrentSegmentNumber());

// If the representation has been changed, segments may have to be generated (DASH)
Expand Down
1 change: 0 additions & 1 deletion src/common/AdaptiveTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class ATTR_DLL_LOCAL AdaptiveTree
virtual bool PrepareRepresentation(PLAYLIST::CPeriod* period,
PLAYLIST::CAdaptationSet* adp,
PLAYLIST::CRepresentation* rep,
bool& isDrmChanged,
uint64_t currentSegNumber)
{
return false;
Expand Down
22 changes: 4 additions & 18 deletions src/parser/HLSTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ bool adaptive::CHLSTree::Open(std::string_view url,
bool adaptive::CHLSTree::PrepareRepresentation(PLAYLIST::CPeriod* period,
PLAYLIST::CAdaptationSet* adp,
PLAYLIST::CRepresentation* rep,
bool& isDrmChanged,
uint64_t currentSegNumber)
{
// Prepare child manifest only once time for VOD stream and always for live stream
Expand All @@ -201,8 +200,7 @@ bool adaptive::CHLSTree::PrepareRepresentation(PLAYLIST::CPeriod* period,
if (!DownloadChildManifest(adp, rep, resp))
return false;

status = ParseChildManifest(resp.data, URL::GetUrlPath(resp.effectiveUrl), period, adp, rep,
isDrmChanged);
status = ParseChildManifest(resp.data, URL::GetUrlPath(resp.effectiveUrl), period, adp, rep);

if (status == ParseStatus::SUCCESS)
{
Expand Down Expand Up @@ -433,8 +431,7 @@ void adaptive::CHLSTree::FixDiscSequence(std::stringstream& streamData, uint32_t
std::string_view sourceUrl,
PLAYLIST::CPeriod* period,
PLAYLIST::CAdaptationSet* adp,
PLAYLIST::CRepresentation* rep,
bool& isDrmChanged)
PLAYLIST::CRepresentation* rep)
{
const auto& manifestCfg = CSrvBroker::GetKodiProps().GetManifestConfig();
size_t adpSetPos = GetPtrPosition(period->GetAdaptationSets(), adp);
Expand Down Expand Up @@ -521,12 +518,6 @@ void adaptive::CHLSTree::FixDiscSequence(std::stringstream& streamData, uint32_t

rep->m_psshSetPos = InsertPsshSet(adp->GetStreamType(), period, adp, m_currentPssh,
m_currentDefaultKID, m_currentKidUrl, m_currentIV);

if (period->GetPSSHSets()[rep->GetPsshSetPos()].m_usageCount == 1 || isDrmChanged)
isDrmChanged = true;
else
isDrmChanged = false;
break;
default:
break;
}
Expand Down Expand Up @@ -1048,7 +1039,6 @@ void adaptive::CHLSTree::RefreshSegments(PLAYLIST::CPeriod* period,
if (rep->IsIncludedStream())
return;

bool isDrmChanged{false};
UTILS::CURL::HTTPResponse resp;

if (!DownloadChildManifest(adp, rep, resp))
Expand All @@ -1059,14 +1049,11 @@ void adaptive::CHLSTree::RefreshSegments(PLAYLIST::CPeriod* period,
const uint64_t segNumber = rep->getCurrentSegmentNumber();

const ParseStatus status = ParseChildManifest(resp.data, URL::GetUrlPath(resp.effectiveUrl),
period, adp, rep, isDrmChanged);
period, adp, rep);
if (status == ParseStatus::SUCCESS)
{
PrepareSegments(period, adp, rep, segNumber);
}

if (isDrmChanged)
LOG::Log(LOGERROR, "Unmanaged DRM change between segments");
}

bool adaptive::CHLSTree::DownloadKey(std::string_view url,
Expand Down Expand Up @@ -1106,7 +1093,6 @@ void adaptive::CHLSTree::RefreshLiveSegments()

for (auto& [adpSet, repr] : refreshList)
{
bool isDrmChanged{false};
UTILS::CURL::HTTPResponse resp;

if (!DownloadChildManifest(adpSet, repr, resp))
Expand All @@ -1117,7 +1103,7 @@ void adaptive::CHLSTree::RefreshLiveSegments()
const uint64_t segNumber = repr->getCurrentSegmentNumber();

const ParseStatus status = ParseChildManifest(resp.data, URL::GetUrlPath(resp.effectiveUrl),
m_currentPeriod, adpSet, repr, isDrmChanged);
m_currentPeriod, adpSet, repr);

if (status == ParseStatus::SUCCESS)
{
Expand Down
4 changes: 1 addition & 3 deletions src/parser/HLSTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class ATTR_DLL_LOCAL CHLSTree : public AdaptiveTree
virtual bool PrepareRepresentation(PLAYLIST::CPeriod* period,
PLAYLIST::CAdaptationSet* adp,
PLAYLIST::CRepresentation* rep,
bool& isDrmChanged,
uint64_t currentSegNumber) override;

virtual void OnDataArrived(uint64_t segNum,
Expand Down Expand Up @@ -150,8 +149,7 @@ class ATTR_DLL_LOCAL CHLSTree : public AdaptiveTree
std::string_view sourceUrl,
PLAYLIST::CPeriod* period,
PLAYLIST::CAdaptationSet* adp,
PLAYLIST::CRepresentation* rep,
bool& isDrmChanged);
PLAYLIST::CRepresentation* rep);

void PrepareSegments(PLAYLIST::CPeriod* period,
PLAYLIST::CAdaptationSet* adp,
Expand Down
3 changes: 1 addition & 2 deletions src/test/TestHLSTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class HLSTreeTest : public ::testing::Test
rep->SetSourceUrl(url);

testHelper::testFile = filePath;
bool isDrmChanged;
return tree->PrepareRepresentation(per, adp, rep, isDrmChanged, PLAYLIST::SEGMENT_NO_NUMBER);
return tree->PrepareRepresentation(per, adp, rep, PLAYLIST::SEGMENT_NO_NUMBER);
}

adaptive::CHLSTree* tree;
Expand Down

0 comments on commit db83a63

Please sign in to comment.