Search in sources :

Example 1 with SegmentComparison

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

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

the class BPNetworkComparisonTablePanel method getContentTable.

@SuppressWarnings("unchecked")
@Override
public DataTable<SegmentComparison> getContentTable() {
    if (contentTable == null) {
        contentTable = new DataTable<SegmentComparison>(tableModel);
        contentTable.setName(ResourceBundleHelper.getMessageString("video.network.comparison.tableName"));
        contentTable.setAutoCreateRowSorter(true);
        contentTable.setGridColor(Color.LIGHT_GRAY);
        contentTable.setRowHeight(ROW_HEIGHT);
        contentTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
        TableRowSorter<TableModel> sorter = new TableRowSorter<>(tableModel);
        contentTable.setRowSorter(sorter);
        sorter.setComparator(NetworkComparisonTableModel.COL_TRACK_INDEX, Util.getIntSorter());
        sorter.setComparator(NetworkComparisonTableModel.COL_COUNT_INDEX, Util.getIntSorter());
        sorter.setComparator(NetworkComparisonTableModel.COL_CALCULATED_NETWORK_BITRATE_INDEX, Util.getFloatSorter());
        sorter.setComparator(NetworkComparisonTableModel.COL_DECLARED_MANIFEST_BANDWIDTH_INDEX, Util.getFloatSorter());
        // set default sort
        sorter.toggleSortOrder(NetworkComparisonTableModel.COL_TRACK_INDEX);
        DataTablePopupMenu popupMenu = (DataTablePopupMenu) contentTable.getPopup();
        popupMenu.initialize();
    }
    return contentTable;
}
Also used : SegmentComparison(com.att.aro.core.videoanalysis.pojo.SegmentComparison) DataTablePopupMenu(com.att.aro.ui.model.DataTablePopupMenu) NetworkComparisonTableModel(com.att.aro.ui.model.bestpractice.NetworkComparisonTableModel) TableModel(javax.swing.table.TableModel) TableRowSorter(javax.swing.table.TableRowSorter)

Aggregations

SegmentComparison (com.att.aro.core.videoanalysis.pojo.SegmentComparison)2 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)1 VideoNetworkComparisonResult (com.att.aro.core.bestpractice.pojo.VideoNetworkComparisonResult)1 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)1 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)1 DataTablePopupMenu (com.att.aro.ui.model.DataTablePopupMenu)1 NetworkComparisonTableModel (com.att.aro.ui.model.bestpractice.NetworkComparisonTableModel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TreeMap (java.util.TreeMap)1 TableModel (javax.swing.table.TableModel)1 TableRowSorter (javax.swing.table.TableRowSorter)1