use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class VideoResultSummary method populateSummary.
private void populateSummary(AROTraceData trace) {
for (AbstractBestPracticeResult bpResult : trace.getBestPracticeResults()) {
if (bpResult.getClass().getName().contains("AROServiceImpl")) {
continue;
}
BestPracticeType bpType = bpResult.getBestPracticeType();
switch(bpType) {
case VIDEO_STALL:
VideoStallResult result = (VideoStallResult) bpResult;
stalls = result.getStallResult();
break;
case NETWORK_COMPARISON:
VideoNetworkComparisonResult ntkResult = (VideoNetworkComparisonResult) bpResult;
ntkComparison = ntkResult.getAvgKbps();
break;
case TCP_CONNECTION:
VideoTcpConnectionResult tcpResult = (VideoTcpConnectionResult) bpResult;
tcpConnection = tcpResult.getTcpConnections();
break;
case BUFFER_OCCUPANCY:
BufferOccupancyResult bufferResult = (BufferOccupancyResult) bpResult;
bufferOccupancy = bufferResult.getMaxBuffer();
populateBufferResult(bufferResult);
break;
case CHUNK_SIZE:
VideoChunkSizeResult segmentSizeResult = (VideoChunkSizeResult) bpResult;
segmentSize = segmentSizeResult.getSegmentSize();
segmentCount = segmentSizeResult.getSegmentCount();
break;
case CHUNK_PACING:
VideoChunkPacingResult segmentPacingResult = (VideoChunkPacingResult) bpResult;
segmentPacing = segmentPacingResult.getChunkPacing();
break;
case VIDEO_REDUNDANCY:
VideoRedundancyResult redundancyResult = (VideoRedundancyResult) bpResult;
duplicate = redundancyResult.getCountDuplicate();
redundancy = redundancyResult.getRedundantPercentage();
break;
case STARTUP_DELAY:
VideoStartUpDelayResult startupDelayResult = (VideoStartUpDelayResult) bpResult;
startUpDelay = startupDelayResult.getStartUpDelay();
break;
case VIDEO_CONCURRENT_SESSION:
VideoConcurrentSessionResult concurrentSessionResult = (VideoConcurrentSessionResult) bpResult;
concurrentSessions = concurrentSessionResult.getMaxConcurrentSessionCount();
break;
default:
break;
}
}
List<Session> allSessions = trace.getAnalyzerResult().getSessionlist();
Map<InetAddress, List<Session>> ipSessionsMap = new HashMap<InetAddress, List<Session>>();
for (Session session : allSessions) {
InetAddress ipAddress = session.getRemoteIP();
if (ipSessionsMap.containsKey(ipAddress)) {
ipSessionsMap.get(ipAddress).add(session);
} else {
List<Session> sess = new ArrayList<Session>();
sess.add(session);
ipSessionsMap.put(ipAddress, sess);
}
}
ipAddress = ipSessionsMap.keySet().size();
ipSessions = allSessions.size();
StreamingVideoData streamingVideoData;
if ((streamingVideoData = trace.getAnalyzerResult().getStreamingVideoData()) == null) {
return;
}
Collection<VideoStream> selectedVideoStreams = streamingVideoData.getVideoStreams();
movieMBytes = calculateMBytes(selectedVideoStreams, false);
totalMBytes = calculateMBytes(selectedVideoStreams, true);
if (trace.getAnalyzerResult().getStreamingVideoData().getStreamingVideoCompiled().getChunkPlayTimeList().isEmpty()) {
startupDelayStatus = false;
} else {
startupDelayStatus = true;
}
}
use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class VideoTabHelperImpl method isStartUpDelaySet.
@Override
public boolean isStartUpDelaySet() {
boolean result = false;
if (videoTrafficCollectorImpl != null && videoTrafficCollectorImpl.getStreamingVideoData() != null) {
StreamingVideoData streamingVideoData = videoTrafficCollectorImpl.getStreamingVideoData();
result = MapUtils.isNotEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList());
}
return result;
}
use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class SegmentTablePanel method reAnalyze.
protected void reAnalyze() {
StreamingVideoData streamingVideoData = analyzerResult.getAnalyzerResult().getStreamingVideoData();
if (streamingVideoData != null) {
streamingVideoData.scanVideoStreams();
}
((MainFrame) aroView).getDiagnosticTab().getGraphPanel().refresh(analyzerResult);
analyzerResult = videoBestPractices.analyze(analyzerResult);
((MainFrame) aroView).getDiagnosticTab().getGraphPanel().setTraceData(analyzerResult);
((MainFrame) aroView).getVideoTab().refreshLocal(analyzerResult, false);
((MainFrame) ((MainFrame) aroView).getDiagnosticTab().getGraphPanel().getGraphPanelParent().getAroView()).refreshBestPracticesTab();
if (!videoStream.getVideoEventMap().isEmpty()) {
if (checkBoxVideo != null && checkBoxAudio != null && (checkBoxVideo.isVisible() || checkBoxAudio.isVisible())) {
refresh(checkBoxVideo, checkBoxAudio);
} else {
refresh(null, null);
}
}
}
use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class VideoBufferOccupancyImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
result = new BufferOccupancyResult();
init(result);
if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultExcelText(bpResultType.getDescription());
selectedManifestCount = streamingVideoData.getSelectedManifestCount();
hasSelectedManifest = (selectedManifestCount > 0);
invalidCount = streamingVideoData.getInvalidManifestCount();
if (selectedManifestCount == 0) {
if (invalidCount == videoStreamCollection.size()) {
result.setResultText(invalidManifestsFound);
} else if (invalidCount > 0) {
result.setResultText(noManifestsSelectedMixed);
} else {
result.setResultText(noManifestsSelected);
}
} else if (selectedManifestCount > 1) {
result.setResultText(multipleManifestsSelected);
} else if (hasSelectedManifest) {
BufferOccupancyBPResult bufferBPResult = tracedata.getBufferOccupancyResult();
BufferTimeBPResult bufferTimeBPResult = tracedata.getBufferTimeResult();
double maxBufferInMB = 0;
if (bufferBPResult != null && bufferBPResult.getBufferByteDataSet().size() > 0) {
double megabyteDivisor = 1000 * 1000;
// getMaxBuffer() returns in bytes
maxBufferInMB = bufferBPResult.getMaxBuffer() / megabyteDivisor;
List<Double> bufferDataSet = bufferBPResult.getBufferByteDataSet();
// In MB
result.setMinBufferByte(bufferDataSet.get(0) / megabyteDivisor);
double bufferSum = bufferDataSet.stream().reduce((a, b) -> a + b).get();
result.setAvgBufferByte((bufferSum / bufferDataSet.size()) / megabyteDivisor);
} else {
maxBufferInMB = 0;
}
if (bufferTimeBPResult != null && bufferTimeBPResult.getBufferTimeDataSet().size() > 0) {
List<Double> bufferTimeDataSet = bufferTimeBPResult.getBufferTimeDataSet();
result.setMinBufferTime(bufferTimeDataSet.get(0));
result.setMaxBufferTime(bufferTimeDataSet.get(bufferTimeDataSet.size() - 1));
double sum = bufferTimeDataSet.stream().reduce((a, b) -> a + b).get();
result.setAvgBufferTime(sum / bufferTimeDataSet.size());
}
result.setSelfTest(true);
result.setMaxBuffer(maxBufferInMB);
double percentage = 0;
double maxBufferSet = getVideoPrefMaxBuffer();
if (maxBufferSet != 0) {
percentage = (maxBufferInMB / maxBufferSet) * 100;
}
if (MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
result.setResultText(startUpDelayNotSet);
bpResultType = BPResultType.CONFIG_REQUIRED;
} else {
if (percentage > 100) {
bpResultType = BPResultType.WARNING;
}
bpResultType = BPResultType.PASS;
result.setResultText(MessageFormat.format(this.textResults, String.format("%.2f", percentage), String.format("%.2f", maxBufferInMB), String.format("%.2f", maxBufferSet)));
result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.format("%.2f", percentage), String.format("%.2f", maxBufferInMB)));
}
}
} else {
result.setSelfTest(false);
result.setResultText(noData);
bpResultType = BPResultType.NO_DATA;
result.setResultExcelText(bpResultType.getDescription());
}
result.setResultType(bpResultType);
return result;
}
use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class AROController method runAnalyzer.
/**
* <p>Note: Do not use this method - use <em>updateModel(...)</em> instead.</p><p>
*
* Analyze a trace and produce a report either in json or html<br>
*
* @param trace The FQPN of the directory or pcap file to analyze
* @param profile The Profile to use for this analysis - LTE if null
* @param filter The filters to use - can be empty for no filtering specified
* @see #updateModel(String, Profile, AnalysisFilter)
*/
public AROTraceData runAnalyzer(String trace, Profile profile, AnalysisFilter filter) {
serv = context.getBean(IAROService.class);
AROTraceData results = new AROTraceData();
long analysisStartTime = System.currentTimeMillis();
try {
// Request garbage collection before loading a trace
System.gc();
LOG.debug("\nAnalyze trace :" + trace);
LOG.debug(String.format("\nTrace initial memory:%d free:%d", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().freeMemory()));
// analyze trace file or directory?
try {
if (serv.isFile(trace)) {
results = serv.analyzeFile(retrieveBestPractices(), trace, profile, filter);
} else {
results = serv.analyzeDirectory(retrieveBestPractices(), trace, profile, filter);
}
if (results.getAnalyzerResult() != null && results.getAnalyzerResult().getStreamingVideoData() != null && !results.getAnalyzerResult().getStreamingVideoData().isFinished()) {
StreamingVideoData streamingVideoData = results.getAnalyzerResult().getStreamingVideoData();
if (!streamingVideoData.getVideoStreamMap().isEmpty()) {
Runnable waitingForUpdate = () -> {
int count = 1;
while (!streamingVideoData.isFinished()) {
LOG.debug(String.format("(%d) Waiting for FFmpegRunner to complete", count++));
Util.sleep(1000);
}
Util.sleep(1000);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
analyzeVideoBP();
}
});
};
new Thread(waitingForUpdate, "waitingForUpdate").start();
}
}
} catch (OutOfMemoryError err) {
LOG.error(err.getMessage(), err);
results = new AROTraceData();
results.setSuccess(false);
results.setError(ErrorCodeRegistry.getOutOfMemoryError());
}
} catch (IOException exception) {
LOG.error(exception.getMessage(), exception);
results.setSuccess(false);
results.setError(ErrorCodeRegistry.getUnknownFileFormat());
}
LOG.debug(String.format("\n%s\nTrace Analysis Elapsed time: %.6f sec.", trace, (double) (System.currentTimeMillis() - analysisStartTime) / 1000));
LOG.debug(String.format("\nTrace analysis completed memory:%d free:%d", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().freeMemory()));
return results;
}
Aggregations