use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoNetworkComparisonImpl method getAvgBitRate.
private double getAvgBitRate(double summaryBitRate, List<VideoEvent> filteredVideoSegment) {
double avgBitRate;
for (VideoEvent videoEvent : filteredVideoSegment) {
// logger.debug(" BitRate: "+videoEvent.getBitrate());
summaryBitRate += videoEvent.getBitrate();
}
// kbps
avgBitRate = summaryBitRate / (1024 * filteredVideoSegment.size());
LOGGER.debug("avgBitRate: " + avgBitRate);
return avgBitRate;
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoNetworkComparisonImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
BPResultType bpResultType = BPResultType.SELF_TEST;
double avgKbps = 0.0;
double avgBitRate = 0.0;
double summaryBitRate = 0.0;
VideoNetworkComparisonResult result = new VideoNetworkComparisonResult();
init(result);
SortedMap<Integer, SegmentComparison> qualityMap = new TreeMap<>();
if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
selectedCount = streamingVideoData.getSelectedManifestCount();
invalidCount = streamingVideoData.getInvalidManifestCount();
List<VideoEvent> filteredVideoSegment = filterVideoSegment(streamingVideoData);
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.CONFIG_REQUIRED.getDescription());
result.setSelfTest(false);
} else if (selectedCount > 1) {
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultText(multipleManifestsSelected);
result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
result.setSelfTest(false);
} else {
SegmentComparison segmentComparison;
for (VideoStream videoStream : videoStreamCollection.values()) {
if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap())) {
for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
if (videoEvent.isNormalSegment() && videoEvent.isSelected()) {
Integer track = StringParse.stringToDouble(videoEvent.getQuality(), 0).intValue();
double endTS = videoEvent.getEndTS();
double startTS = videoEvent.getStartTS();
double durationInMilliseconds = endTS - startTS;
double throughput = 0.0;
if (durationInMilliseconds > 0) {
throughput = (videoEvent.getTotalBytes() * 8) / durationInMilliseconds;
}
if ((segmentComparison = qualityMap.get(track)) != null) {
int count = segmentComparison.getCount();
segmentComparison.setCount(++count);
segmentComparison.getCalculatedThroughputList().add(throughput);
} else {
List<Double> throughputs = new ArrayList<Double>();
throughputs.add(throughput);
segmentComparison = new SegmentComparison(videoEvent.getManifest().getVideoName(), // declaredBitrate (kbps)
1, // declaredBitrate (kbps)
track, // declaredBitrate (kbps)
videoEvent.getChildManifest().getBandwidth() / 1000.0, throughputs);
qualityMap.put(track, segmentComparison);
}
}
}
}
}
result.setResults(qualityMap);
avgBitRate = getAvgBitRate(summaryBitRate, filteredVideoSegment);
avgKbps = getAvgThroughput(tracedata);
result.setAvgBitRate(avgBitRate);
result.setAvgKbps(avgKbps);
result.setSelfTest(true);
bpResultType = BPResultType.SELF_TEST;
result.setResultText(MessageFormat.format(textResults, avgKbps, avgBitRate));
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.SELF_TEST.getDescription(), avgKbps, avgBitRate));
}
} else {
result.setResultText(noData);
result.setResultExcelText(BPResultType.NO_DATA.getDescription());
bpResultType = BPResultType.NO_DATA;
}
result.setResultType(bpResultType);
return result;
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoResolutionQualityImpl method scanManifestsForHeight.
/**
* Sets values on maxHeightUsed and overSizeCount
* @param videoStreamCollection
*/
private void scanManifestsForHeight(SortedMap<Double, VideoStream> videoStreamCollection) {
maxHeightUsed = 0;
overSizeCount = 0;
for (VideoStream videoStream : videoStreamCollection.values()) {
if (videoStream.isSelected()) {
for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
double height = videoEvent.getResolutionHeight();
if (height > maxHeightUsed) {
maxHeightUsed = height;
}
if (height > MAX_HEIGHT) {
overSizeCount++;
}
}
break;
}
}
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoSegmentSizeImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
BPResultType bpResultType = BPResultType.SELF_TEST;
VideoChunkSizeResult result = new VideoChunkSizeResult();
double totalSize = 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());
} else if (selectedCount > 1) {
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultText(multipleManifestsSelected);
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()) {
continue;
}
count++;
totalSize += videoEvent.getSize();
}
break;
}
}
if (count != 0) {
averageSize = totalSize / count;
}
bpResultType = BPResultType.SELF_TEST;
result.setSelfTest(true);
result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "different", count == 1 ? "" : "s", (int) averageSize / 1024));
result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), count, (int) averageSize / 1024));
// Size in KB
result.setSegmentSize((int) averageSize / 1024);
result.setSegmentCount((int) count);
}
} else {
result.setResultText(noData);
bpResultType = BPResultType.NO_DATA;
result.setResultExcelText(bpResultType.getDescription());
result.setSelfTest(false);
}
result.setResultType(bpResultType);
return result;
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoVariableBitrateImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
bpResultType = BPResultType.SELF_TEST;
result = new VideoVariableBitrateResult();
init(result);
if (tracedata == null) {
return result;
}
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) {
bpResultType = BPResultType.NONE;
for (VideoStream videoStream : videoStreamCollection.values()) {
if (videoStream.isValid() && videoStream.isSelected()) {
if (videoStream.getManifest().isVideoMetaDataExtracted()) {
Collection<VideoEvent> videoEventList = videoStream.getVideoEventsBySegment();
double[] uniqueBitRates = videoEventList.stream().mapToDouble(ve -> ve.getBitrate()).distinct().toArray();
if (uniqueBitRates.length == 1 && videoEventList.size() != 1) {
vbrUsed = false;
break;
}
} else {
result.setResultText(drmBlocking);
result.setResultType(BPResultType.SELF_TEST);
result.setResultExcelText(MessageFormat.format(textExcelDRMBlocking, BPResultType.SELF_TEST.getDescription()));
return result;
}
}
}
if (vbrUsed) {
result.setResultText(textResultPass);
bpResultType = BPResultType.PASS;
} else {
result.setResultText(textResults);
bpResultType = BPResultType.WARNING;
}
result.setResultExcelText(bpResultType.getDescription());
}
} else {
result.setResultText(noData);
bpResultType = BPResultType.NO_DATA;
result.setResultExcelText(bpResultType.getDescription());
}
result.setResultType(bpResultType);
return result;
}
Aggregations