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;
}
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;
}
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()));
}
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);
}
}
}
}
}
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;
}
Aggregations