Search in sources :

Example 6 with BPResultType

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

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

the class UtilTest method test_checkPassFailorWarning.

@Test
public void test_checkPassFailorWarning() {
    BPResultType bpResultType = Util.checkPassFailorWarning(0.2, 0.1, 0.4);
    assertEquals(bpResultType, BPResultType.WARNING);
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) Test(org.junit.Test)

Example 8 with BPResultType

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

the class UtilTest method test_intCheckPassFailorWarning.

@Test
public void test_intCheckPassFailorWarning() {
    BPResultType bpResultType = Util.checkPassFailorWarning(2, 1, 4);
    assertEquals(bpResultType, BPResultType.WARNING);
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) Test(org.junit.Test)

Example 9 with BPResultType

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

use of com.att.aro.core.bestpractice.pojo.BPResultType 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)

Aggregations

BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)13 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)7 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3 TreeMap (java.util.TreeMap)2 Test (org.junit.Test)2 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)1 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)1 VideoAdaptiveBitrateLadderResult (com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult)1 VideoChunkPacingResult (com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult)1 VideoChunkSizeResult (com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)1 VideoNetworkComparisonResult (com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult)1 VideoStartUpDelayResult (com.att.aro.core.bestpractice.pojo.VideoStartUpDelayResult)1 VideoTcpConnectionResult (com.att.aro.core.bestpractice.pojo.VideoTcpConnectionResult)1 BufferOccupancyBPResult (com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult)1 BufferTimeBPResult (com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult)1 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)1 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)1