use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class HtmlReportImpl method getTimeRangeAnalysisAndStatisticRows.
private String getTimeRangeAnalysisAndStatisticRows(PacketAnalyzerResult results) {
StringBuilder builder = new StringBuilder();
if (results != null) {
TimeRangeAnalysis timeRangeAnalysis = results.getTimeRangeAnalysis();
// Calculate time range
if (timeRangeAnalysis == null) {
AnalysisFilter filter = results.getFilter();
double beginTime = 0.0d;
double endTime = 0.0d;
boolean readyForAnalysis = false;
if (filter != null && filter.getTimeRange() != null) {
beginTime = filter.getTimeRange().getBeginTime();
endTime = filter.getTimeRange().getEndTime();
readyForAnalysis = true;
} else if (results.getTraceresult() != null) {
endTime = results.getTraceresult().getTraceDuration();
readyForAnalysis = true;
}
if (readyForAnalysis) {
timeRangeAnalysis = new TimeRangeAnalysis(beginTime, endTime, results);
}
}
if (timeRangeAnalysis != null) {
double traceDuration = timeRangeAnalysis.getEndTime() - timeRangeAnalysis.getStartTime();
long traceDurationLong = (long) traceDuration;
builder.append("<tr><th>Duration (second)</th><td>" + String.format("%.3f", traceDuration) + "</td></tr>");
builder.append("<tr><th>Duration (hh:mm:ss.sss)</th><td>" + String.format("%02d:%02d:%02d", traceDurationLong / 3600, (traceDurationLong % 3600) / 60, traceDurationLong % 60) + String.format("%.3f", traceDuration - Math.floor(traceDuration)).substring(1));
String timeRangeTitle = results.getTraceresult().getTimeRange().getTitle();
builder.append("<tr><th>Time Range Identifier</th><td>" + (timeRangeTitle != null ? timeRangeTitle : "") + "</td></tr>");
builder.append("<tr><th>Start Time (second)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getStartTime(), 3) + "</td></tr>");
builder.append("<tr><th>End Time (second)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getEndTime(), 3) + "</td></tr>");
}
Statistic statistic = results.getStatistic();
if (statistic != null) {
builder.append(tableLIne() + "<th>Total Data (Byte)</th><td>" + statistic.getTotalByte() + tableChange() + System.getProperty(lineSeperator()));
builder.append(tableLIne() + "<th>Total PayLoad Data (Byte)</th><td>" + statistic.getTotalPayloadBytes() + tableChange() + System.getProperty(lineSeperator()));
builder.append(tableLIne() + "<th>Total HTTPS Data (Byte)</th><td>" + statistic.getTotalHTTPSByte() + " (" + String.format("%.2f", statistic.getTotalHTTPSByte() * 100.0 / statistic.getTotalByte()) + "%)" + tableChange() + System.getProperty(lineSeperator()));
builder.append(tableLIne() + "<th>Total Unanalyzed HTTPS Data (Byte)</th><td>" + statistic.getTotalHTTPSBytesNotAnalyzed() + " (" + String.format("%.2f", statistic.getTotalHTTPSBytesNotAnalyzed() * 100.0 / statistic.getTotalByte()) + "%)</td>" + System.getProperty(lineSeperator()));
}
if (timeRangeAnalysis != null) {
builder.append("<tr><th>Average Throughput (kbps)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getAverageThroughput(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Total Upload Data (Byte)</th><td>" + timeRangeAnalysis.getUplinkBytes() + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Average Upload Throughput (kbps)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getAverageUplinkThroughput(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Total Download Data (Byte)</th><td>" + timeRangeAnalysis.getDownlinkBytes() + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Average Download Throughput (kbps)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getAverageDownlinkThroughput(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
}
EnergyModel energyModel = results.getEnergyModel();
if (energyModel != null) {
builder.append("<tr><th>Total Energy Consumed (J)</th><td>" + doubleToFixedDecimal(energyModel.getTotalEnergyConsumed(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
}
}
return builder.toString();
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class JFxPlayerControl method setUpMediaPlayer.
private void setUpMediaPlayer() {
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
Double startTime = filter.getTimeRange().getBeginTime();
mediaPlayer.setStartTime(new Duration(startTime * 1000));
updateControllerBar();
}
mediaPlayer.currentTimeProperty().addListener(new InvalidationListener() {
@Override
public void invalidated(Observable arg0) {
updateControllerBar();
}
});
mediaPlayer.setOnPlaying(new Runnable() {
@Override
public void run() {
playButton.setText("||");
diagnosticTabSynThread = new VideoSyncThread(jfxPlayer, diagnosticTab, videoOffset);
new Thread(diagnosticTabSynThread).start();
}
});
mediaPlayer.setOnPaused(new Runnable() {
@Override
public void run() {
playButton.setText(">");
}
});
mediaPlayer.setOnStopped(new Runnable() {
@Override
public void run() {
Double startTime = 0.0;
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
startTime = filter.getTimeRange().getBeginTime();
}
mediaPlayer.seek(new Duration(startTime));
playButton.setText(">");
timeSlider.setValue(startTime);
}
});
mediaPlayer.setOnReady(new Runnable() {
@Override
public void run() {
// Duration is available when player is ready (not available before that)
duration = mediaPlayer.getMedia().getDuration();
sliderMax = getVideoDuration() * FRAME_RATE;
if (timeSlider != null) {
timeSlider.setMax(sliderMax);
}
updateControllerBar();
}
});
mediaPlayer.setOnEndOfMedia(new Runnable() {
@Override
public void run() {
Double startTime = 0.0;
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
startTime = filter.getTimeRange().getBeginTime();
}
mediaPlayer.seek(new Duration(startTime));
mediaPlayer.pause();
playButton.setText(">");
timeSlider.setValue(startTime);
updateTimeLabel();
}
});
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class VlcjPlayer method loadVideo.
@Override
public void loadVideo(AbstractTraceResult traceResult) {
/*
* Without calling stop(), the player view will still show the image from the
* previous video after calling prepareMedia() on the new video.
*/
String movVideoPath = traceResult.getTraceDirectory() + Util.FILE_SEPARATOR + ResourceBundleHelper.getMessageString("video.videoDisplayFile");
String mp4VideoPath = traceResult.getTraceDirectory() + Util.FILE_SEPARATOR + ResourceBundleHelper.getMessageString("video.videoFileOnDevice");
videoPath = new File(mp4VideoPath).exists() ? mp4VideoPath : movVideoPath;
/*
* start then pause in order for graph panel and video player to be able to go
* in sync before user starts playing the video
*/
String videoOptions = "";
double beginTime = 0;
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
beginTime = filter.getTimeRange().getBeginTime();
videoOptions = "start-time=" + String.valueOf(beginTime);
}
int playerContentWidth, playerContentHeight;
if (VideoUtil.isVideoLandscape(traceResult)) {
playerContentWidth = VideoUtil.PLAYER_CONTENT_WIDTH_LANDSCAPE;
playerContentHeight = VideoUtil.PLAYER_CONTENT_HEIGHT_LANDSCAPE;
} else {
playerContentWidth = VideoUtil.PLAYER_CONTENT_WIDTH_PORTRAIT;
playerContentHeight = VideoUtil.PLAYER_CONTENT_HEIGHT_PORTRAIT;
}
initMediaPlayerComponent(playerContentWidth, playerContentHeight);
if (player == null) {
LOGGER.error("player is not available!");
return;
}
File videoFile = new File(videoPath);
if (videoFile != null && videoFile.exists() && videoFile.length() < 2) {
videoFile.delete();
LOGGER.info("deleted empty video file");
return;
}
frame.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width - playerContentWidth, 0);
frame.pack();
player.media().start(videoPath, videoOptions);
// Make sure the media has been started playing
long start = System.currentTimeMillis();
while (player.status().position() == 0) {
try {
Thread.sleep(20);
} catch (InterruptedException e) {
LOGGER.error("The thread was interrupted from sleep", e);
}
}
long end = System.currentTimeMillis();
LOGGER.debug("Time taken to start the media " + (end - start));
player.controls().setPause(true);
playButton.setText(">");
duration = getDuration();
double videoStartTime = traceResult.getVideoStartTime();
this.videoOffset = videoStartTime > 0.0 ? videoStartTime - ((double) traceResult.getTraceDateTime().getTime() / 1000) : 0.0;
if (Math.abs(videoOffset) >= duration) {
videoOffset = 0;
}
updateUserInterfaceElements(beginTime);
/*
* Adjust slider's max for each new video for more accurate and custom fitting
* to the timestamp.
*/
slider.setMaximum((int) (duration * FRAME_RATE));
diagnosticsTab.setGraphPanelClicked(false);
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class JFxPlayer method refresh.
private void refresh() throws IOException {
double videoStartTime = traceResult.getVideoStartTime();
videoOffset = videoStartTime > 0.0 ? videoStartTime - ((double) traceResult.getTraceDateTime().getTime() / 1000) : 0.0;
launchFXPlayer();
if (playerControl == null) {
LOGGER.error("Player control is not available!");
return;
}
Double startTime = 0.0;
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
startTime = filter.getTimeRange().getBeginTime();
}
setMediaTime(startTime);
diagnosticsTab.setGraphPanelClicked(false);
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class BestPracticeResultsListener method addTimeRangeAnalysisAndStatisticRows.
private void addTimeRangeAnalysisAndStatisticRows(List<List<Object>> dataRows) {
if (traceData.getAnalyzerResult() != null) {
TimeRangeAnalysis timeRangeAnalysis = traceData.getAnalyzerResult().getTimeRangeAnalysis();
// Calculate time range
if (timeRangeAnalysis == null) {
AnalysisFilter filter = traceData.getAnalyzerResult().getFilter();
double beginTime = 0.0d;
double endTime = 0.0d;
boolean readyForAnalysis = false;
if (filter != null && filter.getTimeRange() != null) {
beginTime = filter.getTimeRange().getBeginTime();
endTime = filter.getTimeRange().getEndTime();
readyForAnalysis = true;
} else if (traceData.getAnalyzerResult().getTraceresult() != null) {
endTime = traceData.getAnalyzerResult().getTraceresult().getTraceDuration();
readyForAnalysis = true;
}
if (readyForAnalysis) {
timeRangeAnalysis = new TimeRangeAnalysis(beginTime, endTime, traceData.getAnalyzerResult());
}
}
if (timeRangeAnalysis != null) {
double traceDuration = timeRangeAnalysis.getEndTime() - timeRangeAnalysis.getStartTime();
long traceDurationLong = (long) traceDuration;
dataRows.add(Arrays.asList(getFontStyledColumn("Duration (second)"), formatToFixedDecimal(3, traceDuration)));
dataRows.add(Arrays.asList(getFontStyledColumn("Duration (hh:mm:ss.sss)"), String.format("%02d:%02d:%02d", traceDurationLong / 3600, (traceDurationLong % 3600) / 60, traceDurationLong % 60) + String.format("%.3f", traceDuration - Math.floor(traceDuration)).substring(1)));
String timeRangeTitle = traceData.getAnalyzerResult().getTraceresult().getTimeRange().getTitle();
dataRows.add(Arrays.asList(getFontStyledColumn("Time Range Identifier"), timeRangeTitle != null ? timeRangeTitle : ""));
dataRows.add(Arrays.asList(getFontStyledColumn("Start Time (second)"), formatToFixedDecimal(3, timeRangeAnalysis.getStartTime())));
dataRows.add(Arrays.asList(getFontStyledColumn("End Time (second)"), formatToFixedDecimal(3, timeRangeAnalysis.getEndTime())));
}
Statistic statistic = traceData.getAnalyzerResult().getStatistic();
if (statistic != null) {
dataRows.add(Arrays.asList(getFontStyledColumn("Total Data (KB)"), formatToFixedDecimal(2, statistic.getTotalByte() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Total Payload Data (KB)"), formatToFixedDecimal(2, statistic.getTotalPayloadBytes() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("HTTPS Data (KB)"), formatToFixedDecimal(2, statistic.getTotalHTTPSByte() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Unanalyzed HTTPS Data (KB)"), formatToFixedDecimal(2, statistic.getTotalHTTPSBytesNotAnalyzed() / 1000.0)));
}
if (timeRangeAnalysis != null) {
dataRows.add(Arrays.asList(getFontStyledColumn("Average Throughput (kbps)"), formatToFixedDecimal(2, timeRangeAnalysis.getAverageThroughput())));
dataRows.add(Arrays.asList(getFontStyledColumn("Total Upload Data (KB)"), formatToFixedDecimal(2, timeRangeAnalysis.getUplinkBytes() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Average Upload Throughput (kbps)"), formatToFixedDecimal(2, timeRangeAnalysis.getAverageUplinkThroughput())));
dataRows.add(Arrays.asList(getFontStyledColumn("Total Download Data (KB)"), formatToFixedDecimal(2, timeRangeAnalysis.getDownlinkBytes() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Average Download Throughput (kbps)"), formatToFixedDecimal(2, timeRangeAnalysis.getAverageDownlinkThroughput())));
}
if (statistic != null) {
dataRows.add(Arrays.asList(getFontStyledColumn("Total Energy Consumed (J)"), formatToFixedDecimal(2, traceData.getAnalyzerResult().getEnergyModel().getTotalEnergyConsumed())));
}
}
}
Aggregations