Skip to content

Commit dc71386

Browse files
committed
Reapply "Reintroduced the condition check before calling clear() in clearDrmSession(), which was missed during the DRM refactoring (#619)"
This reverts commit ab0a646.
1 parent ab0a646 commit dc71386

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

drm/AampDRMLicManager.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,9 +1521,17 @@ void AampDRMLicenseManager::clearDrmSession(bool forceClearSession)
15211521
{
15221522
mDrmSessionManager->clearDrmSession(forceClearSession);
15231523
for(int i = 0 ; i < mMaxDRMSessions;i++)
1524-
{
1525-
mLicenseDownloader[i].Clear();
1526-
}
1524+
{
1525+
bool isFailedKeyId = mDrmSessionManager->getFailedKeyIdStatus(i);
1526+
if(( mDrmSessionManager->drmSessionContexts != NULL && (isFailedKeyId || forceClearSession) ))
1527+
{
1528+
if(mDrmSessionManager->drmSessionContexts[i].drmSession != NULL)
1529+
{
1530+
AAMPLOG_INFO("Clearing Session %d, isFailedKeyId=%d, forceClearSession=%d",i, isFailedKeyId, forceClearSession);
1531+
mLicenseDownloader[i].Clear();
1532+
}
1533+
}
1534+
}
15271535
}
15281536

15291537
/**

middleware/drm/DrmSessionManager.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ void DrmSessionManager::clearAccessToken()
170170
}
171171
}
172172

173+
/**
174+
* @brief Get the failed key ID status for a specific session
175+
*/
176+
bool DrmSessionManager::getFailedKeyIdStatus(int sessionIndex)
177+
{
178+
if (sessionIndex >= 0 && sessionIndex < mMaxDRMSessions && cachedKeyIDs)
179+
{
180+
return cachedKeyIDs[sessionIndex].isFailedKeyId;
181+
}
182+
return false;
183+
}
184+
173185
/**
174186
* @brief Clean up the Session Data if license key acquisition failed or if LicenseCaching is false.
175187
*/

middleware/drm/DrmSessionManager.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,16 @@ class DrmSessionManager
301301
* @return void.
302302
*/
303303
void clearFailedKeyIds();
304+
305+
306+
/**
307+
* @fn getFailedKeyIdStatus
308+
*
309+
* @param sessionIndex session index to check
310+
* @return bool - true if the key ID is marked as failed, false otherwise
311+
*/
312+
bool getFailedKeyIdStatus(int sessionIndex);
313+
304314
/**
305315
* @fn clearDrmSession
306316
*

test/utests/fakes/FakeAampDRMSessionManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ bool DrmSessionManager::IsKeyIdProcessed(std::vector<uint8_t> keyIdArray, bool &
101101
return false;
102102
}
103103

104+
bool DrmSessionManager::getFailedKeyIdStatus(int sessionIndex)
105+
{
106+
return false;
107+
}
108+
104109
void DrmSessionManager::clearDrmSession(bool forceClearSession)
105110
{
106111
}

0 commit comments

Comments
 (0)