Search in sources :

Example 31 with VideoStream

use of com.att.aro.core.videoanalysis.pojo.VideoStream 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);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) BasicStroke(java.awt.BasicStroke) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) ArrayList(java.util.ArrayList) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) VideoEventComparator(com.att.aro.core.videoanalysis.impl.VideoEventComparator) BufferedImage(java.awt.image.BufferedImage) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) VideoStall(com.att.aro.core.packetanalysis.pojo.VideoStall)

Example 32 with VideoStream

use of com.att.aro.core.videoanalysis.pojo.VideoStream in project VideoOptimzer by attdevsupport.

the class BufferOccupancyPlot method populate.

/*
	 * called by:
	 *  -> VideoChunksPlot.refreshPlot(XYPlot, AROTraceData, double, VideoEvent)
	 */
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis != null) {
        streamingVideoData = analysis.getAnalyzerResult().getStreamingVideoData();
        double maxBuffer = 0;
        bufferFillDataCollection.removeAllSeries();
        for (VideoStream videoStream : streamingVideoData.getVideoStreams()) {
            if (videoStream.isSelected()) {
                this.videoStream = videoStream;
                LOG.debug("VideoStream :" + videoStream.getManifest().getVideoName());
                seriesByteBuffer = new XYSeries("Byte Buffer");
                ArrayList<XYPair> byteBufferList = videoStream.getByteBufferList();
                double yPlotValue = 0.00;
                for (XYPair xy : byteBufferList) {
                    yPlotValue = xy.getYVal();
                    if (maxBuffer < yPlotValue) {
                        maxBuffer = yPlotValue;
                    }
                    bufferSizeList.add(yPlotValue);
                    seriesByteBuffer.add(xy.getXVal(), yPlotValue);
                }
                Collections.sort(bufferSizeList);
                bufferFillDataCollection.addSeries(seriesByteBuffer);
                LOG.debug(videoStream.getByteToolTipDetailMap());
            }
        }
        XYItemRenderer renderer = new StandardXYItemRenderer();
        renderer.setBaseToolTipGenerator(toolTipGenerator());
        renderer.setSeriesStroke(0, new BasicStroke(2.0f));
        renderer.setSeriesPaint(0, Color.blue);
        renderer.setSeriesShape(0, shape);
        plot.setRenderer(renderer);
        BufferOccupancyBPResult bufferOccupancyResult = bufferOccupancyCalculatorImpl.setMaxBuffer(maxBuffer);
        bufferOccupancyResult.setBufferByteDataSet(bufferSizeList);
        analysis.getAnalyzerResult().setBufferOccupancyResult(bufferOccupancyResult);
    }
    plot.setDataset(bufferFillDataCollection);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) BasicStroke(java.awt.BasicStroke) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) StandardXYItemRenderer(org.jfree.chart.renderer.xy.StandardXYItemRenderer) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) StandardXYItemRenderer(org.jfree.chart.renderer.xy.StandardXYItemRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYPair(com.att.aro.core.videoanalysis.XYPair)

Example 33 with VideoStream

use of com.att.aro.core.videoanalysis.pojo.VideoStream in project VideoOptimzer by attdevsupport.

the class VideoStreamConstructor method matchSegment.

/**
 * <pre>
 * Matches segment request to find ManifestCollection, ChilldManifest and SegmentInfo.
 * If anything fails then failed match is saved into "_Unhandled_segments" folder.
 *
 * @param streamingVideoData
 * @param request
 * @param timeStamp
 * @param content
 * @return
 */
private ChildManifest matchSegment(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request, Double timeStamp, byte[] content) {
    if ((manifestCollection = matchManifest(request, content)) != null && (childManifest = locateChildManifestAndSegmentInfo(request, content, timeStamp, manifestCollection)) != null && segmentInfo != null) {
        if ((videoStream = streamingVideoData.getVideoStream(manifestCollection.getManifest().getRequestTime())) == null) {
            videoStream = new VideoStream();
            videoStream.setManifest(manifestCollection.getManifest());
            streamingVideoData.addVideoStream(manifestCollection.getManifest().getRequestTime(), videoStream);
        }
    } else {
        LOG.debug("failed to match request to a segment :" + request.getObjUri());
        extractedSaveUnhandledContent(streamingVideoData, request, content);
        return null;
    }
    return childManifest;
}
Also used : VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream)

Aggregations

VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)33 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)19 ArrayList (java.util.ArrayList)13 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)6 StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)6 XYPair (com.att.aro.core.videoanalysis.XYPair)5 List (java.util.List)5 TreeMap (java.util.TreeMap)5 AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)3 Session (com.att.aro.core.packetanalysis.pojo.Session)3 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 VideoStall (com.att.aro.core.packetanalysis.pojo.VideoStall)3 DUPLICATE_HANDLING (com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING)3 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3 StringUtils (org.apache.commons.lang.StringUtils)3 LogManager (org.apache.log4j.LogManager)3 Logger (org.apache.log4j.Logger)3 XYSeries (org.jfree.data.xy.XYSeries)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3