use of com.att.aro.core.bestpractice.pojo.VideoConcurrentSession in project VideoOptimzer by attdevsupport.
the class BPVideoConcurrentSessionTablePanel method getContentTable.
@SuppressWarnings("unchecked")
public DataTable<VideoConcurrentSession> getContentTable() {
if (contentTable == null) {
contentTable = new DataTable<VideoConcurrentSession>(tableModel);
contentTable.setName(ResourceBundleHelper.getMessageString("video.concurrent.session.tableName"));
contentTable.setAutoCreateRowSorter(true);
contentTable.setGridColor(Color.LIGHT_GRAY);
contentTable.setRowHeight(ROW_HEIGHT);
contentTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
DataTablePopupMenu popupMenu = (DataTablePopupMenu) contentTable.getPopup();
popupMenu.initialize();
}
return contentTable;
}
use of com.att.aro.core.bestpractice.pojo.VideoConcurrentSession in project VideoOptimzer by attdevsupport.
the class VideoConcurrentSessionImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
result = new VideoConcurrentSessionResult();
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) {
bpResultType = BPResultType.SELF_TEST;
int maxManifestConcurrentSessions = 0;
List<VideoConcurrentSession> manifestConcurrency = new ArrayList<VideoConcurrentSession>();
manifestConcurrency = manifestConcurrentSessions(videoStreamCollection);
result.setResults(manifestConcurrency);
for (VideoConcurrentSession manifestSession : manifestConcurrency) {
if (maxManifestConcurrentSessions < manifestSession.getConcurrentSessionCount()) {
maxManifestConcurrentSessions = manifestSession.getConcurrentSessionCount();
}
}
result.setMaxConcurrentSessionCount(maxManifestConcurrentSessions);
if (maxManifestConcurrentSessions > 0) {
result.setResultText(MessageFormat.format(textResults, maxManifestConcurrentSessions));
} else {
result.setResultText(nonConcurrent);
}
result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), maxManifestConcurrentSessions));
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.VideoConcurrentSession in project VideoOptimzer by attdevsupport.
the class VideoConcurrentSessionImpl method findConcurrency.
private VideoConcurrentSession findConcurrency(ArrayList<Double> sessionStartTimes, ArrayList<Double> sessionEndTimes) {
int maxConcurrentSessions = 0;
VideoConcurrentSession concurrentSession = null;
if (sessionStartTimes.size() > 0) {
int startTimeCounter = 0;
int endTimeCounter = 0;
int currentOverlap = 0;
Collections.sort(sessionStartTimes);
Collections.sort(sessionEndTimes);
int startTimePointer = sessionStartTimes.size();
int endTimePointer = sessionEndTimes.size();
while (startTimeCounter < startTimePointer && endTimeCounter < endTimePointer) {
if (sessionStartTimes.get(startTimeCounter) < sessionEndTimes.get(endTimeCounter)) {
Double duration = sessionEndTimes.get(endTimeCounter) - sessionStartTimes.get(startTimeCounter);
currentOverlap++;
startTimeCounter++;
if (maxConcurrentSessions <= currentOverlap && currentOverlap > 1) {
if (concurrentSession != null) {
if (concurrentSession.getConcurrentSessionCount() == currentOverlap) {
duration = duration + concurrentSession.getConcurrencyDuration();
}
concurrentSession.setCountDuration(currentOverlap, duration);
} else {
concurrentSession = new VideoConcurrentSession(currentOverlap, duration);
}
}
if (maxConcurrentSessions < currentOverlap) {
maxConcurrentSessions = currentOverlap;
}
} else {
currentOverlap--;
endTimeCounter++;
}
}
}
return concurrentSession;
}
use of com.att.aro.core.bestpractice.pojo.VideoConcurrentSession 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;
}
Aggregations