Skip to content
Draft
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
12 changes: 6 additions & 6 deletions AampConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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 },
Expand All @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion AampConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<pid>` and `/tmp/aamp_net_bursts.csv.<pid>`; 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.<pid>` and `/opt/logs/aamp_net_bursts.csv.<pid>`; environment overrides may change the final paths. |

## Best Practices

Expand Down
15 changes: 13 additions & 2 deletions net_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdio> // fprintf, stderr
#include <cerrno> // errno
#include <cstring> // strerror
#if defined(__unix__) || defined(__APPLE__)
#include <unistd.h> // getpid()
#endif
Expand Down Expand Up @@ -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";
}
});
Expand Down
8 changes: 5 additions & 3 deletions priv_aamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Loading