Search in sources :

Example 1 with VideoStreamStartup

use of com.att.aro.core.peripheral.pojo.VideoStreamStartup in project VideoOptimzer by attdevsupport.

the class VideoStartupReadWriterImpl method readData.

@Override
public VideoStreamStartupData readData(String tracePath) {
    File jsonFile = filereader.createFile(tracePath, JSON_FILE);
    if (jsonFile.exists()) {
        try {
            String jsonDataString = filereader.readAllData(jsonFile.toString());
            videoStreamStartupData = mapper.readValue(jsonDataString, VideoStreamStartupData.class);
            if (videoStreamStartupData.getStreams().isEmpty()) {
                // imports older formats
                VideoStreamStartup videoStreamStartup = mapper.readValue(jsonDataString, VideoStreamStartup.class);
                videoStreamStartupData.getStreams().add(videoStreamStartup);
            }
            jsonDataSaved = serialize(videoStreamStartupData);
        } catch (IOException e) {
            LOG.debug("failed to load startup data: " + e.getMessage());
        }
    } else {
        videoStreamStartupData = new VideoStreamStartupData();
    }
    return videoStreamStartupData;
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) IOException(java.io.IOException) File(java.io.File)

Example 2 with VideoStreamStartup

use of com.att.aro.core.peripheral.pojo.VideoStreamStartup in project VideoOptimzer by attdevsupport.

the class VideoSegmentAnalyzer method locateStartupDelay.

/**
 * <pre>
 * Loads, and or creates estimated, startup data for a stream Populates
 * VideoStreamStartup from first segment and manifest data. Populates
 * VideoStream so that graphs can be displayed. Attaches to VideoStream to aid
 * SegmentTablePanel
 *
 * @param result
 * @param videoStream
 * @return existing or estimated VideoStreamStartup
 */
public VideoStreamStartup locateStartupDelay(AbstractTraceResult result, VideoStream videoStream) {
    if (result instanceof TraceDirectoryResult) {
        if ((videoStreamStartupData = ((TraceDirectoryResult) result).getVideoStartupData()) != null) {
            if ((videoStreamStartup = findStartupFromName(videoStreamStartupData, videoStream)) != null) {
                if (videoStreamStartup.getValidationStartup().equals(ValidationStartup.NA)) {
                    videoStreamStartup.setValidationStartup(ValidationStartup.USER);
                }
            }
        } else {
            videoStreamStartupData = new VideoStreamStartupData();
        }
        if (videoStreamStartup == null) {
            VideoEvent firstEvent = null;
            videoStreamStartup = new VideoStreamStartup(videoStream.getManifest().getVideoName());
            videoStreamStartup.setValidationStartup(ValidationStartup.ESTIMATED);
            videoStreamStartupData.getStreams().add(videoStreamStartup);
            if (!CollectionUtils.isEmpty(videoStream.getVideoActiveMap())) {
                firstEvent = videoStream.getFirstActiveSegment();
            } else {
                firstEvent = videoStream.getFirstSegment();
                if (firstEvent == null) {
                    // invalid stream, no first segment that is a normal segment
                    return null;
                }
                if (videoStream.getManifest().getRequestTime() == 0.0) {
                    // CSI there is no requestTime so make an estimate
                    videoStream.getManifest().setRequestTime(firstEvent.getRequest().getTimeStamp() - videoPrefs.getStallRecovery());
                }
            }
            if (firstEvent.getPlayRequestedTime() == 0) {
                firstEvent.setPlayRequestedTime(videoStream.getManifest().getRequestTime());
            }
            firstEvent.setStartupOffset(firstEvent.getDLLastTimestamp() + videoPrefs.getStallRecovery());
            videoStreamStartup.setFirstSegID(firstEvent.getSegmentID());
            videoStreamStartup.setManifestReqTime(firstEvent.getManifest().getRequestTime());
            videoStreamStartup.setStartupTime(firstEvent.getStartupOffset());
            if (videoStreamStartup.getUserEvent() == null) {
                UserEvent userEvent = new UserEvent();
                double pressTime = videoStream.getManifest().getRequestTime();
                userEvent.setPressTime(pressTime);
                userEvent.setReleaseTime(pressTime);
                userEvent.setEventType(UserEventType.EVENT_UNKNOWN);
                videoStreamStartup.setUserEvent(userEvent);
            }
        }
        videoStream.getManifest().setDelay(videoStreamStartup.getStartupTime() - videoStreamStartup.getManifestReqTime());
        videoStream.setVideoPlayBackTime(videoStreamStartup.getStartupTime());
        videoStream.setVideoStreamStartup(videoStreamStartup);
        ((TraceDirectoryResult) result).setVideoStartupData(videoStreamStartupData);
    }
    return videoStreamStartup;
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent)

Example 3 with VideoStreamStartup

use of com.att.aro.core.peripheral.pojo.VideoStreamStartup in project VideoOptimzer by attdevsupport.

the class VideoSegmentAnalyzer method process.

public void process(AbstractTraceResult result, StreamingVideoData streamingVideoData) {
    if (result instanceof TraceDirectoryResult) {
        videoStreamStartupData = ((TraceDirectoryResult) result).getVideoStartupData();
        this.videoPrefs = videoUsagePrefsManager.getVideoUsagePreference();
        if (!CollectionUtils.isEmpty(streamingVideoData.getVideoStreamMap())) {
            NavigableMap<Double, VideoStream> reverseVideoStreamMap = streamingVideoData.getVideoStreamMap().descendingMap();
            for (VideoStream videoStream : reverseVideoStreamMap.values()) {
                if (!CollectionUtils.isEmpty(videoStream.getVideoEventMap())) {
                    if ((videoStreamStartup = locateStartupDelay(result, videoStream)) == null) {
                        // StartupDelay could not be set, usually an invalid Stream
                        continue;
                    }
                    double startupDelay;
                    VideoEvent chosenEvent;
                    if (videoStreamStartup != null && videoStream.getManifest().getVideoName().equals(videoStreamStartup.getManifestName())) {
                        startupDelay = videoStreamStartup.getStartupTime();
                        chosenEvent = videoStream.getVideoEventBySegment(videoStreamStartup.getFirstSegID());
                        if (videoStreamStartup.getUserEvent() != null) {
                            videoStream.setPlayRequestedTime(videoStreamStartup.getUserEvent().getPressTime());
                        }
                    } else {
                        continue;
                    }
                    duplicateHandling = videoPrefs.getDuplicateHandling();
                    LOG.debug(String.format("Stream RQ:%10.3f", videoStream.getManifest().getRequestTime()));
                    applyStartupDelayToStream(startupDelay, chosenEvent, videoStream, streamingVideoData);
                    videoStream.setDuration(videoStream.getVideoEventMap().entrySet().stream().filter(f -> f.getValue().isSelected() && f.getValue().isNormalSegment()).mapToDouble(x -> x.getValue().getDuration()).sum());
                } else {
                    videoStream.setDuration(0);
                    videoStream.setSelected(false);
                    videoStream.setValid(false);
                }
            }
        }
    }
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) StringUtils(org.apache.commons.lang.StringUtils) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent) ValidationStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup.ValidationStartup) AbstractTraceResult(com.att.aro.core.packetanalysis.pojo.AbstractTraceResult) Autowired(org.springframework.beans.factory.annotation.Autowired) DUPLICATE_HANDLING(com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING) ArrayList(java.util.ArrayList) Logger(org.apache.log4j.Logger) XYPair(com.att.aro.core.videoanalysis.XYPair) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) Nonnull(javax.annotation.Nonnull) VideoStall(com.att.aro.core.packetanalysis.pojo.VideoStall) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) VideoUsagePrefs(com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs) NonNull(lombok.NonNull) NavigableMap(java.util.NavigableMap) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) List(java.util.List) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) UserEventType(com.att.aro.core.peripheral.pojo.UserEvent.UserEventType) TreeMap(java.util.TreeMap) CollectionUtils(org.springframework.util.CollectionUtils) LogManager(org.apache.log4j.LogManager) IVideoUsagePrefsManager(com.att.aro.core.videoanalysis.IVideoUsagePrefsManager) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) Collections(java.util.Collections) SortedMap(java.util.SortedMap) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 4 with VideoStreamStartup

use of com.att.aro.core.peripheral.pojo.VideoStreamStartup in project VideoOptimzer by attdevsupport.

the class StartupDelayDialog method loadStartupDelay.

public double loadStartupDelay() {
    Double tempStartupTime = ((TraceDirectoryResult) traceData.getAnalyzerResult().getTraceresult()).getVideoStartTime();
    if ((videoStreamStartupData = ((TraceDirectoryResult) traceData.getAnalyzerResult().getTraceresult()).getVideoStartupData()) != null) {
        if ((videoStreamStartup = videoSegmentAnalyzer.findStartupFromName(videoStreamStartupData, videoStream)) != null) {
            tempStartupTime = videoStreamStartup.getStartupTime();
        }
    } else {
        videoStreamStartupData = new VideoStreamStartupData();
    }
    if (videoStreamStartup == null) {
        videoStreamStartup = new VideoStreamStartup(videoStream.getManifest().getVideoName());
        videoStreamStartupData.getStreams().add(videoStreamStartup);
    }
    if (!allUserEventList.isEmpty() && videoStreamStartup.getUserEvent() == null) {
        UserEvent ue = findPriorUserEvent(manifestRequestTime);
        if (ue != null) {
            videoStreamStartup.setUserEvent(ue);
        }
        int lastIndex = 0;
        for (int idx = 0; idx < allUserEventList.size(); idx++) {
            if (allUserEventList.get(idx).getPressTime() > manifestRequestTime) {
                break;
            }
            lastIndex = idx;
        }
        videoStreamStartup.setUserEvent(allUserEventList.get(lastIndex));
    }
    ((TraceDirectoryResult) traceData.getAnalyzerResult().getTraceresult()).setVideoStartupData(videoStreamStartupData);
    if (tempStartupTime == 0) {
        // as in based on Manifest request timeStamp
        return getStartTime();
    }
    return tempStartupTime;
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent)

Aggregations

VideoStreamStartup (com.att.aro.core.peripheral.pojo.VideoStreamStartup)4 VideoStreamStartupData (com.att.aro.core.peripheral.pojo.VideoStreamStartupData)4 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 UserEvent (com.att.aro.core.peripheral.pojo.UserEvent)3 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)2 AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)1 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)1 VideoStall (com.att.aro.core.packetanalysis.pojo.VideoStall)1 UserEventType (com.att.aro.core.peripheral.pojo.UserEvent.UserEventType)1 ValidationStartup (com.att.aro.core.peripheral.pojo.VideoStreamStartup.ValidationStartup)1 IVideoUsagePrefsManager (com.att.aro.core.videoanalysis.IVideoUsagePrefsManager)1 XYPair (com.att.aro.core.videoanalysis.XYPair)1 StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)1 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)1 VideoUsagePrefs (com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs)1 DUPLICATE_HANDLING (com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1