use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class VideoTrafficCollectorImpl method clearData.
@Override
public StreamingVideoData clearData() {
this.segmentRequests.clear();
if (streamingVideoData != null) {
streamingVideoData.getStreamingVideoCompiled().clear();
}
videoTabHelper.resetRequestMapList();
streamingVideoData = new StreamingVideoData("");
return streamingVideoData;
}
use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class VideoTrafficCollectorImpl method collect.
@Override
public StreamingVideoData collect(AbstractTraceResult result, List<Session> sessionlist, SortedMap<Double, HttpRequestResponseInfo> requestMap) {
long analysisStartTime = System.currentTimeMillis();
tracePath = result.getTraceDirectory() + Util.FILE_SEPARATOR;
LOG.debug("\n**** VideoAnalysis for :" + tracePath + "****");
init();
videoPath = tracePath + fileVideoSegments + Util.FILE_SEPARATOR;
if (!filemanager.directoryExist(videoPath)) {
filemanager.mkDir(videoPath);
} else {
filemanager.directoryDeleteInnerFiles(videoPath);
}
streamingVideoData = new StreamingVideoData(result.getTraceDirectory());
videoStreamConstructor.setStreamingVideoData(streamingVideoData);
LOG.debug("\n**** processRequests(requestMap) ****");
processRequests(requestMap);
LOG.debug("\n**** processSegments() ****");
processSegments();
videoStreamConstructor.processFailures();
videoStreamConstructor.clear();
manifestReqMap.clear();
streamingVideoData.scanVideoStreams();
GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendAnalyticsTimings(videoAnalysisTitle, System.currentTimeMillis() - analysisStartTime, analysisCategory);
LOG.debug("\nFinal results: \n" + streamingVideoData);
LOG.debug("\nTraffic HEALTH:\n" + displayFailedRequests());
LOG.debug("\n**** FIN **** " + tracePath + "\n\n");
videoSegmentAnalyzer.process(result, streamingVideoData);
LOG.debug(String.format("\nVideo Analysis Elapsed time: %.6f", (double) (System.currentTimeMillis() - analysisStartTime) / 1000));
return streamingVideoData;
}
use of com.att.aro.core.videoanalysis.pojo.StreamingVideoData in project VideoOptimzer by attdevsupport.
the class OpenPcapFileDialog method processPcapFile.
private Void processPcapFile(boolean retainDirectory) {
StringBuilder commands = new StringBuilder();
if (Util.isWindowsOS()) {
commands.append("mkdir \"" + newPcapFileTracePath + "\" && ");
// Create an empty .readme file to identify if its a folder created by VO
commands.append("type nul > \"" + newPcapFileTracePath + Util.FILE_SEPARATOR + ".readme\" && ");
commands.append("attrib +h \"" + newPcapFileTracePath + Util.FILE_SEPARATOR + ".readme\" && ");
if (retainDirectory) {
commands.append("move \"" + originalPcapFileObj.getAbsolutePath() + "\" \"" + newPcapFileTracePath + "\"");
} else {
commands.append("copy \"" + originalPcapFileObj.getAbsolutePath() + "\" \"" + newPcapFileTracePath + "\"");
}
} else {
commands.append("mkdir '" + newPcapFileTracePath + "' ; ");
// Create an empty .readme file to identify if its a folder created by VO
commands.append("touch '" + newPcapFileTracePath + Util.FILE_SEPARATOR + ".readme' ; ");
if (retainDirectory) {
commands.append("mv '" + originalPcapFileObj.getAbsolutePath() + "' '" + newPcapFileTracePath + "'");
} else {
commands.append("ln -s '" + originalPcapFileObj.getAbsolutePath() + "' '" + newPcapFileTracePath + Util.FILE_SEPARATOR + originalPcapFileObj.getName() + "'");
}
}
LOG.debug("Command to execute: " + commands.toString());
String result = extRunner.executeCmd(commands.toString());
LOG.debug("Command execution result: " + result);
reloadTrace();
if (retainDirectory) {
UserPreferencesFactory.getInstance().create().setLastTraceDirectory(new File(newPcapFileTracePath));
}
GoogleAnalyticsUtil.getAndIncrementTraceCounter();
// Delete the new directory after analysis is completed, if don't need to retain
if (!retainDirectory) {
if (parent instanceof MainFrame) {
while (!((MainFrame) parent).getAroSwingWorker().isDone()) {
LOG.debug("Waiting for analysis to be completed");
Util.sleep(1000);
}
PacketAnalyzerResult analyzerResult = ((MainFrame) parent).getController().getCurrentTraceInitialAnalyzerResult();
if (analyzerResult != null && analyzerResult.getStreamingVideoData() != null && !analyzerResult.getStreamingVideoData().isFinished()) {
StreamingVideoData streamingVideoData = analyzerResult.getStreamingVideoData();
// Wait for FFMpegRunner to complete
if (!streamingVideoData.getVideoStreamMap().isEmpty()) {
Runnable waitingForUpdate = () -> {
int count = 1;
while (!streamingVideoData.isFinished()) {
LOG.info(String.format("(%d) Waiting for FFmpegRunner to complete", count++));
Util.sleep(1000);
}
Util.sleep(1000);
deleteDirectory(newPcapFileTracePath);
};
new Thread(waitingForUpdate, "FFMpegRunnerWaitingThread").start();
} else {
deleteDirectory(newPcapFileTracePath);
}
} else {
deleteDirectory(newPcapFileTracePath);
}
} else {
deleteDirectory(newPcapFileTracePath);
}
PreferenceHandlerImpl.getInstance().setPref("TRACE_PATH", originalPcapFileObj.toString());
}
return null;
}
Aggregations