Search in sources :

Example 1 with VideoStreamStartupData

use of com.att.aro.core.peripheral.pojo.VideoStreamStartupData 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 VideoStreamStartupData

use of com.att.aro.core.peripheral.pojo.VideoStreamStartupData 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 VideoStreamStartupData

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

the class TraceDataReaderImpl method readFileUtil.

/**
 * some of the trace files read here
 *
 * Parses the user event trace
 *
 * @throws IOException
 *
 *             Reads the screen rotations information contained in the
 *             "screen_rotations" file found inside the trace directory and adds
 *             them to the user events list.
 * @throws IOException
 *             Reads the CPU trace information from the CPU file.
 *
 * @throws IOException
 *             Method to read the GPS data from the trace file and store it in
 *             the gpsInfos list. It also updates the active duration for GPS.
 *             Method to read the Bluetooth data from the trace file and store
 *             it in the bluetoothInfos list. It also updates the active
 *             duration for Bluetooth.
 *
 * @throws IOException
 *             Method to read the Camera data from the trace file and store it
 *             in the cameraInfos list. It also updates the active duration for
 *             Camera.
 *
 *             Method to read the WIFI data from the trace file and store it in
 *             the wifiInfos list. It also updates the active duration for Wifi.
 *
 *             Method to read the Screen State data from the trace file and
 *             store it in the ScreenStateInfos list.
 *
 *             Method to read the Battery data from the trace file and store it
 *             in the batteryInfos list.
 *
 *             Method to read the alarm event from the trace file and store it
 *             in the alarmInfos list.
 *
 *             Reads the Radio data from the file and stores it in the
 *             RadioInfo.
 * @param result
 */
public void readFileUtil(TraceDirectoryResult result) {
    NetworkTypeObject obj = networktypereader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    if (obj != null) {
        result.setNetworkTypeInfos(obj.getNetworkTypeInfos());
        result.setNetworkTypesList(obj.getNetworkTypesList());
    }
    CollectOptions collectOptions = collectOptionsReader.readData(result.getTraceDirectory());
    result.setCollectOptions(collectOptions);
    List<UserEvent> userEvents = usereventreader.readData(result.getTraceDirectory(), result.getEventTime0(), result.getPcapTime0());
    result.setUserEvents(userEvents);
    List<UserEvent> list = this.screenrotationreader.readData(result.getTraceDirectory(), result.getPcapTime0());
    result.setScreenRotationCounter(list.size());
    result.getUserEvents().addAll(list);
    List<TemperatureEvent> temperatureEvents = cputemperaturereader.readData(result.getTraceDirectory(), result.getPcapTime0());
    result.setTemperatureInfos(temperatureEvents);
    List<LocationEvent> locationEvents = locationreader.readData(result.getTraceDirectory(), result.getPcapTime0());
    result.setLocationEventInfos(locationEvents);
    CpuActivityList cpuActivityList = cpureader.readData(result.getTraceDirectory(), result.getPcapTime0());
    result.setCpuActivityList(cpuActivityList);
    List<GpsInfo> gpsInfos = gpsreader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    result.setGpsInfos(gpsInfos);
    result.setGpsActiveDuration(gpsreader.getGpsActiveDuration());
    List<BluetoothInfo> bluetoothInfos = bluetoothreader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    result.setBluetoothInfos(bluetoothInfos);
    result.setBluetoothActiveDuration(bluetoothreader.getBluetoothActiveDuration());
    List<WifiInfo> wifiInfos = wifireader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    result.setWifiInfos(wifiInfos);
    result.setWifiActiveDuration(wifireader.getWifiActiveDuration());
    List<CameraInfo> cameraInfos = camerareader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    result.setCameraInfos(cameraInfos);
    result.setCameraActiveDuration(camerareader.getActiveDuration());
    List<ThermalStatusInfo> thermalStatusInfos = new ThermalStatusReaderImpl(filereader).readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    result.setThermalstatusInfos(thermalStatusInfos);
    List<ScreenStateInfo> screenStateInfos = screenstatereader.readData(result.getTraceDirectory(), result.getPcapTime0(), result.getTraceDuration());
    result.setScreenStateInfos(screenStateInfos);
    List<BatteryInfo> batteryInfos = batteryinforeader.readData(result.getTraceDirectory(), result.getPcapTime0());
    result.setBatteryInfos(batteryInfos);
    // alarm info from kernel log file
    List<AlarmInfo> alarmInfos = alarminforeader.readData(result.getTraceDirectory(), result.getDumpsysEpochTimestamp(), result.getDumpsysElapsedTimestamp(), result.getTraceDateTime());
    result.setAlarmInfos(alarmInfos);
    List<RadioInfo> radioInfos = radioinforeader.readData(result.getTraceDirectory(), result.getPcapTime0());
    result.setRadioInfos(radioInfos);
    VideoStreamStartupData videoStreamStartupData = videoStartupReader.readData(result.getTraceDirectory());
    result.setVideoStartupData(videoStreamStartupData);
    result.setMetaData(metaDataReadWrite.readData(result.getTraceDirectory()));
}
Also used : CpuActivityList(com.att.aro.core.peripheral.pojo.CpuActivityList) NetworkTypeObject(com.att.aro.core.peripheral.pojo.NetworkTypeObject) BatteryInfo(com.att.aro.core.peripheral.pojo.BatteryInfo) ScreenStateInfo(com.att.aro.core.peripheral.pojo.ScreenStateInfo) CameraInfo(com.att.aro.core.peripheral.pojo.CameraInfo) LocationEvent(com.att.aro.core.peripheral.pojo.LocationEvent) BluetoothInfo(com.att.aro.core.peripheral.pojo.BluetoothInfo) TemperatureEvent(com.att.aro.core.peripheral.pojo.TemperatureEvent) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) GpsInfo(com.att.aro.core.peripheral.pojo.GpsInfo) ThermalStatusInfo(com.att.aro.core.peripheral.pojo.ThermalStatusInfo) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent) WifiInfo(com.att.aro.core.peripheral.pojo.WifiInfo) RadioInfo(com.att.aro.core.peripheral.pojo.RadioInfo) CollectOptions(com.att.aro.core.peripheral.pojo.CollectOptions) AlarmInfo(com.att.aro.core.peripheral.pojo.AlarmInfo) ThermalStatusReaderImpl(com.att.aro.core.peripheral.impl.ThermalStatusReaderImpl)

Example 4 with VideoStreamStartupData

use of com.att.aro.core.peripheral.pojo.VideoStreamStartupData 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 5 with VideoStreamStartupData

use of com.att.aro.core.peripheral.pojo.VideoStreamStartupData 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

VideoStreamStartupData (com.att.aro.core.peripheral.pojo.VideoStreamStartupData)5 UserEvent (com.att.aro.core.peripheral.pojo.UserEvent)4 VideoStreamStartup (com.att.aro.core.peripheral.pojo.VideoStreamStartup)4 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)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 ThermalStatusReaderImpl (com.att.aro.core.peripheral.impl.ThermalStatusReaderImpl)1 AlarmInfo (com.att.aro.core.peripheral.pojo.AlarmInfo)1 BatteryInfo (com.att.aro.core.peripheral.pojo.BatteryInfo)1 BluetoothInfo (com.att.aro.core.peripheral.pojo.BluetoothInfo)1 CameraInfo (com.att.aro.core.peripheral.pojo.CameraInfo)1 CollectOptions (com.att.aro.core.peripheral.pojo.CollectOptions)1 CpuActivityList (com.att.aro.core.peripheral.pojo.CpuActivityList)1 GpsInfo (com.att.aro.core.peripheral.pojo.GpsInfo)1 LocationEvent (com.att.aro.core.peripheral.pojo.LocationEvent)1 NetworkTypeObject (com.att.aro.core.peripheral.pojo.NetworkTypeObject)1 RadioInfo (com.att.aro.core.peripheral.pojo.RadioInfo)1 ScreenStateInfo (com.att.aro.core.peripheral.pojo.ScreenStateInfo)1