use of com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult 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.BufferOccupancyBPResult in project VideoOptimzer by attdevsupport.
the class BufferOccupancyPlot method populate.
/*
* called by:
* -> VideoChunksPlot.refreshPlot(XYPlot, AROTraceData, double, VideoEvent)
*/
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
if (analysis != null) {
streamingVideoData = analysis.getAnalyzerResult().getStreamingVideoData();
double maxBuffer = 0;
bufferFillDataCollection.removeAllSeries();
for (VideoStream videoStream : streamingVideoData.getVideoStreams()) {
if (videoStream.isSelected()) {
this.videoStream = videoStream;
LOG.debug("VideoStream :" + videoStream.getManifest().getVideoName());
seriesByteBuffer = new XYSeries("Byte Buffer");
ArrayList<XYPair> byteBufferList = videoStream.getByteBufferList();
double yPlotValue = 0.00;
for (XYPair xy : byteBufferList) {
yPlotValue = xy.getYVal();
if (maxBuffer < yPlotValue) {
maxBuffer = yPlotValue;
}
bufferSizeList.add(yPlotValue);
seriesByteBuffer.add(xy.getXVal(), yPlotValue);
}
Collections.sort(bufferSizeList);
bufferFillDataCollection.addSeries(seriesByteBuffer);
LOG.debug(videoStream.getByteToolTipDetailMap());
}
}
XYItemRenderer renderer = new StandardXYItemRenderer();
renderer.setBaseToolTipGenerator(toolTipGenerator());
renderer.setSeriesStroke(0, new BasicStroke(2.0f));
renderer.setSeriesPaint(0, Color.blue);
renderer.setSeriesShape(0, shape);
plot.setRenderer(renderer);
BufferOccupancyBPResult bufferOccupancyResult = bufferOccupancyCalculatorImpl.setMaxBuffer(maxBuffer);
bufferOccupancyResult.setBufferByteDataSet(bufferSizeList);
analysis.getAnalyzerResult().setBufferOccupancyResult(bufferOccupancyResult);
}
plot.setDataset(bufferFillDataCollection);
}
Aggregations