Search in sources :

Example 26 with VideoEvent

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

the class VideoNetworkComparisonImpl method getAvgBitRate.

private double getAvgBitRate(double summaryBitRate, List<VideoEvent> filteredVideoSegment) {
    double avgBitRate;
    for (VideoEvent videoEvent : filteredVideoSegment) {
        // logger.debug(" BitRate: "+videoEvent.getBitrate());
        summaryBitRate += videoEvent.getBitrate();
    }
    // kbps
    avgBitRate = summaryBitRate / (1024 * filteredVideoSegment.size());
    LOGGER.debug("avgBitRate: " + avgBitRate);
    return avgBitRate;
}
Also used : VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 27 with VideoEvent

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

the class VideoNetworkComparisonImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    double avgKbps = 0.0;
    double avgBitRate = 0.0;
    double summaryBitRate = 0.0;
    VideoNetworkComparisonResult result = new VideoNetworkComparisonResult();
    init(result);
    SortedMap<Integer, SegmentComparison> qualityMap = new TreeMap<>();
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        selectedCount = streamingVideoData.getSelectedManifestCount();
        invalidCount = streamingVideoData.getInvalidManifestCount();
        List<VideoEvent> filteredVideoSegment = filterVideoSegment(streamingVideoData);
        if (selectedCount == 0) {
            if (invalidCount == videoStreamCollection.size()) {
                result.setResultText(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                result.setResultText(noManifestsSelected);
            }
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
            result.setSelfTest(false);
        } else if (selectedCount > 1) {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(multipleManifestsSelected);
            result.setResultExcelText(BPResultType.CONFIG_REQUIRED.getDescription());
            result.setSelfTest(false);
        } else {
            SegmentComparison segmentComparison;
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap())) {
                    for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                        if (videoEvent.isNormalSegment() && videoEvent.isSelected()) {
                            Integer track = StringParse.stringToDouble(videoEvent.getQuality(), 0).intValue();
                            double endTS = videoEvent.getEndTS();
                            double startTS = videoEvent.getStartTS();
                            double durationInMilliseconds = endTS - startTS;
                            double throughput = 0.0;
                            if (durationInMilliseconds > 0) {
                                throughput = (videoEvent.getTotalBytes() * 8) / durationInMilliseconds;
                            }
                            if ((segmentComparison = qualityMap.get(track)) != null) {
                                int count = segmentComparison.getCount();
                                segmentComparison.setCount(++count);
                                segmentComparison.getCalculatedThroughputList().add(throughput);
                            } else {
                                List<Double> throughputs = new ArrayList<Double>();
                                throughputs.add(throughput);
                                segmentComparison = new SegmentComparison(videoEvent.getManifest().getVideoName(), // declaredBitrate (kbps)
                                1, // declaredBitrate (kbps)
                                track, // declaredBitrate (kbps)
                                videoEvent.getChildManifest().getBandwidth() / 1000.0, throughputs);
                                qualityMap.put(track, segmentComparison);
                            }
                        }
                    }
                }
            }
            result.setResults(qualityMap);
            avgBitRate = getAvgBitRate(summaryBitRate, filteredVideoSegment);
            avgKbps = getAvgThroughput(tracedata);
            result.setAvgBitRate(avgBitRate);
            result.setAvgKbps(avgKbps);
            result.setSelfTest(true);
            bpResultType = BPResultType.SELF_TEST;
            result.setResultText(MessageFormat.format(textResults, avgKbps, avgBitRate));
            result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.SELF_TEST.getDescription(), avgKbps, avgBitRate));
        }
    } else {
        result.setResultText(noData);
        result.setResultExcelText(BPResultType.NO_DATA.getDescription());
        bpResultType = BPResultType.NO_DATA;
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) SegmentComparison(com.att.aro.core.videoanalysis.pojo.SegmentComparison) VideoNetworkComparisonResult(com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) TreeMap(java.util.TreeMap) ArrayList(java.util.ArrayList) List(java.util.List)

Example 28 with VideoEvent

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

the class VideoResolutionQualityImpl method scanManifestsForHeight.

/**
 * Sets values on maxHeightUsed and overSizeCount
 * @param videoStreamCollection
 */
private void scanManifestsForHeight(SortedMap<Double, VideoStream> videoStreamCollection) {
    maxHeightUsed = 0;
    overSizeCount = 0;
    for (VideoStream videoStream : videoStreamCollection.values()) {
        if (videoStream.isSelected()) {
            for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                double height = videoEvent.getResolutionHeight();
                if (height > maxHeightUsed) {
                    maxHeightUsed = height;
                }
                if (height > MAX_HEIGHT) {
                    overSizeCount++;
                }
            }
            break;
        }
    }
}
Also used : VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 29 with VideoEvent

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

the class VideoSegmentSizeImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    VideoChunkSizeResult result = new VideoChunkSizeResult();
    double totalSize = 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(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                result.setResultText(noManifestsSelected);
            }
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultExcelText(bpResultType.getDescription());
        } else if (selectedCount > 1) {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(multipleManifestsSelected);
            result.setResultExcelText(bpResultType.getDescription());
            result.setSelfTest(false);
        } else {
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream != null && videoStream.isSelected() && !videoStream.getVideoEventsBySegment().isEmpty()) {
                    for (VideoEvent videoEvent : videoStream.getVideoEventsBySegment()) {
                        if (!videoEvent.isNormalSegment()) {
                            continue;
                        }
                        count++;
                        totalSize += videoEvent.getSize();
                    }
                    break;
                }
            }
            if (count != 0) {
                averageSize = totalSize / count;
            }
            bpResultType = BPResultType.SELF_TEST;
            result.setSelfTest(true);
            result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "different", count == 1 ? "" : "s", (int) averageSize / 1024));
            result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), count, (int) averageSize / 1024));
            // Size in KB
            result.setSegmentSize((int) averageSize / 1024);
            result.setSegmentCount((int) count);
        }
    } else {
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
        result.setSelfTest(false);
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) VideoChunkSizeResult(com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)

Example 30 with VideoEvent

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

the class VideoVariableBitrateImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    bpResultType = BPResultType.SELF_TEST;
    result = new VideoVariableBitrateResult();
    init(result);
    if (tracedata == null) {
        return result;
    }
    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) {
            bpResultType = BPResultType.NONE;
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isValid() && videoStream.isSelected()) {
                    if (videoStream.getManifest().isVideoMetaDataExtracted()) {
                        Collection<VideoEvent> videoEventList = videoStream.getVideoEventsBySegment();
                        double[] uniqueBitRates = videoEventList.stream().mapToDouble(ve -> ve.getBitrate()).distinct().toArray();
                        if (uniqueBitRates.length == 1 && videoEventList.size() != 1) {
                            vbrUsed = false;
                            break;
                        }
                    } else {
                        result.setResultText(drmBlocking);
                        result.setResultType(BPResultType.SELF_TEST);
                        result.setResultExcelText(MessageFormat.format(textExcelDRMBlocking, BPResultType.SELF_TEST.getDescription()));
                        return result;
                    }
                }
            }
            if (vbrUsed) {
                result.setResultText(textResultPass);
                bpResultType = BPResultType.PASS;
            } else {
                result.setResultText(textResults);
                bpResultType = BPResultType.WARNING;
            }
            result.setResultExcelText(bpResultType.getDescription());
        }
    } else {
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : VideoVariableBitrateResult(com.att.aro.core.bestpractice.pojo.VideoVariableBitrateResult) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) 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