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