Search in sources :

Example 11 with BPResultType

use of com.att.aro.core.bestpractice.pojo.BPResultType in project VideoOptimzer by attdevsupport.

the class VideoStartUpDelayImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    result = new VideoStartUpDelayResult();
    init(result);
    warningValue = videoPref.getVideoUsagePreference().getStartUpDelayWarnVal();
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        selectedManifestCount = streamingVideoData.getSelectedManifestCount();
        hasSelectedManifest = (selectedManifestCount > 0);
        invalidCount = streamingVideoData.getInvalidManifestCount();
        // default startup delay
        startupDelay = videoPref.getVideoUsagePreference().getStartupDelay();
        startupDelaySet = false;
        bpResultType = BPResultType.CONFIG_REQUIRED;
        result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
        if (selectedManifestCount == 0) {
            if (invalidCount == videoStreamCollection.size()) {
                result.setResultText(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                if (videoStreamCollection.size() > 0 && MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
                    result.setResultText(startUpDelayNotSet);
                } else {
                    result.setResultText(noManifestsSelected);
                }
            }
        } else if (MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
            result.setResultText(startUpDelayNotSet);
        } else if (selectedManifestCount > 1) {
            result.setResultText(multipleManifestsSelected);
        } else if (hasSelectedManifest) {
            startupDelaySet = true;
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap()) && videoStream.getManifest().getStartupVideoEvent() != null) {
                    Manifest manifest = videoStream.getManifest();
                    manifestRequestTime = manifest.getRequestTime();
                    // - tracedata.getTraceresult().getPcapTimeOffset();
                    manifestDeliveredTime = manifest.getEndTime() - manifestRequestTime;
                    startupDelay = manifest.getStartupDelay() - manifestRequestTime;
                    playDelay = manifest.getStartupDelay() - manifestRequestTime;
                    LOG.info(String.format("startup segment = %s", manifest.getStartupVideoEvent()));
                    LOG.info(String.format("segment startupDelay = %.03f", startupDelay));
                    LOG.info(String.format("videoStream request to segment_plays = %.03f", manifest.getStartupVideoEvent().getPlayTime() - manifestRequestTime));
                    LOG.info(String.format("segment_plays = %.03f", manifest.getStartupVideoEvent().getPlayTime()));
                    List<VideoStartup> compApps = new ArrayList<>();
                    compApps.add(new VideoStartup("RefApp 1", 0.914, 3.423));
                    compApps.add(new VideoStartup("RefApp 2", 3.27, 8.400));
                    compApps.add(new VideoStartup("RefApp 3", 2.409, 3.969));
                    VideoStartup testedApp = new VideoStartup("Tested", manifestDeliveredTime, playDelay);
                    compApps.add(testedApp);
                    result.setResults(compApps);
                    bpResultType = Util.checkPassFailorWarning(startupDelay, warningValue);
                    if (bpResultType.equals(BPResultType.PASS)) {
                        result.setResultText(MessageFormat.format(textResultPass, startupDelay, startupDelay == 1 ? "" : "s"));
                        result.setResultExcelText(BPResultType.PASS.getDescription());
                    } else {
                        result.setResultText(MessageFormat.format(textResults, String.format("%.03f", startupDelay), startupDelay == 1 ? "" : "s", String.format("%.04f", warningValue), warningValue == 1 ? "" : "s"));
                        result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.format("%.03f", startupDelay)));
                    }
                    break;
                }
            }
        } else {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(novalidManifestsFound);
            result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
        }
        result.setStartUpDelay(startupDelay);
    } else {
        // No Data
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(BPResultType.NO_DATA.getDescription());
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : VideoStartup(com.att.aro.core.videoanalysis.pojo.VideoStartup) BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) ArrayList(java.util.ArrayList) List(java.util.List) Manifest(com.att.aro.core.videoanalysis.pojo.Manifest) VideoStartUpDelayResult(com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult)

Example 12 with BPResultType

use of com.att.aro.core.bestpractice.pojo.BPResultType in project VideoOptimzer by attdevsupport.

the class VideoSegmentPacingImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    VideoChunkPacingResult result = new VideoChunkPacingResult();
    Double dlFirst = Double.MAX_VALUE;
    Double dlLast = 0D;
    int count = 0;
    init(result);
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        selectedCount = streamingVideoData.getSelectedManifestCount();
        invalidCount = streamingVideoData.getInvalidManifestCount();
        if (selectedCount == 0) {
            if (invalidCount == videoStreamCollection.size()) {
                result.setResultText(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                result.setResultText(noManifestsSelected);
            }
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultExcelText(bpResultType.getDescription());
            result.setSelfTest(false);
        } else if (selectedCount > 1) {
            result.setResultText(multipleManifestsSelected);
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultExcelText(bpResultType.getDescription());
            result.setSelfTest(false);
        } else {
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream != null && videoStream.isSelected() && !videoStream.getVideoEventsBySegment().isEmpty()) {
                    for (VideoEvent videoEvent : videoStream.getVideoEventsBySegment()) {
                        if (videoEvent.isNormalSegment()) {
                            count++;
                            double dlTime = videoEvent.getDLLastTimestamp();
                            if (dlTime < dlFirst) {
                                // look for earliest download of valid segment in a stream
                                dlFirst = dlTime;
                            }
                            if (dlTime > dlLast) {
                                // look for last download of valid segment in a stream
                                dlLast = dlTime;
                            }
                        }
                    }
                    break;
                }
            }
            double segmentPacing = 0;
            if (count > 1) {
                segmentPacing = (dlLast - dlFirst) / (count - 1);
            }
            bpResultType = BPResultType.SELF_TEST;
            result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "different", count == 1 ? "" : "s", count == 1 ? "was" : "were", segmentPacing, MathUtils.equals(segmentPacing, 1.0) ? "" : "s"));
            result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), count, count <= 1 ? "" : "different", count <= 1 ? "" : "s", count <= 1 ? "was" : "were", segmentPacing, segmentPacing <= 1.0 ? "" : "s"));
            result.setChunkPacing(segmentPacing);
            result.setSelfTest(true);
        }
    } else {
        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) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) VideoChunkPacingResult(com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult)

Example 13 with BPResultType

use of com.att.aro.core.bestpractice.pojo.BPResultType in project VideoOptimzer by attdevsupport.

the class BpTestsConductedPanel method loadImageIcon.

/**
 * locate and load an ImageIcon based on AbstractBestPracticeResult
 *
 * @param bestPracticeResult
 * @return ImageIcon corresponding to PASS, FAIL, WARNING, SELF_TEST
 */
private ImageIcon loadImageIcon(AbstractBestPracticeResult bestPracticeResult) {
    // PASS, FAIL or WARNING
    BPResultType resType = bestPracticeResult.getResultType();
    String imageName = "Image.naGray";
    if (resType.equals(BPResultType.PASS)) {
        imageName = "Image.bpPassDark";
    } else if (resType.equals(BPResultType.FAIL)) {
        imageName = "Image.bpFailDark";
    } else if (resType.equals(BPResultType.WARNING)) {
        imageName = "Image.bpWarningDark";
    } else if (resType.equals(BPResultType.SELF_TEST)) {
        imageName = "Image.bpManual";
    } else if (resType.equals(BPResultType.CONFIG_REQUIRED)) {
        imageName = "Image.bpConfig";
    } else if (resType.equals(BPResultType.NO_DATA)) {
        imageName = "Image.bpNoData";
    }
    return UIComponent.getInstance().getIconByKey(imageName);
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType)

Aggregations

BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)13 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)7 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3 TreeMap (java.util.TreeMap)2 Test (org.junit.Test)2 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)1 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)1 VideoAdaptiveBitrateLadderResult (com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult)1 VideoChunkPacingResult (com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult)1 VideoChunkSizeResult (com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)1 VideoNetworkComparisonResult (com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult)1 VideoStartUpDelayResult (com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult)1 VideoTcpConnectionResult (com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult)1 BufferOccupancyBPResult (com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult)1 BufferTimeBPResult (com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult)1 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)1 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)1