30 #ifdef USE_SYSLOG_HELPER_PRINT
31 #include "syslog_helper_ifc.h"
33 #ifdef USE_SYSTEMD_JOURNAL_PRINT
34 #include <systemd/sd-journal.h>
41 static char gAampCfg[] =
"/opt/aamp.cfg";
42 static char gAampCliCfg[] =
"/opt/aampcli.cfg";
45 bool AampLogManager::disableLogRedirection =
false;
52 return (chkLevel>=aampLoglevel);
60 if(!info && !debug && !trace)
61 aampLoglevel = newLevel;
70 gAampCfg[0] = driveName;
71 gAampCliCfg[0] = driveName;
95 std::ostringstream hexSs;
97 hexSs << std::hex << std::uppercase << std::setfill(
'0');
98 std::for_each(data.cbegin(), data.cend(), [&](
int c) { hexSs << std::setw(2) << c; });
107 std::string contentType;
108 std::string location;
111 ParseContentUrl(url, contentType, location, symptom, type);
113 AAMPLOG(
this,
eLOGLEVEL_WARN,
"WARN",
"AAMPLogNetworkLatency downloadTime=%d downloadThreshold=%d type='%s' location='%s' symptom='%s' url='%s'",
114 downloadTime, downloadThresholdTimeoutMs, contentType.c_str(), location.c_str(), symptom.c_str(), url);
122 std::string contentType;
123 std::string location;
126 ParseContentUrl(url, contentType, location, symptom, type);
134 AAMPLOG(
this,
eLOGLEVEL_ERROR,
"ERROR",
"AAMPLogNetworkError error='http error %d' type='%s' location='%s' symptom='%s' url='%s'",
135 errorCode, contentType.c_str(), location.c_str(), symptom.c_str(), url );
144 AAMPLOG(
this,
eLOGLEVEL_ERROR,
"ERROR",
"AAMPLogNetworkError error='timeout %d' type='%s' location='%s' symptom='%s' url='%s'",
145 errorCode, contentType.c_str(), location.c_str(), symptom.c_str(), url );
154 AAMPLOG(
this,
eLOGLEVEL_ERROR,
"ERROR",
"AAMPLogNetworkError error='curl error %d' type='%s' location='%s' symptom='%s' url='%s'",
155 errorCode, contentType.c_str(), location.c_str(), symptom.c_str(), url );
186 "PLAYLIST_AUX-AUDIO",
192 contentType = mMediaTypes[type];
196 contentType =
"unknown";
203 symptom =
"video fails to start, has delayed start or freezes/buffers";
211 symptom =
"video fails to start or freeze/buffering";
219 symptom =
"video fails to start";
225 symptom =
"freeze/buffering";
231 symptom =
"audio drop or freeze/buffering";
237 symptom =
"trickplay ends or freezes";
246 if(strstr(url,
"//mm."))
248 location =
"manifest manipulator";
250 else if(strstr(url,
"//odol"))
252 location =
"edge cache";
254 else if(strstr(url,
"127.0.0.1:9080"))
260 location =
"unknown";
269 std::string description;
275 if(minor == 268435462)
277 description =
"Missing drm keys. Files are missing from /opt/drm. This could happen if socprovisioning fails to pull keys from fkps. This could also happen with a new box type that isn't registered with fkps. Check the /opt/logs/socprov.log for error. Contact ComSec for help.";
279 else if(minor == 570425352)
281 description =
"Stale cache data. There is bad data in adobe cache at /opt/persistent/adobe. This can happen if the cache isn't cleared by /lib/rdk/cleanAdobe.sh after either an FKPS key update or a firmware update. This should not be happening in the field. For engineers, they can try a factory reset to fix the problem.";
283 else if(minor == 1000022)
285 description =
"Local cache directory not readable. The Receiver running as non-root cannot access and read the adobe cache at /opt/persistent/adobe. This can happen if /lib/rdk/prepareChrootEnv.sh fails to set that folders privileges. Run ls -l /opt/persistent and check the access rights. Contact the SI team for help. Also see jira XRE-6687";
294 description =
"Invalid signiture request on the Adobe individualization request. Expired certs can cause this, so the first course of action is to verify if the certs, temp baked in or production fkps, have not expired.";
296 else if(minor == 10100)
298 description =
"Unknown Device class error from the Adobe individualization server. The drm certs may be been distributed to MSO security team for inclusion in fkps, but Adobe has not yet added the device info to their indi server.";
300 else if(minor == 1107296357)
302 description =
"Failed to connect to individualization server. This can happen if the network goes down. This can also happen if bad proxy settings exist in /opt/xreproxy.conf. Check the receiver.log for the last HttpRequestBegin before the error occurs and check the host name in the url, then check your proxy conf";
318 description =
"Device binding failure. DRM data cached by the player at /opt/persistent/adobe, may be corrupt, missing, or innaccesible due to file permision. Please check this folder. A factory reset may be required to fix this and force a re-individualization of the box to reset that data.";
326 description =
"Potential server issue. This could happen if drm keys are missing or bad. To attempt a quick fix: Back up /opt/drm and /opt/persistent/adobe, perform a factory reset, and see if that fixes the issue. Reach out to ComSec team for help diagnosing the error.";
333 description =
"MSO license server error response. This could happen for various reasons: bad cache data, bad session token, any license related issue. To attempt a quick fix: Back up /opt/drm and /opt/persistent/adobe, perform a factory reset, and see if that fixes the issue. Reach out to ComSec team for help diagnosing the error.";
339 description =
"Unknown connection type. Rare issue related to output protection code not being implemented on certain branches or core or for new socs. See STBI-6542 for details. Reach out to Receiver IP-Video team for help.";
344 if(description.empty())
346 description =
"Unrecognized error. Please report this to the STB IP-Video team.";
349 AAMPLOG(
this,
eLOGLEVEL_ERROR,
"ERROR",
"AAMPLogDRMError error=%d.%d description='%s'", major, minor, description.c_str());
363 if (pstAbrInfo->desiredBandwidth > pstAbrInfo->currentBandwidth)
366 symptom =
"video quality may increase";
371 symptom =
"video quality may decrease";
374 switch(pstAbrInfo->abrCalledFor)
376 case AAMPAbrBandwidthUpdate:
378 reason = (pstAbrInfo->desiredBandwidth > pstAbrInfo->currentBandwidth) ?
"bandwidth is good enough" :
"not enough bandwidth";
382 case AAMPAbrManifestDownloadFailed:
384 reason =
"manifest download failed'";
388 case AAMPAbrFragmentDownloadFailed:
390 reason =
"fragment download failed'";
394 case AAMPAbrUnifiedVideoEngine:
396 reason =
"changed based on unified video engine user preferred bitrate";
403 reason +=
" error='http error ";
404 reason += to_string(pstAbrInfo->errorCode);
405 symptom +=
" (or) freeze/buffering";
408 AAMPLOG(
this,
eLOGLEVEL_WARN,
"WARN",
"AAMPLogABRInfo : switching to '%s' profile '%d -> %d' currentBandwidth[%ld]->desiredBandwidth[%ld] nwBandwidth[%ld] reason='%s' symptom='%s'",
409 profile.c_str(), pstAbrInfo->currentProfileIndex, pstAbrInfo->desiredProfileIndex, pstAbrInfo->currentBandwidth,
410 pstAbrInfo->desiredBandwidth, pstAbrInfo->networkBandwidth, reason.c_str(), symptom.c_str());
419 bool returnValue =
false;
421 if ((errorCode !=0) && (errorCode != CURLE_WRITE_ERROR) && (errorCode != CURLE_ABORTED_BY_CALLBACK))
436 va_start(args, format);
439 len = snprintf(gDebugPrintBuffer,
sizeof(gDebugPrintBuffer),
"[AAMP-PLAYER]");
445 #if (defined (USE_SYSTEMD_JOURNAL_PRINT) || defined (USE_SYSLOG_HELPER_PRINT))
446 if(!AampLogManager::disableLogRedirection)
448 #ifdef USE_SYSTEMD_JOURNAL_PRINT
449 sd_journal_print(LOG_NOTICE,
"%s", gDebugPrintBuffer);
451 send_logs_to_syslog(gDebugPrintBuffer);
457 gettimeofday(&t, NULL);
458 printf(
"%ld:%3ld : %s\n", (
long int)t.tv_sec, (
long int)t.tv_usec / 1000, gDebugPrintBuffer);
460 #else //USE_SYSTEMD_JOURNAL_PRINT
461 #ifdef AAMP_SIMULATOR_BUILD
464 FILE *f = fopen(
gAampLog, (init ?
"a" :
"w"));
468 fputs(gDebugPrintBuffer, f);
473 gettimeofday(&t, NULL);
474 printf(
"%ld:%3ld : %s\n", (
long int)t.tv_sec, (
long int)t.tv_usec / 1000, gDebugPrintBuffer);
482 void logprintf_new(
int playerId,
const char* levelstr,
const char* file,
int line,
const char *format, ...)
486 va_start(args, format);
489 len = snprintf(gDebugPrintBuffer,
sizeof(gDebugPrintBuffer),
"[AAMP-PLAYER][%d][%s][%s][%d]",playerId,levelstr,file,line);
495 #if (defined (USE_SYSTEMD_JOURNAL_PRINT) || defined (USE_SYSLOG_HELPER_PRINT))
496 if(!AampLogManager::disableLogRedirection)
498 #ifdef USE_SYSTEMD_JOURNAL_PRINT
499 sd_journal_print(LOG_NOTICE,
"%s", gDebugPrintBuffer);
501 send_logs_to_syslog(gDebugPrintBuffer);
507 gettimeofday(&t, NULL);
508 printf(
"%ld:%3ld : %s\n", (
long int)t.tv_sec, (
long int)t.tv_usec / 1000, gDebugPrintBuffer);
510 #else //USE_SYSTEMD_JOURNAL_PRINT
511 #ifdef AAMP_SIMULATOR_BUILD
514 FILE *f = fopen(
gAampLog, (init ?
"a" :
"w"));
518 fputs(gDebugPrintBuffer, f);
523 gettimeofday(&t, NULL);
524 printf(
"%ld:%3ld : %s\n", (
long int)t.tv_sec, (
long int)t.tv_usec / 1000, gDebugPrintBuffer);
533 void DumpBlob(
const unsigned char *ptr,
size_t len)
536 char buf[FIT_CHARS + 1];
538 const unsigned char *fin = ptr+len;
542 unsigned char c = *ptr++;
543 if (c >=
' ' && c < 128)
551 WRITE_HASCII( dst, c );
559 if (fit==0 || ptr==fin )
563 AAMPLOG_WARN(
"%s", buf);