use of com.att.aro.core.bestpractice.pojo.BPResultType in project VideoOptimzer by attdevsupport.
the class VideoTcpConnectionImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
BPResultType bpResultType = BPResultType.SELF_TEST;
VideoTcpConnectionResult result = new VideoTcpConnectionResult();
int sessionCount = 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(invalidStreamsFound);
} else if (invalidCount > 0) {
result.setResultText(noStreamsSelectedMixed);
} else {
result.setResultText(noStreamsSelected);
}
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultExcelText(bpResultType.getDescription());
result.setSelfTest(false);
} else if (selectedCount > 1) {
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultText(multipleStreamsSelected);
result.setResultExcelText(bpResultType.getDescription());
result.setSelfTest(false);
} else {
ArrayList<Session> uniqVideoSessions = new ArrayList<>();
ArrayList<Session> uniqAudioSessions = new ArrayList<>();
for (VideoStream videoStream : videoStreamCollection.values()) {
if (videoStream.isSelected() && !videoStream.getVideoEventMap().isEmpty()) {
for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
if (!uniqVideoSessions.contains(videoEvent.getSession())) {
uniqVideoSessions.add(videoEvent.getSession());
}
}
for (VideoEvent videoEvent : videoStream.getAudioSegmentEventList().values()) {
if (!uniqAudioSessions.contains(videoEvent.getSession())) {
uniqAudioSessions.add(videoEvent.getSession());
}
}
}
}
sessionCount = uniqVideoSessions.size() > uniqAudioSessions.size() ? uniqVideoSessions.size() : uniqAudioSessions.size();
bpResultType = BPResultType.SELF_TEST;
result.setResultText(MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), sessionCount, sessionCount == 1 ? "" : "s"));
result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), sessionCount));
result.setTcpConnections(sessionCount);
result.setSelfTest(true);
}
} 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.bestpractice.pojo.BPResultType in project VideoOptimzer by attdevsupport.
the class UtilTest method test_checkPassFailorWarning.
@Test
public void test_checkPassFailorWarning() {
BPResultType bpResultType = Util.checkPassFailorWarning(0.2, 0.1, 0.4);
assertEquals(bpResultType, BPResultType.WARNING);
}
use of com.att.aro.core.bestpractice.pojo.BPResultType in project VideoOptimzer by attdevsupport.
the class UtilTest method test_intCheckPassFailorWarning.
@Test
public void test_intCheckPassFailorWarning() {
BPResultType bpResultType = Util.checkPassFailorWarning(2, 1, 4);
assertEquals(bpResultType, BPResultType.WARNING);
}
use of com.att.aro.core.bestpractice.pojo.BPResultType 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.bestpractice.pojo.BPResultType 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;
}
Aggregations