Search in sources :

Example 1 with BufferTimeBPResult

use of com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult 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 2 with BufferTimeBPResult

use of com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult in project VideoOptimzer by attdevsupport.

the class BufferInSecondsPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData aroTraceData) {
    seriesPlayTimeBufferCollection.removeAllSeries();
    if (aroTraceData != null && aroTraceData.getAnalyzerResult().getStreamingVideoData() != null) {
        bufferInSecondsCalculatorImpl.setStreamingVideoData(aroTraceData.getAnalyzerResult().getStreamingVideoData());
        for (VideoStream videoStream : aroTraceData.getAnalyzerResult().getStreamingVideoData().getVideoStreams()) {
            if (videoStream.isSelected()) {
                this.videoStream = videoStream;
                LOG.debug("VideoStream :" + videoStream.getManifest().getVideoName());
                seriesPlayTimeBuffer = new XYSeries("Play Time Buffer");
                double yPlotValue = 0.00;
                for (XYPair xy : videoStream.getPlayTimeList()) {
                    yPlotValue = xy.getYVal();
                    bufferTimeList.add(yPlotValue);
                    seriesPlayTimeBuffer.add(xy.getXVal(), yPlotValue);
                    LOG.debug(String.format("%.3f\t%.0f", xy.getXVal(), yPlotValue));
                }
                Collections.sort(bufferTimeList);
                seriesPlayTimeBufferCollection.addSeries(seriesPlayTimeBuffer);
                LOG.debug(videoStream.getByteToolTipDetailMap());
            }
        }
        BufferTimeBPResult bufferTimeResult = bufferInSecondsCalculatorImpl.updateBufferTimeResult(bufferTimeList);
        aroTraceData.getAnalyzerResult().setBufferTimeResult(bufferTimeResult);
        plot.setRenderer(createRenderer());
    }
    plot.setDataset(seriesPlayTimeBufferCollection);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult) XYPair(com.att.aro.core.videoanalysis.XYPair)

Aggregations

BufferTimeBPResult (com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult)2 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)2 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)1 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)1 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)1 BufferOccupancyBPResult (com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult)1 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)1 IVideoUsagePrefsManager (com.att.aro.core.videoanalysis.IVideoUsagePrefsManager)1 XYPair (com.att.aro.core.videoanalysis.XYPair)1 StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)1 MessageFormat (java.text.MessageFormat)1 List (java.util.List)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 Nonnull (javax.annotation.Nonnull)1 AccessLevel (lombok.AccessLevel)1 Getter (lombok.Getter)1 NonNull (lombok.NonNull)1 Setter (lombok.Setter)1