Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions drm/ClearKeyDrmSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,44 @@ DrmData * ClearKeySession::generateKeyRequest(string& destinationURL, uint32_t t
cJSON *keyIds = cJSON_CreateArray();
if(keyIds)
{
cJSON_AddItemToArray(keyIds, cJSON_CreateString(urlEncodedkeyId));
cJSON_AddItemToObject(licenseRequest, "kids", keyIds);
cJSON_AddItemToObject(licenseRequest, "type",cJSON_CreateString("temporary"));
char* requestBody = cJSON_PrintUnformatted(licenseRequest);
if(requestBody)
cJSON *keyIdItem = cJSON_CreateString(urlEncodedkeyId);

if (!keyIdItem || !cJSON_AddItemToArray(keyIds, keyIdItem))
{
MW_LOG_ERR("Failed to add keyId to array");
if(keyIdItem) cJSON_Delete(keyIdItem);
cJSON_Delete(keyIds);
}
Comment thread
trupthi1403 marked this conversation as resolved.
else if (!cJSON_AddItemToObject(licenseRequest, "kids", keyIds))
{
MW_LOG_ERR("Failed to add kids to license request");
cJSON_Delete(keyIds);
}
Comment thread
trupthi1403 marked this conversation as resolved.
else
{
cJSON *typeItem = cJSON_CreateString("temporary");

if (!typeItem || !cJSON_AddItemToObject(licenseRequest, "type", typeItem))
{
MW_LOG_INFO("Generated license request : %s", requestBody);
licenseChallenge = new DrmData( requestBody, strlen(requestBody)); //CID:154682 - overrun
m_eKeyState = KEY_PENDING;
cJSON_free(requestBody);
MW_LOG_ERR("Failed to add type to license request");
if(typeItem) cJSON_Delete(typeItem);
}
else
{
char* requestBody = cJSON_PrintUnformatted(licenseRequest);
if(requestBody)
{
MW_LOG_INFO("Generated license request : %s", requestBody);
licenseChallenge = new DrmData( requestBody, strlen(requestBody)); //CID:154682 - overrun
m_eKeyState = KEY_PENDING;
cJSON_free(requestBody);
}
}
}
cJSON_Delete(licenseRequest);
}
free(urlEncodedkeyId);
cJSON_Delete(licenseRequest);
}
free(urlEncodedkeyId);
}
}
return licenseChallenge;
Expand Down
7 changes: 3 additions & 4 deletions externals/contentsecuritymanager/SecManagerThunder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,9 @@ bool SecManagerThunder::AcquireLicenseOpenOrUpdate( std::string clientId, std::s
* where input data changes e.g. following a call to updatePlaybackSession
* the input data to the shared session is updated here*/
newSession = ContentSecurityManagerSession(response["sessionId"].Number(),
ContentSecurityManager::getInputSummaryHash(moneyTraceMetadata, contentMetadata,
contMetaLen, licenseRequest, keySystemId,
mediaUsage, accessToken, isVideoMuted));

ContentSecurityManager::getInputSummaryHash(moneyTraceMetadata, contentMetaDataStr.c_str(),
contMetaLen, licenseRequestStr.c_str(), keySystemId,
mediaUsage, accessTokenStr.c_str(), isVideoMuted));
std::string license = response["license"].String();
MW_LOG_TRACE("SecManager obtained license with length: %d and data: %s",license.size(), license.c_str());
if (!license.empty())
Expand Down
Loading