diff --git a/AampConfig.cpp b/AampConfig.cpp index 0ff321274e..862619c3f4 100644 --- a/AampConfig.cpp +++ b/AampConfig.cpp @@ -243,7 +243,7 @@ static const ConfigLookupEntryString mConfigLookupTableString[AAMPCONFIG_STRING_ static const ConfigLookupEntryBool mConfigLookupTableBool[AAMPCONFIG_BOOL_COUNT] = { {true,"abr",eAAMPConfig_EnableABR,false}, - {true,"fog",eAAMPConfig_Fog,false}, + {false,"fog",eAAMPConfig_Fog,false}, {false,"preFetchIframePlaylist",eAAMPConfig_PrefetchIFramePlaylistDL,false}, {false,"throttle",eAAMPConfig_Throttle,false}, {false,"demuxAudioBeforeVideo",eAAMPConfig_DemuxAudioBeforeVideo,false}, @@ -278,13 +278,13 @@ static const ConfigLookupEntryBool mConfigLookupTableBool[AAMPCONFIG_BOOL_COUNT] {false,"appSrcForProgressivePlayback",eAAMPConfig_UseAppSrcForProgressivePlayback,false}, {false,"descriptiveAudioTrack",eAAMPConfig_DescriptiveAudioTrack,false}, {true,"reportBufferEvent",eAAMPConfig_ReportBufferEvent,false}, - {false,"info",eAAMPConfig_InfoLogging,true}, + {true,"info",eAAMPConfig_InfoLogging,true}, {false,"debug",eAAMPConfig_DebugLogging,false}, {false,"trace",eAAMPConfig_TraceLogging,false}, {true,"warn",eAAMPConfig_WarnLogging,false}, {false,"failover",eAAMPConfig_FailoverLogging,false}, {false,"gst",eAAMPConfig_GSTLogging,false}, - {false,"progress",eAAMPConfig_ProgressLogging,false}, + {true,"progress",eAAMPConfig_ProgressLogging,false}, {false,"curl",eAAMPConfig_CurlLogging,false}, {false,"curlLicense",eAAMPConfig_CurlLicenseLogging,false}, {false,"logMetadata",eAAMPConfig_MetadataLogging,false}, @@ -364,11 +364,11 @@ static const ConfigLookupEntryBool mConfigLookupTableBool[AAMPCONFIG_BOOL_COUNT] {false, "seamlessAudioSwitch", eAAMPConfig_SeamlessAudioSwitch, true}, {false, "useRialtoSink", eAAMPConfig_useRialtoSink, false}, {false, "useDirectRialto", eAAMPConfig_useDirectRialto, false}, - {false, "localTSBEnabled", eAAMPConfig_LocalTSBEnabled, true}, + {true, "localTSBEnabled", eAAMPConfig_LocalTSBEnabled, true}, {false, "enableIFrameTrackExtract", eAAMPConfig_EnableIFrameTrackExtract, true}, {false, "forceMultiPeriodDiscontinuity", eAAMPConfig_ForceMultiPeriodDiscontinuity, false}, {false, "forceLLDFlow", eAAMPConfig_ForceLLDFlow, false}, - {false, "monitorAV", eAAMPConfig_MonitorAV, true}, + {true, "monitorAV", eAAMPConfig_MonitorAV, true}, {false, "enablePTSRestampForHlsTs", eAAMPConfig_HlsTsEnablePTSReStamp, true}, {true, "overrideMediaHeaderDuration", eAAMPConfig_OverrideMediaHeaderDuration, true}, {false, "useMp4Demux", eAAMPConfig_UseMp4Demux,false }, @@ -379,7 +379,7 @@ static const ConfigLookupEntryBool mConfigLookupTableBool[AAMPCONFIG_BOOL_COUNT] {true, "utcSyncOnStartup", eAAMPConfig_UTCSyncOnStartup, true}, {false, "disableWebVTT", eAAMPConfig_DisableWebVTT, false}, {false, "enablePTSReStampLogging", eAAMPConfig_EnablePTSReStampLogging, false}, - {false, "netTraceCsvDump", eAAMPConfig_NetTraceCsvDump, false}, + {true, "netTraceCsvDump", eAAMPConfig_NetTraceCsvDump, false}, {false, "logFilename", eAAMPConfig_LogFilename, false}, {false, "monitorMp4Integrity", eAAMPConfig_MonitorMp4Integrity, false}, {false, "processLicenseFromEAP", eAAMPConfig_ProcessLicenseFromEAP, false}, diff --git a/AampConfig.h b/AampConfig.h index 23ba53ad50..428f036faf 100644 --- a/AampConfig.h +++ b/AampConfig.h @@ -231,7 +231,7 @@ typedef enum eAAMPConfig_UTCSyncOnStartup, /**< Perform sync at startup */ eAAMPConfig_DisableWebVTT, /**< Config to disable/exclude WebVTT tracks (default: WebVTT enabled) */ eAAMPConfig_EnablePTSReStampLogging, /**< Config to enable logging for PTS restamping in Mp4Demuxer */ - eAAMPConfig_NetTraceCsvDump, /**< Write AAMP_NET_TRACE CSV files when true (default path: /tmp; may be overridden via AAMP_REQ_CSV/AAMP_BUR_CSV; output includes a PID suffix; default: false) */ + eAAMPConfig_NetTraceCsvDump, /**< Write AAMP_NET_TRACE CSV files when true (default path: /opt/logs; may be overridden via AAMP_REQ_CSV/AAMP_BUR_CSV; output includes a PID suffix; default: false) */ eAAMPConfig_LogFilename, /**< Config to include source filename in log output */ eAAMPConfig_MonitorMp4Integrity, /**< Parse every downloaded video/audio segment with Mp4Demux; log each segment, write corrupt ones to harvestPath */ eAAMPConfig_ProcessLicenseFromEAP, /**< Config to enable non-VSS early available period DRM prefetch */ diff --git a/CONFIGURATION.md b/CONFIGURATION.md index a71a9efddb..6ea29606b1 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -248,7 +248,7 @@ Network timeout configurations control how long AAMP waits for various network o | `useWesterosSink` | Boolean | false | Use Westeros sink for video decoding | | `useNewAdBreaker` | Boolean | false | Use new discontinuity processing based on PDT | | `useRetuneForUnpairedDiscontinuity` | Boolean | true | Retune on unpaired discontinuity | -| `netTraceCsvDump` | Boolean | false | Write per-download AAMP network trace CSV files to `/tmp` by default, typically using PID-suffixed filenames such as `/tmp/aamp_net_requests.csv.` and `/tmp/aamp_net_bursts.csv.`; environment overrides may change the final paths. | +| `netTraceCsvDump` | Boolean | false | Write per-download AAMP network trace CSV files to `/opt/logs` by default, typically using PID-suffixed filenames such as `/opt/logs/aamp_net_requests.csv.` and `/opt/logs/aamp_net_bursts.csv.`; environment overrides may change the final paths. | ## Best Practices diff --git a/net_trace.h b/net_trace.h index 5a43da95fd..d70457b33b 100644 --- a/net_trace.h +++ b/net_trace.h @@ -27,6 +27,9 @@ #include #include #include +#include // fprintf, stderr +#include // errno +#include // strerror #if defined(__unix__) || defined(__APPLE__) #include // getpid() #endif @@ -384,11 +387,19 @@ class NetTrace { auto& state = GetFileState(); std::call_once(state.openOnce, [&state]() { state.req_ofs.open(state.req_path, std::ios::app); - if (state.req_ofs.tellp() == 0) { + if (!state.req_ofs.is_open()) { + fprintf(stderr, "[NetTrace] failed to open requests CSV '%s': %s\n", + state.req_path.c_str(), strerror(errno)); + } + else if (state.req_ofs.tellp() == 0) { state.req_ofs << "req_id,when_start_s,url_path,media_type,bytes_total,http_code,conn_reused,primary_ip,local_port,ttfb_s,total_s,namelookup_s,connect_s,appconnect_s,pretransfer_s,redirect_s,chunked,gap_time_s,burst_time_s,burst_count,late_gap_count,avg_burst_rate_Bps\n"; } state.burst_ofs.open(state.burst_path, std::ios::app); - if (state.burst_ofs.tellp() == 0) { + if (!state.burst_ofs.is_open()) { + fprintf(stderr, "[NetTrace] failed to open bursts CSV '%s': %s\n", + state.burst_path.c_str(), strerror(errno)); + } + else if (state.burst_ofs.tellp() == 0) { state.burst_ofs << "req_id,burst_idx,t_start_s,duration_s,bytes,gap_before_s,class\n"; } }); diff --git a/priv_aamp.cpp b/priv_aamp.cpp index 43f1afcb87..4e1e9b73ec 100644 --- a/priv_aamp.cpp +++ b/priv_aamp.cpp @@ -4503,7 +4503,7 @@ bool PrivateInstanceAAMP::GetFile( std::string remoteUrl, AampMediaType mediaTyp } else if (netTracerEnabled) { aamptrace::NetTrace::SetPathsWithPid( - "/tmp/aamp_net_requests.csv", "/tmp/aamp_net_bursts.csv"); + "/opt/logs/aamp_net_requests.csv", "/opt/logs/aamp_net_bursts.csv"); paths_set.store(true, std::memory_order_release); } // Neither condition: retry next download until config is true @@ -8635,11 +8635,13 @@ void PrivateInstanceAAMP::Stop( bool sendStateChangeEvent ) mProgressReportOffset = -1; mProgressReportAvailabilityOffset = -1; rate = 1; - // Generate persona JSON from accumulated NetTrace data before going idle + // Generate persona JSON from accumulated NetTrace data before going idle. + // Write alongside the NetTrace CSV files in /opt/logs (PID suffix added by + // GeneratePersonaJson), rather than the header default of /tmp. if (GETCONFIGVALUE_PRIV(eAAMPConfig_NetTraceCsvDump)) { aamptrace::NetPersonaFitter::GetInstance().GeneratePersonaJson( - aamptrace::NetPersonaFitter::kDefaultBasePath); + "/opt/logs/aamp_net_persona.json"); } // Set state to IDLE irrespective of sending state change event or not SetState(eSTATE_IDLE, sendStateChangeEvent);