use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoStreamConstructor method extractVideo.
public void extractVideo(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request, Double timeStamp) {
CRC32 crc32 = new CRC32();
ChildManifest childManifest = null;
byte[] content = extractContent(request, StreamContentType.VIDEO);
if (content == null) {
return;
}
LOG.debug(String.format(">>Segment request, packetID: %d, len:%d, name:%s, TS:%.3f, URL:%s", request.getAssocReqResp().getFirstDataPacket().getPacketId(), content.length, request.getFileName(), request.getTimeStamp(), request.getObjUri()));
this.streamingVideoData = streamingVideoData;
childManifest = matchSegment(streamingVideoData, request, timeStamp, content);
if (childManifest == null) {
return;
}
String name = manifestBuilder.buildSegmentName(request, extractExtensionFromRequest(request));
crc32.update(content);
updateVideoNameSize();
byte[] thumbnail = null;
if (segmentInfo.getSegmentID() == 0 && childManifest.getManifest().isVideoFormat(VideoFormat.MPEG4)) {
childManifest.setMoovContent(content);
segmentInfo.setDuration(0);
}
if (segmentInfo.getDuration() > 0) {
double bitRate = content.length * 8 / segmentInfo.getDuration();
segmentInfo.setBitrate(bitRate / 1000);
}
VideoEvent videoEvent = new // imageArray
VideoEvent(// imageArray
thumbnail, // Manifest
manifestCollection.getManifest(), // segmentID, quality, duration
segmentInfo, // PixelHeight
childManifest, // segmentSize
content.length, // response
request.getAssocReqResp(), // crc32Value
crc32.getValue());
videoStream.addVideoEvent(videoEvent);
String fullPathName = buildPath(streamingVideoData, request, segmentInfo.getSegmentID(), segmentInfo.getQuality(), name);
int pos1 = fullPathName.lastIndexOf(Util.FILE_SEPARATOR) + 1;
int pos2 = fullPathName.substring(pos1).indexOf('_');
fullPathName = String.format("%s%09.0f%s", fullPathName.substring(0, pos1), videoEvent.getEndTS() * 1000, fullPathName.substring(pos1 + pos2));
savePayload(content, fullPathName);
videoEvent.setSegmentPathName(fullPathName);
String tempClippingFullPath = buildSegmentFullPathName(streamingVideoData, request);
if (videoEvent.isNormalSegment() && createClipping(segmentInfo, childManifest, content, tempClippingFullPath)) {
ffmpegRunner.addJob(videoEvent, tempClippingFullPath);
}
videoEvent.isDefaultThumbnail();
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class PlotHelperAbstract method videoEventListBySegment.
public List<VideoEvent> videoEventListBySegment(StreamingVideoData streamingVideoData) {
this.streamingVideoData = streamingVideoData;
// new ArrayList<>();
List<VideoEvent> chunksBySegmentID = streamingVideoData.getStreamingVideoCompiled().getChunksBySegmentID();
chunksBySegmentID.clear();
for (VideoStream videoStream : streamingVideoData.getVideoStreamMap().values()) {
if (videoStream.isSelected() && !videoStream.getVideoEventsBySegment().isEmpty()) {
for (VideoEvent videoEvent : videoStream.getVideoEventsBySegment()) {
if (videoEvent.isNormalSegment()) {
chunksBySegmentID.add(videoEvent);
}
}
}
}
for (VideoEvent ve : streamingVideoData.getStreamingVideoCompiled().getDeleteChunkList()) {
chunksBySegmentID.remove(ve);
}
Collections.sort(chunksBySegmentID, new VideoEventComparator(SortSelection.SEGMENT_ID));
return chunksBySegmentID;
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class GraphPanel method refresh.
// In 4.1.1, the method name is resetChart(TraceData.Analysis analysis)
public void refresh(AROTraceData aroTraceData) {
getSaveGraphButton().setEnabled(aroTraceData != null);
if (combinedPlot != null) {
setGraphView(combinedPlot.getDomainCrosshairValue(), true);
} else {
setGraphView(0, true);
}
setTraceData(aroTraceData);
if (aroTraceData != null) {
setAllPackets(aroTraceData.getAnalyzerResult().getTraceresult().getAllpackets());
setTraceDuration(aroTraceData.getAnalyzerResult().getTraceresult().getTraceDuration());
// list
setAllTcpSessions(aroTraceData.getAnalyzerResult().getSessionlist().size());
// length
} else {
setAllPackets(new LinkedList<PacketInfo>());
setTraceDuration(0);
setAllTcpSessions(0);
}
if (aroTraceData != null && aroTraceData.getAnalyzerResult().getFilter() != null && aroTraceData.getAnalyzerResult().getFilter().getTimeRange() != null) {
if (aroTraceData.getAnalyzerResult().getSessionlist().size() > 0 && aroTraceData.getAnalyzerResult().getFilter().getTimeRange().getBeginTime() < aroTraceData.getAnalyzerResult().getFilter().getTimeRange().getEndTime()) {
getAxis().setRange(new Range(aroTraceData.getAnalyzerResult().getFilter().getTimeRange().getBeginTime(), aroTraceData.getAnalyzerResult().getFilter().getTimeRange().getEndTime()));
} else {
getAxis().setRange(new Range(-0.01, 0));
}
} else {
if (getEndTime() > 0) {
if (aroTraceData != null) {
getAxis().setRange(new Range(getStartTime(), getEndTime()));
}
// Reset times
setStartTime(0.0);
setEndTime(0.0);
} else {
getAxis().setRange(new Range(-0.01, aroTraceData != null ? aroTraceData.getAnalyzerResult().getTraceresult().getTraceDuration() : DEFAULT_TIMELINE));
}
}
if (aroTraceData != null && aroTraceData.getAnalyzerResult().getSessionlist().size() > 0) {
for (Map.Entry<ChartPlotOptions, GraphPanelPlotLabels> entry : getSubplotMap().entrySet()) {
switch(entry.getKey()) {
case THROUGHPUT:
if (throughput == null) {
throughput = new ThroughputPlot();
}
throughput.populate(entry.getValue().getPlot(), aroTraceData);
break;
case BURSTS:
if (burstPlot == null) {
burstPlot = new BurstPlot();
}
// burstPlot = new BurstPlot();
burstPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case RRC:
if (rrcPlot == null) {
rrcPlot = new RrcPlot();
}
rrcPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case USER_INPUT:
if (eventPlot == null) {
eventPlot = new UserEventPlot();
}
eventPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case DL_PACKETS:
if (dlPlot == null) {
dlPlot = new DLPacketPlot();
}
dlPlot.populate(entry.getValue().getPlot(), aroTraceData, true);
break;
case UL_PACKETS:
if (upPlot == null) {
upPlot = new DLPacketPlot();
}
upPlot.populate(entry.getValue().getPlot(), aroTraceData, false);
break;
case ALARM:
if (alarmPlot == null) {
alarmPlot = new AlarmPlot();
}
alarmPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case GPS:
if (gpsPlot == null) {
gpsPlot = new GpsPlot();
}
gpsPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case RADIO:
if (radioPlot == null) {
radioPlot = new RadioPlot();
}
radioPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case CPU:
if (cpuPlot == null) {
cpuPlot = new CpuPlot();
}
cpuPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case SCREEN:
if (ssPlot == null) {
ssPlot = new ScreenStatePlot();
}
ssPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case BATTERY:
if (bPlot == null) {
bPlot = new BatteryPlot();
}
bPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case TEMPERATURE:
if (tPlot == null) {
tPlot = new TemperaturePlot();
}
tPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case BLUETOOTH:
if (bluetoothPlot == null) {
bluetoothPlot = new BluetoothPlot();
}
bluetoothPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case WIFI:
if (wPlot == null) {
wPlot = new WifiPlot();
}
wPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case CAMERA:
if (cPlot == null) {
cPlot = new CameraPlot();
}
cPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case NETWORK_TYPE:
if (ntPlot == null) {
ntPlot = new NetworkTypePlot();
}
ntPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case WAKELOCK:
if (wlPlot == null) {
wlPlot = new WakeLockPlot();
}
wlPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case ATTENUATION:
if (attnrPlot == null) {
attnrPlot = new AttenuatorPlot();
}
attnrPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case SPEED_THROTTLE:
if (stPlot == null) {
stPlot = new SpeedThrottlePlot();
}
stPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case VIDEO_CHUNKS:
if (vcPlot == null) {
vcPlot = new VideoChunksPlot();
}
XYPlot bufferOccupancyPlot = getSubplotMap().get(ChartPlotOptions.BUFFER_OCCUPANCY).getPlot();
XYPlot bufferTimePlot = getSubplotMap().get(ChartPlotOptions.BUFFER_TIME_OCCUPANCY).getPlot();
this.chunkInfo.clear();
vcPlot.setBufferOccupancyPlot(bufferOccupancyPlot);
vcPlot.setBufferTimePlot(bufferTimePlot);
VideoStream selectedStream = null;
int count = 0;
StreamingVideoData streamingVideoData = aroTraceData.getAnalyzerResult().getStreamingVideoData();
if (streamingVideoData != null) {
for (VideoStream videoStream : streamingVideoData.getVideoStreamMap().values()) {
if (videoStream != null && videoStream.isSelected()) {
selectedStream = videoStream;
count++;
}
}
if (count == 1 && selectedStream != null && selectedStream.getManifest().getDelay() != 0) {
VideoEvent firstSegment = (VideoEvent) selectedStream.getVideoEventsBySegment().toArray()[0];
if (selectedStream.getManifest().getVideoFormat() == VideoFormat.MPEG4) {
for (VideoEvent video : selectedStream.getVideoEventsBySegment()) {
if (video.getSegmentID() != 0) {
firstSegment = video;
break;
}
}
}
vcPlot.refreshPlot(getSubplotMap().get(ChartPlotOptions.VIDEO_CHUNKS).getPlot(), aroTraceData, selectedStream.getManifest().getDelay() + firstSegment.getEndTS(), firstSegment);
} else {
vcPlot.populate(entry.getValue().getPlot(), aroTraceData);
}
}
break;
case CONNECTIONS:
connectionsPlot = new ConnectionsPlot();
connectionsPlot.populate(entry.getValue().getPlot(), aroTraceData);
break;
case LATENCY:
if (latencyplot == null) {
latencyplot = new LatencyPlot();
}
latencyplot.populate(entry.getValue().getPlot(), aroTraceData);
break;
default:
break;
}
}
}
getZoomInButton().setEnabled(aroTraceData != null);
getZoomOutButton().setEnabled(aroTraceData != null);
getSaveGraphButton().setEnabled(aroTraceData != null);
if (aroTraceData != null) {
parent.getDeviceNetworkProfilePanel().refresh(aroTraceData);
}
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class GraphPanel method chartMouseClicked.
@Override
public void chartMouseClicked(ChartMouseEvent chartmouseevent) {
Point2D point = chartmouseevent.getTrigger().getPoint();
Rectangle2D plotArea = getChartPanel().getScreenDataArea();
XYPlot plot = (XYPlot) getAdvancedGraph().getPlot();
final double lastChartX = new Double(plot.getDomainAxis().java2DToValue(point.getX(), plotArea, plot.getDomainAxisEdge()));
for (GraphPanelListener gpl : listeners) {
gpl.graphPanelClicked(lastChartX);
ChartEntity entity = chartmouseevent.getEntity();
if (entity instanceof XYItemEntity) {
XYItemEntity xyItem = (XYItemEntity) entity;
XYDataset xyDataset = xyItem.getDataset();
int seriesIndex = xyItem.getSeriesIndex();
int itemIndex = xyItem.getItem();
double xDataValue = xyDataset.getXValue(seriesIndex, itemIndex);
double yDataValue = xyDataset.getYValue(seriesIndex, itemIndex);
Map<Integer, VideoEvent> veSegment = vcPlot.getChunk(xDataValue);
if (vcPlot.isDataItemPoint(xDataValue, yDataValue)) {
if (veSegment != null) {
for (int key : veSegment.keySet()) {
chunkInfo.put(key, veSegment.get(key));
}
}
} else if (vcPlot.getBufferTimePlot().isDataItemStallPoint(xDataValue, yDataValue) != null) {
VideoEvent segmentToPlay = vcPlot.getBufferTimePlot().isDataItemStallPoint(xDataValue, yDataValue);
veSegment = vcPlot.getSegmentToPlayLocation(segmentToPlay);
if (veSegment != null) {
for (int key : veSegment.keySet()) {
chunkInfo.put(key, veSegment.get(key));
}
}
}
}
}
}
use of com.att.aro.core.videoanalysis.pojo.VideoEvent in project VideoOptimzer by attdevsupport.
the class VideoChunksPlot method toolTipGenerator.
public XYToolTipGenerator toolTipGenerator() {
XYToolTipGenerator xyToolTipGenerator = new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
VideoEvent currentVEvent = segmentsToBePlayed.get(item);
String toolTip = null;
try {
toolTip = (MessageFormat.format(VIDEOCHUNK_TOOLTIP, String.format("%.0f", currentVEvent.getSegmentID()), String.format("%.3f", currentVEvent.getStartTS()), String.format("%.3f", currentVEvent.getEndTS()), String.format("%.3f s", currentVEvent.getPlayTime()), String.format("%.2f", currentVEvent.getTotalBytes() / 1000)));
} catch (Exception e) {
LOG.error("ToolTipException:", e);
toolTip = "";
}
return toolTip;
}
};
return xyToolTipGenerator;
}
Aggregations