Search in sources :

Example 1 with BPResultType

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

the class HtmlReportImpl method getBpRows.

// gets all bp rows - name, result (pass/fail/warning/selftest)
// end of first table - difference in columns in 2nd table
private String getBpRows(List<AbstractBestPracticeResult> bpResults) {
    ArrayList<StringBuffer> sbTemps = new ArrayList<StringBuffer>();
    // makes the row start tag and BP name cell
    for (int row = 0; row < bpResults.size(); row++) {
        StringBuffer temp = new StringBuffer(65);
        temp.append(tableLIne() + "<tr><th rowspan=\"2\">" + "<a href =\"" + bpResults.get(row).getLearnMoreUrl() + "\" target=\"_blank\" >" + bpResults.get(row).getBestPracticeType().getDescription() + "<a></th>");
        sbTemps.add(temp);
    }
    for (int row = 0; row < bpResults.size(); row++) {
        StringBuffer temp = sbTemps.get(row);
        BPResultType result = bpResults.get(row).getResultType();
        if (result.equals(BPResultType.PASS)) {
            temp.append("<td class='success'>" + result + tableChange() + "<tr><td class='success'>" + formatResultText(bpResults.get(row).getResultText()) + tableSeperate());
        } else if (result.equals(BPResultType.FAIL)) {
            temp.append("<td class='danger'>" + result + tableChange() + "<tr><td class='danger'>" + formatResultText(bpResults.get(row).getResultText()) + tableSeperate());
        } else if (result.equals(BPResultType.WARNING)) {
            temp.append("<td class='warning'>" + result + tableChange() + "<tr><td class='warning'>" + formatResultText(bpResults.get(row).getResultText()) + tableSeperate());
        } else {
            temp.append("<td class='info'>" + result + tableChange() + "<tr><td class='info'>" + formatResultText(bpResults.get(row).getResultText()) + tableSeperate());
        }
    }
    // makes the row end tag and starts new line
    for (int row = 0; row < sbTemps.size(); row++) {
        StringBuffer temp = sbTemps.get(row);
        temp.append("</tr>");
        temp.append(System.getProperty(lineSeperator()));
    }
    StringBuffer finalBpRows = new StringBuffer();
    for (int i = 0; i < sbTemps.size(); i++) {
        finalBpRows.append(sbTemps.get(i).toString());
    }
    return finalBpRows.toString();
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) ArrayList(java.util.ArrayList)

Example 2 with BPResultType

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

the class VideoAdaptiveBitrateLadderImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    result = new VideoAdaptiveBitrateLadderResult();
    init(result);
    qualityMap.clear();
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        selectedManifestCount = streamingVideoData.getSelectedManifestCount();
        hasSelectedManifest = (selectedManifestCount > 0);
        invalidCount = streamingVideoData.getInvalidManifestCount();
        bpResultType = BPResultType.CONFIG_REQUIRED;
        result.setResultExcelText(bpResultType.getDescription());
        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) {
            QualityTime qualityTime;
            double maxTime = 0;
            QualityTime maxSection = null;
            double videoRatio = 1;
            double durationTotal = 0;
            Set<String> resolutions = new TreeSet<>();
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap())) {
                    videoRatio = PERCENTILE_LINE / videoStream.getDuration();
                    for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                        if (videoEvent.isNormalSegment() && videoEvent.isSelected()) {
                            resolutions.add(String.valueOf(videoEvent.getResolutionHeight()));
                            double duration = videoEvent.getDuration();
                            durationTotal += duration;
                            Integer track = StringParse.stringToDouble(videoEvent.getQuality(), 0).intValue();
                            if ((qualityTime = qualityMap.get(track)) != null) {
                                int count = qualityTime.getCount();
                                qualityTime.setDuration(qualityTime.getDuration() + duration);
                                qualityTime.setPercentage(qualityTime.getDuration() * videoRatio);
                                qualityTime.setBitrateAverage((qualityTime.getBitrateAverage() * count + videoEvent.getBitrate()) / ++count);
                                qualityTime.setCount(count);
                            } else {
                                qualityTime = new QualityTime(videoEvent.getManifest().getVideoName(), 1, track, duration, duration * videoRatio, videoEvent.getResolutionHeight(), videoEvent.getSegmentStartTime(), // bitrateDeclared (kbps)
                                videoEvent.getChildManifest().getBandwidth() / 1000, // bitrateAverage (kbps)
                                videoEvent.getBitrate());
                                qualityMap.put(track, qualityTime);
                            }
                            if (maxTime < qualityTime.getDuration()) {
                                maxTime = qualityTime.getDuration();
                                maxSection = qualityTime;
                            }
                        }
                    }
                }
            }
            bpResultType = BPResultType.SELF_TEST;
            int count = qualityMap.size();
            double maxDuration = 0;
            double percentage = 0;
            int track = 0;
            if (maxSection != null) {
                maxDuration = maxSection.getDuration();
                percentage = maxSection.getPercentage();
                track = maxSection.getTrack();
            }
            result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "s", track, String.format("%.2f", maxDuration), String.format("%.2f", percentage), String.format("%.3f", durationTotal)));
            result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.join("p, ", resolutions) + "p"));
        } else {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(novalidManifestsFound);
            result.setResultExcelText(bpResultType.getDescription());
        }
        result.setResults(qualityMap);
    } else {
        // No Data
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    result.setResults(qualityMap);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) TreeSet(java.util.TreeSet) QualityTime(com.att.aro.core.videoanalysis.pojo.QualityTime) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoAdaptiveBitrateLadderResult(com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 3 with BPResultType

use of com.att.aro.core.bestpractice.pojo.BPResultType 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 4 with BPResultType

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

the class VideoResolutionQualityImpl method presetResultsByDevice.

private BPResultType presetResultsByDevice(AbstractTraceResult traceResults) {
    noDPIflag = false;
    BPResultType resultType = BPResultType.NONE;
    if (traceResults != null && traceResults instanceof TraceDirectoryResult) {
        DeviceDetail deviceDetail = ((TraceDirectoryResult) traceResults).getDeviceDetail();
        String deviceModel = deviceDetail.getDeviceModel();
        String[] screenSize = deviceDetail.getScreenSize().split("\\*");
        if (screenSize != null && screenSize.length > 0) {
            double screenHeight = Double.valueOf(screenSize[0]);
            if (deviceDetail.getOsType().equals("android") && deviceDetail.getScreenDensity() == 0) {
                noDPIflag = true;
                conditionalMessage = " " + noDPI;
                resultType = BPResultType.SELF_TEST;
            }
            if (deviceModel.startsWith("iPad") || isTablet(screenHeight, deviceDetail.getScreenDensity())) {
                resultType = BPResultType.PASS;
            }
        }
    }
    return resultType;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) DeviceDetail(com.att.aro.core.peripheral.pojo.DeviceDetail)

Example 5 with BPResultType

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

the class VideoStallImpl method updateStallResult.

private VideoStall updateStallResult(VideoStall stall) {
    BPResultType bpResultType = Util.checkPassFailorWarning(stall.getDuration(), videoPref.getVideoUsagePreference().getStallDurationWarnVal(), videoPref.getVideoUsagePreference().getStallDurationFailVal());
    if (bpResultType == BPResultType.FAIL) {
        failCount = failCount + 1;
    } else if (bpResultType == BPResultType.PASS) {
        passCount = passCount + 1;
    } else {
        warningCount = warningCount + 1;
    }
    stall.setStallState(bpResultType.toString());
    return stall;
}
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