Search in sources :

Example 1 with VideoAdaptiveBitrateLadderResult

use of com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult 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 2 with VideoAdaptiveBitrateLadderResult

use of com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult in project VideoOptimzer by attdevsupport.

the class VideoBestPractices method analyze.

public AROTraceData analyze(AROTraceData traceDataresult) {
    PacketAnalyzerResult result = null;
    if (null == traceDataresult) {
        return null;
    }
    result = traceDataresult.getAnalyzerResult();
    if (result == null) {
        return null;
    }
    VideoStallResult videoStallResult = null;
    VideoStartUpDelayResult videoStartUpDelayResult = null;
    BufferOccupancyResult bufferOccupancyResult = null;
    VideoNetworkComparisonResult videoNetworkComparisonResult = null;
    VideoTcpConnectionResult videoTcpConnectionResult = null;
    VideoChunkSizeResult videoChunkSizeResult = null;
    VideoChunkPacingResult videoChunkPacingResult = null;
    VideoRedundancyResult videoRedundancyResult = null;
    VideoConcurrentSessionResult videoConcurrentSessionResult = null;
    VideoVariableBitrateResult videoVariableBitrateResult = null;
    VideoAdaptiveBitrateLadderResult videoSegmentQualityResult = null;
    VideoResolutionQualityResult videoResolutionQualityResult = null;
    AudioStreamResult videoSeparateAudioResult = null;
    List<BestPracticeType> requests = BestPracticeType.getByCategory(Category.VIDEO);
    List<AbstractBestPracticeResult> bpResults = traceDataresult.getBestPracticeResults();
    List<AbstractBestPracticeResult> videoBestPracticeResults = aroService.analyze(result, requests);
    for (AbstractBestPracticeResult videoBPResult : videoBestPracticeResults) {
        BestPracticeType bpType = videoBPResult.getBestPracticeType();
        switch(bpType) {
            case VIDEO_STALL:
                videoStallResult = (VideoStallResult) videoBPResult;
                break;
            case STARTUP_DELAY:
                videoStartUpDelayResult = (VideoStartUpDelayResult) videoBPResult;
                break;
            case BUFFER_OCCUPANCY:
                bufferOccupancyResult = (BufferOccupancyResult) videoBPResult;
                break;
            case NETWORK_COMPARISON:
                videoNetworkComparisonResult = (VideoNetworkComparisonResult) videoBPResult;
                break;
            case TCP_CONNECTION:
                videoTcpConnectionResult = (VideoTcpConnectionResult) videoBPResult;
                break;
            case CHUNK_SIZE:
                videoChunkSizeResult = (VideoChunkSizeResult) videoBPResult;
                break;
            case CHUNK_PACING:
                videoChunkPacingResult = (VideoChunkPacingResult) videoBPResult;
                break;
            case VIDEO_REDUNDANCY:
                videoRedundancyResult = (VideoRedundancyResult) videoBPResult;
                break;
            case VIDEO_CONCURRENT_SESSION:
                videoConcurrentSessionResult = (VideoConcurrentSessionResult) videoBPResult;
                break;
            case VIDEO_VARIABLE_BITRATE:
                videoVariableBitrateResult = (VideoVariableBitrateResult) videoBPResult;
                break;
            case VIDEO_RESOLUTION_QUALITY:
                videoResolutionQualityResult = (VideoResolutionQualityResult) videoBPResult;
                break;
            case VIDEO_ABR_LADDER:
                videoSegmentQualityResult = (VideoAdaptiveBitrateLadderResult) videoBPResult;
                break;
            case AUDIO_STREAM:
                videoSeparateAudioResult = (AudioStreamResult) videoBPResult;
                break;
            default:
                break;
        }
    }
    sendGAVideoBPResult(videoBestPracticeResults);
    for (AbstractBestPracticeResult bestPractice : bpResults) {
        if (bestPractice instanceof VideoStallResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoStallResult);
        } else if (bestPractice instanceof VideoStartUpDelayResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoStartUpDelayResult);
        } else if (bestPractice instanceof BufferOccupancyResult) {
            bpResults.set(bpResults.indexOf(bestPractice), bufferOccupancyResult);
        } else if (bestPractice instanceof VideoNetworkComparisonResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoNetworkComparisonResult);
        } else if (bestPractice instanceof VideoTcpConnectionResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoTcpConnectionResult);
        } else if (bestPractice instanceof VideoChunkSizeResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoChunkSizeResult);
        } else if (bestPractice instanceof VideoChunkPacingResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoChunkPacingResult);
        } else if (bestPractice instanceof VideoChunkPacingResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoChunkPacingResult);
        } else if (bestPractice instanceof VideoRedundancyResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoRedundancyResult);
        } else if (bestPractice instanceof VideoConcurrentSessionResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoConcurrentSessionResult);
        } else if (bestPractice instanceof VideoVariableBitrateResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoVariableBitrateResult);
        } else if (bestPractice instanceof VideoResolutionQualityResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoResolutionQualityResult);
        } else if (bestPractice instanceof VideoAdaptiveBitrateLadderResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoSegmentQualityResult);
        } else if (bestPractice instanceof AudioStreamResult) {
            bpResults.set(bpResults.indexOf(bestPractice), videoSeparateAudioResult);
        }
    }
    traceDataresult.setBestPracticeResults(bpResults);
    return traceDataresult;
}
Also used : VideoRedundancyResult(com.att.aro.core.bestpractice.pojo.VideoRedundancyResult) VideoResolutionQualityResult(com.att.aro.core.bestpractice.pojo.VideoResolutionQualityResult) VideoNetworkComparisonResult(com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) VideoStallResult(com.att.aro.core.bestpractice.pojo.VideoStallResult) VideoConcurrentSessionResult(com.att.aro.core.bestpractice.pojo.VideoConcurrentSessionResult) VideoAdaptiveBitrateLadderResult(com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult) VideoTcpConnectionResult(com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult) VideoVariableBitrateResult(com.att.aro.core.bestpractice.pojo.VideoVariableBitrateResult) AudioStreamResult(com.att.aro.core.bestpractice.pojo.AudioStreamResult) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) VideoChunkPacingResult(com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult) VideoStartUpDelayResult(com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult) VideoChunkSizeResult(com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)

Aggregations

VideoAdaptiveBitrateLadderResult (com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult)2 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 AudioStreamResult (com.att.aro.core.bestpractice.pojo.AudioStreamResult)1 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)1 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)1 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)1 VideoChunkPacingResult (com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult)1 VideoChunkSizeResult (com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)1 VideoConcurrentSessionResult (com.att.aro.core.bestpractice.pojo.VideoConcurrentSessionResult)1 VideoNetworkComparisonResult (com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult)1 VideoRedundancyResult (com.att.aro.core.bestpractice.pojo.VideoRedundancyResult)1 VideoResolutionQualityResult (com.att.aro.core.bestpractice.pojo.VideoResolutionQualityResult)1 VideoStallResult (com.att.aro.core.bestpractice.pojo.VideoStallResult)1 VideoStartUpDelayResult (com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult)1 VideoTcpConnectionResult (com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult)1 VideoVariableBitrateResult (com.att.aro.core.bestpractice.pojo.VideoVariableBitrateResult)1 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)1 QualityTime (com.att.aro.core.videoanalysis.pojo.QualityTime)1 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)1 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)1