use of com.att.aro.core.videoanalysis.impl.VideoEventComparator in project VideoOptimzer by attdevsupport.
the class PlotHelperAbstract method videoEventListBySegment.
public List<VideoEvent> videoEventListBySegment(StreamingVideoData streamingVideoData) {
this.streamingVideoData = streamingVideoData;
// new ArrayList<>();
List<VideoEvent> chunksBySegmentID = streamingVideoData.getStreamingVideoCompiled().getChunksBySegmentID();
chunksBySegmentID.clear();
for (VideoStream videoStream : streamingVideoData.getVideoStreamMap().values()) {
if (videoStream.isSelected() && !videoStream.getVideoEventsBySegment().isEmpty()) {
for (VideoEvent videoEvent : videoStream.getVideoEventsBySegment()) {
if (videoEvent.isNormalSegment()) {
chunksBySegmentID.add(videoEvent);
}
}
}
}
for (VideoEvent ve : streamingVideoData.getStreamingVideoCompiled().getDeleteChunkList()) {
chunksBySegmentID.remove(ve);
}
Collections.sort(chunksBySegmentID, new VideoEventComparator(SortSelection.SEGMENT_ID));
return chunksBySegmentID;
}
use of com.att.aro.core.videoanalysis.impl.VideoEventComparator in project VideoOptimzer by attdevsupport.
the class StreamingVideoData method scanSegmentGaps.
private int scanSegmentGaps(TreeMap<String, VideoEvent> eventMap) {
VideoEvent lastEvent = null;
double threshold = .01;
int count = 0;
ArrayList<VideoEvent> sorted = new ArrayList<>(eventMap.values());
Collections.sort(sorted, new VideoEventComparator(SortSelection.SEGMENT_ID));
Collections.sort(sorted, new VideoEventComparator(SortSelection.PLAY_TIME));
for (VideoEvent event : sorted) {
// eventMap.values()
if (!event.isNormalSegment() || event.getPlayTime() == 0) {
continue;
}
if (lastEvent != null && event.getSegmentID() != lastEvent.getSegmentID()) {
double dif = event.getPlayTime() - lastEvent.getPlayTimeEnd();
if (dif > threshold) {
// found gap, could be one or many segments missing
LOG.debug(String.format("GAP after %s, segment:%.0f", lastEvent.getContentType().toString(), lastEvent.getSegmentID()));
count++;
}
}
lastEvent = event;
}
return count;
}
use of com.att.aro.core.videoanalysis.impl.VideoEventComparator in project VideoOptimzer by attdevsupport.
the class VideoChunksPlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData traceData) {
if (traceData != null) {
StreamingVideoData streamingVideoData = traceData.getAnalyzerResult().getStreamingVideoData();
if (!isReDraw) {
bufferOccupancyPlot.clearPlot(this.bufferOccupancyXYPlot);
bufferInSecondsPlot.clearPlot(this.bufferTimeXYPlot);
traceData.getAnalyzerResult().setBufferTimeResult(null);
traceData.getAnalyzerResult().setBufferOccupancyResult(null);
}
videoChunksData.removeAllSeries();
for (XYSeriesCollection seriesColl : startUpDelayCollection) {
seriesColl.removeAllSeries();
}
startUpDelayCollection.clear();
imgSeries = new ArrayList<BufferedImage>();
// create the dataset...
int index = 0;
series = new XYSeries("Chunks");
seriesDataSets = new TreeMap<>();
seriesDataSets = videoChunkPlotter.populateDataSet(traceData.getAnalyzerResult().getStreamingVideoData());
imgSeries = videoChunkPlotter.getImgSeries();
filteredChunks = streamingVideoData.getStreamingVideoCompiled().getFilteredSegments();
segmentsToBePlayed.clear();
for (VideoEvent ve : streamingVideoData.getStreamingVideoCompiled().getAllSegments()) {
segmentsToBePlayed.add(ve);
}
for (double timeStamp : seriesDataSets.values()) {
series.add(timeStamp, 0);
}
XYSeriesCollection playTimeStartSeries = new XYSeriesCollection();
int first = 0;
List<VideoEvent> chunkPlayBackTimeList = new ArrayList<VideoEvent>(chunkPlayTime.keySet());
Collections.sort(chunkPlayBackTimeList, new VideoEventComparator(SortSelection.SEGMENT_ID));
if (CollectionUtils.isNotEmpty(chunkPlayBackTimeList)) {
VideoEvent ve = chunkPlayBackTimeList.get(0);
seriesStartUpDelay = new XYSeries("StartUpDelay" + (index++));
seriesStartUpDelay.add(ve.getDLTimeStamp(), 0);
Double playTime = chunkPlayTime.get(ve);
if (playTime != null) {
seriesStartUpDelay.add((double) playTime, 0);
}
if (first == 0) {
StreamingVideoData videoData = traceData.getAnalyzerResult().getStreamingVideoData();
SortedMap<Double, VideoStream> videoEventList = videoData.getVideoStreamMap();
Double segPlayTime = chunkPlayTime.get(ve);
if (segPlayTime != null) {
setDelayVideoStream((double) segPlayTime - ve.getEndTS(), videoEventList.values());
}
}
playTimeStartSeries.addSeries(seriesStartUpDelay);
startUpDelayCollection.add(playTimeStartSeries);
first++;
}
for (VideoStream videoStream : streamingVideoData.getVideoStreams()) {
if (videoStream.isSelected()) {
for (VideoStall videoStall : videoStream.getVideoStallList()) {
playTimeStartSeries = new XYSeriesCollection();
seriesStartUpDelay = new XYSeries("StartUpDelay" + (index++));
seriesStartUpDelay.add(videoStall.getStallStartTimestamp(), 0);
seriesStartUpDelay.add(videoStall.getStallEndTimestamp(), 0);
playTimeStartSeries.addSeries(seriesStartUpDelay);
startUpDelayCollection.add(playTimeStartSeries);
}
}
}
videoChunksData.addSeries(series);
// Startup and stalls
VideoChunkImageRenderer renderer = new VideoChunkImageRenderer();
XYLineAndShapeRenderer rendererDelay = new XYLineAndShapeRenderer();
for (int idx = 0; idx < startUpDelayCollection.size(); idx++) {
rendererDelay.setSeriesStroke(idx, new BasicStroke(2.0f));
rendererDelay.setSeriesPaint(idx, Color.RED);
}
renderer.setBaseToolTipGenerator(toolTipGenerator());
renderer.setSeriesShape(0, shape);
plot.setRenderer(index, renderer);
for (int i = 0; i < startUpDelayCollection.size(); i++) {
plot.setRenderer(i, rendererDelay);
}
}
isReDraw = false;
int seriesIndex = 0;
for (XYSeriesCollection seriesColl : startUpDelayCollection) {
plot.setDataset(seriesIndex, seriesColl);
seriesIndex++;
}
plot.setDataset(seriesIndex, videoChunksData);
}
Aggregations