Search in sources :

Example 11 with VideoEvent

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

the class VideoProgressPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        LOGGER.info("no trace data here");
    } else {
        XYItemRenderer videoRenderer = plot.getRenderer();
        videoRenderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                if (dataset.getSeriesCount() > 1) {
                    if (series == 0 && item < videoEventList.size()) {
                        VideoEvent videoEvent = videoEventList.get(item);
                        return getToolTip(videoEvent);
                    } else if (series == 1 && item < audioEventList.size()) {
                        VideoEvent audioEvent = audioEventList.get(item);
                        return getToolTip(audioEvent);
                    } else if (series == 1 && isMuxed && item < videoEventList.size() || (series == 2 && item < videoEventList.size())) {
                        VideoEvent event = videoEventList.get(item);
                        return getPlaytimeProgressToolTip(event);
                    } else if (series == 2 && isMuxed && item < audioEventList.size() || (series == 3 && item < audioEventList.size())) {
                        VideoEvent event = audioEventList.get(item);
                        return getPlaytimeProgressToolTip(event);
                    } else {
                        return "";
                    }
                } else {
                    if (item < eventList.size()) {
                        return getToolTip(eventList.get(item));
                    } else {
                        return "";
                    }
                }
            }

            private String getToolTip(VideoEvent event) {
                StringBuffer tooltipValue = new StringBuffer();
                tooltipValue.append(String.format("%.0f,%s, %.2f,%.2f,%.3f,%.3f", (double) event.getSegmentID(), event.getQuality(), event.getDLTimeStamp(), event.getDLLastTimestamp(), event.getDuration(), downloadProgressMap.get(event)));
                String[] value = tooltipValue.toString().split(",");
                return (MessageFormat.format(ResourceBundleHelper.getDefaultBundle().getString("videotab.progress.tooltip"), value[0], value[1], value[2], value[3], value[4], value[5]));
            }

            private String getPlaytimeProgressToolTip(VideoEvent event) {
                StringBuffer tooltipValue = new StringBuffer();
                tooltipValue.append(String.format("%.0f,%s, %.2f,%.2f,%.3f,%.3f, %s,", (double) event.getSegmentID(), event.getQuality(), event.getPlayTime(), event.getPlayTimeEnd(), event.getDuration(), downloadProgressMap.get(event), event.getContentType()));
                String[] value = tooltipValue.toString().split(",");
                return (MessageFormat.format(ResourceBundleHelper.getDefaultBundle().getString("videotab.playTimeProgress.tooltip"), value[0], value[1], value[2], value[3], value[4], value[5], value[6]));
            }
        });
    }
    XYSeriesCollection collection = new XYSeriesCollection();
    addSeries(collection, videoDownloadSeries, audioDownloadSeries, downloadMockSeries, "Download_Progress");
    addSeries(collection, videoPlaytimeSeries, audioPlaytimeSeries, progressMockSeries, "PlayTime_Progress");
    plot.setDataset(collection);
}
Also used : XYDataset(org.jfree.data.xy.XYDataset) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Example 12 with VideoEvent

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

the class VideoAdaptiveBitrateLadderImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    result = new VideoAdaptiveBitrateLadderResult();
    init(result);
    qualityMap.clear();
    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) {
            QualityTime qualityTime;
            double maxTime = 0;
            QualityTime maxSection = null;
            double videoRatio = 1;
            double durationTotal = 0;
            Set<String> resolutions = new TreeSet<>();
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap())) {
                    videoRatio = PERCENTILE_LINE / videoStream.getDuration();
                    for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                        if (videoEvent.isNormalSegment() && videoEvent.isSelected()) {
                            resolutions.add(String.valueOf(videoEvent.getResolutionHeight()));
                            double duration = videoEvent.getDuration();
                            durationTotal += duration;
                            Integer track = StringParse.stringToDouble(videoEvent.getQuality(), 0).intValue();
                            if ((qualityTime = qualityMap.get(track)) != null) {
                                int count = qualityTime.getCount();
                                qualityTime.setDuration(qualityTime.getDuration() + duration);
                                qualityTime.setPercentage(qualityTime.getDuration() * videoRatio);
                                qualityTime.setBitrateAverage((qualityTime.getBitrateAverage() * count + videoEvent.getBitrate()) / ++count);
                                qualityTime.setCount(count);
                            } else {
                                qualityTime = new QualityTime(videoEvent.getManifest().getVideoName(), 1, track, duration, duration * videoRatio, videoEvent.getResolutionHeight(), videoEvent.getSegmentStartTime(), // bitrateDeclared (kbps)
                                videoEvent.getChildManifest().getBandwidth() / 1000, // bitrateAverage (kbps)
                                videoEvent.getBitrate());
                                qualityMap.put(track, qualityTime);
                            }
                            if (maxTime < qualityTime.getDuration()) {
                                maxTime = qualityTime.getDuration();
                                maxSection = qualityTime;
                            }
                        }
                    }
                }
            }
            bpResultType = BPResultType.SELF_TEST;
            int count = qualityMap.size();
            double maxDuration = 0;
            double percentage = 0;
            int track = 0;
            if (maxSection != null) {
                maxDuration = maxSection.getDuration();
                percentage = maxSection.getPercentage();
                track = maxSection.getTrack();
            }
            result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "s", track, String.format("%.2f", maxDuration), String.format("%.2f", percentage), String.format("%.3f", durationTotal)));
            result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.join("p, ", resolutions) + "p"));
        } else {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(novalidManifestsFound);
            result.setResultExcelText(bpResultType.getDescription());
        }
        result.setResults(qualityMap);
    } else {
        // No Data
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    result.setResults(qualityMap);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) TreeSet(java.util.TreeSet) QualityTime(com.att.aro.core.videoanalysis.pojo.QualityTime) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoAdaptiveBitrateLadderResult(com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 13 with VideoEvent

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

the class VideoRedundancyImpl method countDuplicateChunks.

public void countDuplicateChunks(VideoStream videoStream) {
    VideoEvent preStuff = null;
    Double prevSegment = null;
    String prevQuality = "";
    for (VideoEvent videoEvent : videoStream.getVideoEventsBySegment()) {
        if (!videoEvent.isNormalSegment()) {
            continue;
        }
        double segment = videoEvent.getSegmentID();
        String quality = videoEvent.getQuality();
        countSegment++;
        if (prevSegment != null && prevSegment == segment) {
            countSegment--;
            if (prevQuality.equals(quality)) {
                LOG.debug("Duplicate :\t" + preStuff + "\n\t\t" + videoEvent);
                countDuplicate++;
            } else {
                LOG.debug("Redundant :\t" + preStuff + "\n\t\t" + videoEvent);
                countRedundant++;
            }
        }
        preStuff = videoEvent;
        prevSegment = segment;
        prevQuality = quality;
    }
}
Also used : VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 14 with VideoEvent

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

the class VideoTcpConnectionImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    VideoTcpConnectionResult result = new VideoTcpConnectionResult();
    int sessionCount = 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(invalidStreamsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noStreamsSelectedMixed);
            } else {
                result.setResultText(noStreamsSelected);
            }
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultExcelText(bpResultType.getDescription());
            result.setSelfTest(false);
        } else if (selectedCount > 1) {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(multipleStreamsSelected);
            result.setResultExcelText(bpResultType.getDescription());
            result.setSelfTest(false);
        } else {
            ArrayList<Session> uniqVideoSessions = new ArrayList<>();
            ArrayList<Session> uniqAudioSessions = new ArrayList<>();
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isSelected() && !videoStream.getVideoEventMap().isEmpty()) {
                    for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                        if (!uniqVideoSessions.contains(videoEvent.getSession())) {
                            uniqVideoSessions.add(videoEvent.getSession());
                        }
                    }
                    for (VideoEvent videoEvent : videoStream.getAudioSegmentEventList().values()) {
                        if (!uniqAudioSessions.contains(videoEvent.getSession())) {
                            uniqAudioSessions.add(videoEvent.getSession());
                        }
                    }
                }
            }
            sessionCount = uniqVideoSessions.size() > uniqAudioSessions.size() ? uniqVideoSessions.size() : uniqAudioSessions.size();
            bpResultType = BPResultType.SELF_TEST;
            result.setResultText(MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), sessionCount, sessionCount == 1 ? "" : "s"));
            result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), sessionCount));
            result.setTcpConnections(sessionCount);
            result.setSelfTest(true);
        }
    } else {
        result.setSelfTest(false);
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) ArrayList(java.util.ArrayList) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) VideoTcpConnectionResult(com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult)

Example 15 with VideoEvent

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

the class VideoStreamConstructor method processFailures.

public void processFailures() {
    double sumDelivered = 0;
    double sumExpected = 0;
    for (HttpRequestResponseInfo request : failedSegmentRequests.values()) {
        // Guarantee a request, not a response
        request = (request.getDirection() == HttpDirection.RESPONSE) ? request.getAssocReqResp() : request;
        HttpRequestResponseInfo response = request.getAssocReqResp();
        sumDelivered += response.getContentLengthDuringFail();
        sumExpected += response.getContentLength();
        if ((childManifest = matchSegment(streamingVideoData, request, request.getTimeStamp(), null)) != null) {
            VideoEvent videoEvent = new VideoEvent(null, manifestCollection.getManifest(), segmentInfo, childManifest, (int) response.getContentLengthDuringFail(), response, 0L);
            videoEvent.setFailedRequest(true);
            videoStream.addVideoEvent(videoEvent);
            LOG.debug("Failed segment added to videStream: " + videoEvent);
        } else {
            // logging a failed segment that could not be matched with a VideoStream
            LOG.warn(String.format("Unmatched - failed segment: %s delivered %.0f of %.0f", request.getObjNameWithoutParams(), sumDelivered, sumExpected));
        }
    }
    LOG.info(String.format("Of the %d failed video downloads, total percentage received was: %.2f", failedSegmentRequests.size(), (sumDelivered / sumExpected) * 100) + "%");
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

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