Skip to content

Commit

Permalink
Fix crash accessing decrypter_caps in rep_chooser
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed Oct 27, 2020
1 parent 2ac0104 commit b9082d3
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ struct DefaultRepresentationChooser : adaptive::AdaptiveTree::RepresentationChoo
br != er; ++br)
{
unsigned int score;
if (!hdcp_override_)
if (!hdcp_override_ && !decrypter_caps_.empty())
{
hdcpVersion = decrypter_caps_[(*br)->pssh_set_].hdcpVersion;
hdcpLimit = decrypter_caps_[(*br)->pssh_set_].hdcpLimit;
Expand Down Expand Up @@ -2691,15 +2691,20 @@ bool Session::InitializePeriod()
SAFE_DELETE(*b);
streams_.clear();

if (psshChanged && !InitializeDRM())
return false;
if (psshChanged)
{
representationChooser_->decrypter_caps_.clear();

if (!InitializeDRM())
return false;

representationChooser_->decrypter_caps_.resize(cdm_sessions_.size());
for (const Session::CDMSESSION& cdmsession : cdm_sessions_)
representationChooser_->decrypter_caps_.push_back(cdmsession.decrypter_caps_);
}
else if (adaptiveTree_->current_period_->encryptionState_)
kodi::Log(ADDON_LOG_DEBUG, "Reusing DRM psshSets for new period!");

representationChooser_->decrypter_caps_.resize(cdm_sessions_.size());
for (const Session::CDMSESSION& cdmsession : cdm_sessions_)
representationChooser_->decrypter_caps_.push_back(cdmsession.decrypter_caps_);

while ((adp = adaptiveTree_->GetAdaptationSet(i++)))
{
if (adp->representations_.empty())
Expand Down

0 comments on commit b9082d3

Please sign in to comment.