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;
}
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);
}
Aggregations