use of com.att.aro.core.videoanalysis.pojo.VideoStream 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.VideoStream in project VideoOptimzer by attdevsupport.
the class VideoStartUpDelayImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
BPResultType bpResultType = BPResultType.SELF_TEST;
result = new VideoStartUpDelayResult();
init(result);
warningValue = videoPref.getVideoUsagePreference().getStartUpDelayWarnVal();
if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
selectedManifestCount = streamingVideoData.getSelectedManifestCount();
hasSelectedManifest = (selectedManifestCount > 0);
invalidCount = streamingVideoData.getInvalidManifestCount();
// default startup delay
startupDelay = videoPref.getVideoUsagePreference().getStartupDelay();
startupDelaySet = false;
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
if (selectedManifestCount == 0) {
if (invalidCount == videoStreamCollection.size()) {
result.setResultText(invalidManifestsFound);
} else if (invalidCount > 0) {
result.setResultText(noManifestsSelectedMixed);
} else {
if (videoStreamCollection.size() > 0 && MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
result.setResultText(startUpDelayNotSet);
} else {
result.setResultText(noManifestsSelected);
}
}
} else if (MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
result.setResultText(startUpDelayNotSet);
} else if (selectedManifestCount > 1) {
result.setResultText(multipleManifestsSelected);
} else if (hasSelectedManifest) {
startupDelaySet = true;
for (VideoStream videoStream : videoStreamCollection.values()) {
if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap()) && videoStream.getManifest().getStartupVideoEvent() != null) {
Manifest manifest = videoStream.getManifest();
manifestRequestTime = manifest.getRequestTime();
// - tracedata.getTraceresult().getPcapTimeOffset();
manifestDeliveredTime = manifest.getEndTime() - manifestRequestTime;
startupDelay = manifest.getStartupDelay() - manifestRequestTime;
playDelay = manifest.getStartupDelay() - manifestRequestTime;
LOG.info(String.format("startup segment = %s", manifest.getStartupVideoEvent()));
LOG.info(String.format("segment startupDelay = %.03f", startupDelay));
LOG.info(String.format("videoStream request to segment_plays = %.03f", manifest.getStartupVideoEvent().getPlayTime() - manifestRequestTime));
LOG.info(String.format("segment_plays = %.03f", manifest.getStartupVideoEvent().getPlayTime()));
List<VideoStartup> compApps = new ArrayList<>();
compApps.add(new VideoStartup("RefApp 1", 0.914, 3.423));
compApps.add(new VideoStartup("RefApp 2", 3.27, 8.400));
compApps.add(new VideoStartup("RefApp 3", 2.409, 3.969));
VideoStartup testedApp = new VideoStartup("Tested", manifestDeliveredTime, playDelay);
compApps.add(testedApp);
result.setResults(compApps);
bpResultType = Util.checkPassFailorWarning(startupDelay, warningValue);
if (bpResultType.equals(BPResultType.PASS)) {
result.setResultText(MessageFormat.format(textResultPass, startupDelay, startupDelay == 1 ? "" : "s"));
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
result.setResultText(MessageFormat.format(textResults, String.format("%.03f", startupDelay), startupDelay == 1 ? "" : "s", String.format("%.04f", warningValue), warningValue == 1 ? "" : "s"));
result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.format("%.03f", startupDelay)));
}
break;
}
}
} else {
bpResultType = BPResultType.CONFIG_REQUIRED;
result.setResultText(novalidManifestsFound);
result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
}
result.setStartUpDelay(startupDelay);
} else {
// No Data
result.setResultText(noData);
bpResultType = BPResultType.NO_DATA;
result.setResultExcelText(BPResultType.NO_DATA.getDescription());
}
result.setResultType(bpResultType);
return result;
}
use of com.att.aro.core.videoanalysis.pojo.VideoStream 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;
}
use of com.att.aro.core.videoanalysis.pojo.VideoStream in project VideoOptimzer by attdevsupport.
the class VideoConcurrentSessionImpl method manifestConcurrentSessions.
public List<VideoConcurrentSession> manifestConcurrentSessions(SortedMap<Double, VideoStream> videoStreamMap) {
List<VideoConcurrentSession> concurrentSessionList = new ArrayList<VideoConcurrentSession>();
if (MapUtils.isNotEmpty(videoStreamCollection)) {
for (VideoStream videoStream : videoStreamMap.values()) {
if (videoStream.isSelected()) {
ArrayList<Double> sessionStartTimes = new ArrayList<>();
ArrayList<Double> sessionEndTimes = new ArrayList<>();
ArrayList<Session> sessionList = new ArrayList<>();
SortedMap<String, VideoEvent> videoEventList = videoStream.getVideoEventMap();
for (VideoEvent veEntry : videoEventList.values()) {
Session session = veEntry.getSession();
if (!sessionList.contains(session)) {
sessionList.add(session);
sessionStartTimes.add(session.getSessionStartTime());
sessionEndTimes.add(session.getSessionEndTime());
}
}
VideoConcurrentSession videoConcurrentSession = findConcurrency(sessionStartTimes, sessionEndTimes);
if (videoConcurrentSession != null && videoConcurrentSession.getConcurrentSessionCount() > 0) {
videoConcurrentSession.setVideoName(videoStream.getManifest().getVideoName());
concurrentSessionList.add(videoConcurrentSession);
}
}
}
}
return concurrentSessionList;
}
use of com.att.aro.core.videoanalysis.pojo.VideoStream in project VideoOptimzer by attdevsupport.
the class VideoSegmentPacingImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
BPResultType bpResultType = BPResultType.SELF_TEST;
VideoChunkPacingResult result = new VideoChunkPacingResult();
Double dlFirst = Double.MAX_VALUE;
Double dlLast = 0D;
int count = 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());
result.setSelfTest(false);
} else if (selectedCount > 1) {
result.setResultText(multipleManifestsSelected);
bpResultType = BPResultType.CONFIG_REQUIRED;
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()) {
count++;
double dlTime = videoEvent.getDLLastTimestamp();
if (dlTime < dlFirst) {
// look for earliest download of valid segment in a stream
dlFirst = dlTime;
}
if (dlTime > dlLast) {
// look for last download of valid segment in a stream
dlLast = dlTime;
}
}
}
break;
}
}
double segmentPacing = 0;
if (count > 1) {
segmentPacing = (dlLast - dlFirst) / (count - 1);
}
bpResultType = BPResultType.SELF_TEST;
result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "different", count == 1 ? "" : "s", count == 1 ? "was" : "were", segmentPacing, MathUtils.equals(segmentPacing, 1.0) ? "" : "s"));
result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), count, count <= 1 ? "" : "different", count <= 1 ? "" : "s", count <= 1 ? "was" : "were", segmentPacing, segmentPacing <= 1.0 ? "" : "s"));
result.setChunkPacing(segmentPacing);
result.setSelfTest(true);
}
} else {
result.setResultText(noData);
bpResultType = BPResultType.NO_DATA;
result.setResultExcelText(bpResultType.getDescription());
}
result.setResultType(bpResultType);
return result;
}
Aggregations