Skip to content

VPLAY-9862 #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev_sprint_25_2
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion AampConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static const ConfigLookupEntryBool mConfigLookupTableBool[AAMPCONFIG_BOOL_COUNT]
{true,"enableLowLatencyOffsetMin",eAAMPConfig_EnableLowLatencyOffsetMin,false},
{false,"syncAudioFragments",eAAMPConfig_SyncAudioFragments,false},
{false,"enableEosSmallFragment", eAAMPConfig_EnableIgnoreEosSmallFragment, false},
{false,"useSecManager",eAAMPConfig_UseSecManager, true},
{true,"useSecManager",eAAMPConfig_UseSecManager, true},
{false,"enablePTO", eAAMPConfig_EnablePTO,false},
{true,"enableFogConfig", eAAMPConfig_EnableAampConfigToFog, false},
{false,"xreSupportedTune",eAAMPConfig_XRESupportedTune,false},
Expand Down
1 change: 1 addition & 0 deletions aampgstplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ static void HandleRedButtonCallback(const char *data, AAMPGstPlayer * _this)
{
if (_this)
{
AAMPLOG_INFO("Haripriya ... in Gst RedButtinCb for seiTimeCode : %s",data);
_this->aamp->seiTimecode.assign(data);
}
}
Expand Down
8 changes: 7 additions & 1 deletion middleware/InterfacePlayerRDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3773,6 +3773,7 @@ bool InterfacePlayerRDK::CreatePipeline(const char *pipelineName, int PipelinePr
The time base specified is in nanoseconds */
}
/* Use to enable the timing synchronization with gstreamer */
MW_LOG_ERR("HariPriya InterfacePlayerRDK - m_gstConfigParam->seiTimeCode : %d",m_gstConfigParam->seiTimeCode);
gstPrivateContext->enableSEITimeCode = m_gstConfigParam->seiTimeCode;
ret = true;
}
Expand Down Expand Up @@ -4535,6 +4536,7 @@ static void GstPlayer_redButtonCallback(GstElement* object, guint hours, guint m
HANDLER_CONTROL_HELPER_CALLBACK_VOID();
char buffer[16];
snprintf(buffer,16,"%d:%d:%d",hours,minutes,seconds);
MW_LOG_ERR("InterfacePlayerRDK HariPriya buffer .. :%s",buffer);
if(pInterfacePlayerRDK->OnHandleRedButtonCallback)
{
pInterfacePlayerRDK->OnHandleRedButtonCallback(buffer);
Expand Down Expand Up @@ -4655,10 +4657,14 @@ static GstBusSyncReply bus_sync_handler(GstBus * bus, GstMessage * msg, Interfac

}
}
if ((NULL != msg->src) && GstPlayer_isVideoSink(GST_OBJECT_NAME(msg->src), pInterfacePlayerRDK) && (!pInterfacePlayerRDK->gstPrivateContext->usingRialtoSink))
if ((NULL != msg->src) && (GstPlayer_isVideoSink(GST_OBJECT_NAME(msg->src), pInterfacePlayerRDK)) || ((gst_StartsWith(GST_OBJECT_NAME(msg->src), "rialtomsevideosink") == true) ||
(gst_StartsWith(GST_OBJECT_NAME(msg->src), "rialtomseaudiosink") == true)))

{
MW_LOG_ERR("InterfacePlayerRDK HariPriya removed useRialtoSink check for enableSEITimeCode");
if(pInterfacePlayerRDK->gstPrivateContext->enableSEITimeCode)
{
MW_LOG_ERR("InterfacePlayerRDK HariPriya enable-timecode set");
g_object_set(msg->src, "enable-timecode", 1, NULL);
pInterfacePlayerRDK->SignalConnect(msg->src, "timecode-callback",
G_CALLBACK(GstPlayer_redButtonCallback), pInterfacePlayerRDK);
Expand Down
87 changes: 45 additions & 42 deletions middleware/externals/playersecmanager/PlayerSecManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include <string.h>
#include "_base64.h"
#include <inttypes.h> // For PRId64
#include <fstream>
#include <sstream>
#include <string>

static PlayerSecManager *Instance = nullptr; /**< singleton instance*/

Expand Down Expand Up @@ -385,12 +388,15 @@ bool PlayerSecManager::AcquireLicenseOpenOrUpdate( const char* licenseUrl, const
//Shared memory pointer, key declared here,
//Access token, content metadata and licence request will be passed to
//secmanager via shared memory
void * shmPt_accToken = nullptr;
key_t shmKey_accToken = 0;
void * shmPt_contMeta = nullptr;
key_t shmKey_contMeta = 0;
void * shmPt_licReq = nullptr;
key_t shmKey_licReq = 0;
std::string accessTokenData = accessToken
? std::string(accessToken, accTokenLen)
: std::string();
std::string contentMetdataData = contentMetadata
? std::string(contentMetadata, contMetaLen)
: std::string();
std::string licenseRequestData = licenseRequest
? std::string(licenseRequest, licReqLen)
: std::string();
const char* apiName = "openPlaybackSession";
JsonObject param;
JsonObject response;
Expand Down Expand Up @@ -427,39 +433,39 @@ bool PlayerSecManager::AcquireLicenseOpenOrUpdate( const char* licenseUrl, const

{
std::lock_guard<std::mutex> lock(mSecMutex);
if(accTokenLen > 0 && contMetaLen > 0 && licReqLen > 0)
{
shmPt_accToken = player_CreateSharedMem(accTokenLen, shmKey_accToken);
shmPt_contMeta = player_CreateSharedMem(contMetaLen, shmKey_contMeta);
shmPt_licReq = player_CreateSharedMem(licReqLen, shmKey_licReq);
}
//Set shared memory with the buffer
//Set shared memory with the buffer
if(nullptr != shmPt_accToken && nullptr != accessToken &&
nullptr != shmPt_contMeta && nullptr != contentMetadata &&
nullptr != shmPt_licReq && nullptr != licenseRequest)
{
//copy buffer to shm
memcpy(shmPt_accToken, accessToken, accTokenLen);
memcpy(shmPt_contMeta, contentMetadata, contMetaLen);
memcpy(shmPt_licReq, licenseRequest, licReqLen);

MW_LOG_INFO("Access token, Content metadata and license request are copied successfully, passing details with SecManager");
//Set json params to be used by sec manager
param["accessTokenBufferKey"] = shmKey_accToken;
param["accessTokenLength"] = accTokenLen;

param["contentMetadataBufferKey"] = shmKey_contMeta;
param["contentMetadataLength"] = contMetaLen;

param["licenseRequestBufferKey"] = shmKey_licReq;
param["licenseRequestLength"] = licReqLen;

//invoke "openPlaybackSession" or "updatePlaybackSession" with retries for specific error cases
do
{
if(NULL != accessToken &&
NULL != contentMetadata &&
NULL != licenseRequest)
{
MW_LOG_INFO("Access token, Content metadata and license request are copied successfully, passing details with SecManager");

//Set json params to be used by sec manager
param["accessToken"] = accessTokenData;
param["contentMetadata"] = contentMetdataData;
param["licenseRequest"] = licenseRequestData;
std::string params;
param.ToString(params);

MW_LOG_WARN("SecManager %s param: %s",apiName, params.c_str());
//Retry delay
std::stringstream logMsg;
logMsg << "SecManager " << apiName << " param: " << params;
std::string fullLogMessage = logMsg.str();
std::cout<<"SecManager::::"<<fullLogMessage;
//MW_LOG_WARN("SAMIIIII123333333:::: %s",fullLogMessage.c_str()); //It truncates the log lines, not printing entire log
std::ofstream logFile("/opt/sectestlog.txt", std::ios::app);
if (logFile.is_open()) {
// Write to the file
logFile << "SecManager INPUT:::" << fullLogMessage << std::endl;
// logFile << "SAMIIIII123333333:::: " << fullLogMessage << std::endl;
logFile.close();
}

//Retry delay
int sleepTime = 500;//GETCONFIGVALUE(eAAMPConfig_LicenseRetryWaitTime);
if(sleepTime<=0) sleepTime = 100;
//invoke "openPlaybackSession" or "updatePlaybackSession" with retries for specific error cases
do{
rpcResult = mSecManagerObj.InvokeJSONRPC(apiName, param, response, 10000);
if (rpcResult)
{
Expand Down Expand Up @@ -568,9 +574,6 @@ bool PlayerSecManager::AcquireLicenseOpenOrUpdate( const char* licenseUrl, const
while(retryCount < MAX_LICENSE_REQUEST_ATTEMPT);

//Cleanup the shared memory after sharing it with secmanager
player_CleanUpSharedMem( shmPt_accToken, shmKey_accToken, accTokenLen);
player_CleanUpSharedMem( shmPt_contMeta, shmKey_contMeta, contMetaLen);
player_CleanUpSharedMem( shmPt_licReq, shmKey_licReq, licReqLen);

}
else
Expand Down
10 changes: 8 additions & 2 deletions middleware/externals/playersecmanager/ThunderAccessPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ ThunderAccessPlayer::ThunderAccessPlayer(std::string callsign)
#ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
uint32_t status = Core::ERROR_NONE;

Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), (_T(SERVER_DETAILS)));

const char* serverDetails = getenv("THUNDER_ACCESS_VIPA");
if (serverDetails != nullptr && strlen(serverDetails) > 0) {
MW_LOG_WARN("[ThunderAccessAAMP] Environment variable THUNDER_ACCESS is set from ENV as :%s",serverDetails);
Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), _T(serverDetails));
} else {
MW_LOG_WARN("[ThunderAccessAAMP] Environment variable THUNDER_ACCESS not set. Using default value.");
Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), (_T(SERVER_DETAILS)));//default value
}
if(!gSecurityPlayerData.tokenQueried)
{
unsigned char buffer[MAX_LENGTH] = {0};
Expand Down