Search in sources :

Example 1 with StreamingVideoData

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;
    }
}
Also used : VideoRedundancyResult(com.att.aro.core.bestpractice.pojo.VideoRedundancyResult) HashMap(java.util.HashMap) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) VideoNetworkComparisonResult(com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult) ArrayList(java.util.ArrayList) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) VideoStallResult(com.att.aro.core.bestpractice.pojo.VideoStallResult) VideoConcurrentSessionResult(com.att.aro.core.bestpractice.pojo.VideoConcurrentSessionResult) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) VideoTcpConnectionResult(com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) ArrayList(java.util.ArrayList) List(java.util.List) VideoChunkPacingResult(com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult) VideoChunkSizeResult(com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult) VideoStartUpDelayResult(com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult) InetAddress(java.net.InetAddress) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 2 with StreamingVideoData

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

Example 3 with StreamingVideoData

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

Example 4 with StreamingVideoData

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;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) Setter(lombok.Setter) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) Getter(lombok.Getter) MapUtils(org.apache.commons.collections.MapUtils) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) NonNull(lombok.NonNull) Autowired(org.springframework.beans.factory.annotation.Autowired) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult) MessageFormat(java.text.MessageFormat) Value(org.springframework.beans.factory.annotation.Value) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) List(java.util.List) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) AccessLevel(lombok.AccessLevel) TreeMap(java.util.TreeMap) IBestPractice(com.att.aro.core.bestpractice.IBestPractice) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) IVideoUsagePrefsManager(com.att.aro.core.videoanalysis.IVideoUsagePrefsManager) Nonnull(javax.annotation.Nonnull) SortedMap(java.util.SortedMap) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult)

Example 5 with StreamingVideoData

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

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