Search in sources :

Example 1 with VideoEvent

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

the class BufferOccupancyCalculatorImpl method drawVeDone.

@Override
public double drawVeDone(List<VideoEvent> veDone, double beginByte) {
    double buffer = beginByte;
    if (veDone.size() == 0) {
        // drain buffer
        seriesDataSets.put(key, chunkPlayStartTime + "," + buffer);
        key++;
        buffer = bufferDrain(buffer);
    } else {
        Collections.sort(veDone, new VideoEventComparator(SortSelection.END_TS));
        boolean drained = false;
        for (VideoEvent chunk : veDone) {
            seriesDataSets.put(key, chunk.getEndTS() + "," + buffer);
            key++;
            if (MathUtils.equals(chunk.getEndTS(), chunkPlayStartTime)) {
                // drain
                buffer = buffer + (chunk.getTotalBytes());
                completedDownloads.add(chunk);
                chunkDownload.remove(chunk);
                buffer = bufferDrain(buffer);
                drained = true;
            /*if (buffer < 0) {
						// stall
						return -1;
					}*/
            } else {
                buffer = buffer + (chunk.getTotalBytes());
                seriesDataSets.put(key, chunk.getEndTS() + "," + buffer);
                key++;
                completedDownloads.add(chunk);
                chunkDownload.remove(chunk);
            }
        }
        if (drained == false) {
            buffer = bufferDrain(buffer);
        }
    }
    return buffer;
}
Also used : VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 2 with VideoEvent

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

the class VideoChunkPlotterImpl method updateChunkPlayStartTimes.

public void updateChunkPlayStartTimes() {
    this.chunkPlayStartTimesList.clear();
    this.segmentStartTimeMap.clear();
    boolean filterAgain = false;
    List<VideoEvent> chunksBySegmentID = streamingVideoData.getStreamingVideoCompiled().getChunksBySegmentID();
    Map<Double, VideoEvent> playStartTimeBySegment = new TreeMap<>();
    for (int index = 0; index < chunksBySegmentID.size(); index++) {
        double playtime = (chunksBySegmentID.get(index)).getPlayTime();
        if (chunksBySegmentID.get(index).getEndTS() > playtime) {
            boolean shuffled = alterFilteredSegmentList(chunksBySegmentID.get(index), playtime);
            if (shuffled) {
                filterAgain = true;
            }
        }
        playStartTimeBySegment.put(playtime, chunksBySegmentID.get(index));
    }
    streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().forEach(x -> {
        chunkPlayStartTimesList.add((Double) x.getPlayTime());
        segmentStartTimeMap.put(((Double) (x.getSegmentID())).longValue(), (Double) x.getPlayTime());
    });
    // VID-TODO looks inefficient, lots of re-iterating through chunksBySegmentID
    if (filterAgain) {
        List<VideoEvent> filteredSegments = streamingVideoData.getStreamingVideoCompiled().getFilteredSegments();
        Collections.sort(filteredSegments, new VideoEventComparator(SortSelection.END_TS));
        for (VideoEvent ve : filteredSegments) {
            if (!chunksBySegmentID.contains(ve)) {
                for (VideoEvent segment : chunksBySegmentID) {
                    if (segment.getSegmentID() == ve.getSegmentID()) {
                        // segment should be replaced by ve
                        chunksBySegmentID.add(chunksBySegmentID.indexOf(segment), ve);
                        chunksBySegmentID.remove(segment);
                        break;
                    }
                }
            }
        }
    }
}
Also used : VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) TreeMap(java.util.TreeMap)

Example 3 with VideoEvent

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

the class VideoChunkPlotterImpl method getChunkCollectionDataSet.

private void getChunkCollectionDataSet() {
    int count = 0;
    List<VideoEvent> allSegments2 = streamingVideoData.getStreamingVideoCompiled().getAllSegments();
    if (allSegments2 == null) {
        return;
    }
    for (VideoEvent ve : allSegments2) {
        BufferedImage img = ve.getThumbnail();
        if (count == 0) {
            // first chunk
            firstChunkTimestamp = ve.getDLTimeStamp();
            count++;
        }
        int checkCount = 0;
        while (img.getHeight() > 20 && checkCount++ < 3) {
            // background processing inserted a thumbnail, too soon for the image sizing to have completed, a very rare occurance
            // wait 500 ms, sufficient time for processing to complete
            // this prevents a "thumbnail" of 2k pixels wide filling up the display
            Util.sleep(500);
            img = ve.getThumbnail();
        }
        imgSeries.add(img);
        seriesDataSets.put(key, ve.getDLTimeStamp());
        key++;
    }
}
Also used : VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) BufferedImage(java.awt.image.BufferedImage)

Example 4 with VideoEvent

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

the class VideoChunkPlotterImpl method alterFilteredSegmentList.

public boolean alterFilteredSegmentList(VideoEvent ve, double segmentPlayTime) {
    List<VideoEvent> deleteChunks = streamingVideoData.getStreamingVideoCompiled().getDeleteChunkList();
    if (!deleteChunks.isEmpty()) {
        // descending order sorting by download end time.
        Collections.sort(deleteChunks, new VideoEventComparator(SortSelection.END_TS_DESCENDING));
        boolean swapedTheMinimum = false;
        int minIndex = -1;
        for (VideoEvent removeChunk : deleteChunks) {
            if (removeChunk.getSegmentID() == ve.getSegmentID() && removeChunk.getEndTS() <= segmentPlayTime) {
                // This is the correct quality level of this segment played
                // swap
                int index = streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().indexOf(ve);
                streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().remove(ve);
                streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().add(index, removeChunk);
                deleteChunks.add(ve);
                deleteChunks.remove(removeChunk);
                return true;
            } else if (ve.getEndTS() > removeChunk.getEndTS() && removeChunk.getSegmentID() == ve.getSegmentID()) {
                // swap the closest
                minIndex = deleteChunks.indexOf(removeChunk);
                swapedTheMinimum = true;
            }
        }
        if (swapedTheMinimum && minIndex != -1) {
            int index = streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().indexOf(ve);
            streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().remove(ve);
            streamingVideoData.getStreamingVideoCompiled().getFilteredSegments().add(index, deleteChunks.get(minIndex));
            deleteChunks.add(ve);
            deleteChunks.remove(deleteChunks.get(minIndex));
            return true;
        }
    }
    return false;
}
Also used : VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 5 with VideoEvent

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

the class VideoSegmentAnalyzer method locateStartupDelay.

/**
 * <pre>
 * Loads, and or creates estimated, startup data for a stream Populates
 * VideoStreamStartup from first segment and manifest data. Populates
 * VideoStream so that graphs can be displayed. Attaches to VideoStream to aid
 * SegmentTablePanel
 *
 * @param result
 * @param videoStream
 * @return existing or estimated VideoStreamStartup
 */
public VideoStreamStartup locateStartupDelay(AbstractTraceResult result, VideoStream videoStream) {
    if (result instanceof TraceDirectoryResult) {
        if ((videoStreamStartupData = ((TraceDirectoryResult) result).getVideoStartupData()) != null) {
            if ((videoStreamStartup = findStartupFromName(videoStreamStartupData, videoStream)) != null) {
                if (videoStreamStartup.getValidationStartup().equals(ValidationStartup.NA)) {
                    videoStreamStartup.setValidationStartup(ValidationStartup.USER);
                }
            }
        } else {
            videoStreamStartupData = new VideoStreamStartupData();
        }
        if (videoStreamStartup == null) {
            VideoEvent firstEvent = null;
            videoStreamStartup = new VideoStreamStartup(videoStream.getManifest().getVideoName());
            videoStreamStartup.setValidationStartup(ValidationStartup.ESTIMATED);
            videoStreamStartupData.getStreams().add(videoStreamStartup);
            if (!CollectionUtils.isEmpty(videoStream.getVideoActiveMap())) {
                firstEvent = videoStream.getFirstActiveSegment();
            } else {
                firstEvent = videoStream.getFirstSegment();
                if (firstEvent == null) {
                    // invalid stream, no first segment that is a normal segment
                    return null;
                }
                if (videoStream.getManifest().getRequestTime() == 0.0) {
                    // CSI there is no requestTime so make an estimate
                    videoStream.getManifest().setRequestTime(firstEvent.getRequest().getTimeStamp() - videoPrefs.getStallRecovery());
                }
            }
            if (firstEvent.getPlayRequestedTime() == 0) {
                firstEvent.setPlayRequestedTime(videoStream.getManifest().getRequestTime());
            }
            firstEvent.setStartupOffset(firstEvent.getDLLastTimestamp() + videoPrefs.getStallRecovery());
            videoStreamStartup.setFirstSegID(firstEvent.getSegmentID());
            videoStreamStartup.setManifestReqTime(firstEvent.getManifest().getRequestTime());
            videoStreamStartup.setStartupTime(firstEvent.getStartupOffset());
            if (videoStreamStartup.getUserEvent() == null) {
                UserEvent userEvent = new UserEvent();
                double pressTime = videoStream.getManifest().getRequestTime();
                userEvent.setPressTime(pressTime);
                userEvent.setReleaseTime(pressTime);
                userEvent.setEventType(UserEventType.EVENT_UNKNOWN);
                videoStreamStartup.setUserEvent(userEvent);
            }
        }
        videoStream.getManifest().setDelay(videoStreamStartup.getStartupTime() - videoStreamStartup.getManifestReqTime());
        videoStream.setVideoPlayBackTime(videoStreamStartup.getStartupTime());
        videoStream.setVideoStreamStartup(videoStreamStartup);
        ((TraceDirectoryResult) result).setVideoStartupData(videoStreamStartupData);
    }
    return videoStreamStartup;
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent)

Aggregations

VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)48 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)19 ArrayList (java.util.ArrayList)12 TreeMap (java.util.TreeMap)7 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)5 VideoStall (com.att.aro.core.packetanalysis.pojo.VideoStall)5 StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)5 HashMap (java.util.HashMap)4 List (java.util.List)4 XYDataset (org.jfree.data.xy.XYDataset)4 AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)3 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 UserEvent (com.att.aro.core.peripheral.pojo.UserEvent)3 VideoStreamStartup (com.att.aro.core.peripheral.pojo.VideoStreamStartup)3 VideoStreamStartupData (com.att.aro.core.peripheral.pojo.VideoStreamStartupData)3 DUPLICATE_HANDLING (com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING)3 Collections (java.util.Collections)3 StringUtils (org.apache.commons.lang.StringUtils)3 LogManager (org.apache.log4j.LogManager)3 Logger (org.apache.log4j.Logger)3