Search in sources :

Example 11 with StreamingVideoData

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;
}
Also used : StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData)

Example 12 with 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;
}
Also used : StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData)

Example 13 with 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;
}
Also used : StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) File(java.io.File) MainFrame(com.att.aro.ui.view.MainFrame)

Aggregations

StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)13 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)6 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)4 List (java.util.List)4 TreeMap (java.util.TreeMap)4 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)3 ArrayList (java.util.ArrayList)3 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)2 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)2 AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)2 Session (com.att.aro.core.packetanalysis.pojo.Session)2 VideoStall (com.att.aro.core.packetanalysis.pojo.VideoStall)2 IVideoUsagePrefsManager (com.att.aro.core.videoanalysis.IVideoUsagePrefsManager)2 File (java.io.File)2 Collections (java.util.Collections)2 StringUtils (org.apache.commons.lang.StringUtils)2 LogManager (org.apache.log4j.LogManager)2 Logger (org.apache.log4j.Logger)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 IAROService (com.att.aro.core.IAROService)1