if (startTimeStamp == -1) {
// Calculate the delta between the initial start and the first audio-packet data
initialDelta = virtualTime.getTime() - startedSessionTimeDate.getTime();
FlvRecordingMetaDelta metaDelta = new FlvRecordingMetaDelta();
metaDelta.setDeltaTime(initialDelta);
metaDelta.setFlvRecordingMetaDataId(metaDataId);
metaDelta.setTimeStamp(0);
metaDelta.setDebugStatus("INIT AUDIO");
metaDelta.setIsStartPadding(true);
metaDelta.setIsEndPadding(false);
metaDelta.setDataLengthPacket(data.limit());
metaDelta.setReceivedAudioDataLength(byteCount);
metaDelta.setStartTime(startedSessionTimeDate);
metaDelta.setPacketTimeStamp(streampacket.getTimestamp());
Long deltaTimeStamp = virtualTime.getTime() - startedSessionTimeDate.getTime();
metaDelta.setDuration(0);
Long missingTime = deltaTimeStamp - 0;
metaDelta.setMissingTime(missingTime);
metaDelta.setCurrentTime(virtualTime);
metaDelta.setDeltaTimeStamp(deltaTimeStamp);
metaDelta.setStartTimeStamp(startTimeStamp);
metaDeltaDao.addFlvRecordingMetaDelta(metaDelta);
// That will be not bigger then long value
startTimeStamp = streampacket.getTimestamp();
FlvRecordingMetaData metaData = metaDataDao.get(metaDataId);
metaData.setRecordStart(virtualTime);
metaDataDao.update(metaData);
}
lastStreamPacketTimeStamp = streampacket.getTimestamp();
timeStamp -= startTimeStamp;
// Offset at the beginning is calculated above
long deltaTime = lastTimeStamp == -1 ? 0 : timeStamp - lastTimeStamp;
Long preLastTimeStamp = Long.parseLong(lastTimeStamp.toString());
lastTimeStamp = timeStamp;
if (deltaTime > 75) {
FlvRecordingMetaDelta metaDelta = new FlvRecordingMetaDelta();
metaDelta.setDeltaTime(deltaTime);
metaDelta.setFlvRecordingMetaDataId(metaDataId);
metaDelta.setTimeStamp(timeStamp);
metaDelta.setDebugStatus("RUN AUDIO");
metaDelta.setIsStartPadding(false);
metaDelta.setLastTimeStamp(preLastTimeStamp);
metaDelta.setIsEndPadding(false);
metaDelta.setDataLengthPacket(data.limit());
metaDelta.setReceivedAudioDataLength(byteCount);
metaDelta.setStartTime(startedSessionTimeDate);
metaDelta.setPacketTimeStamp(streampacket.getTimestamp());
Date current_date = new Date();
Long deltaTimeStamp = current_date.getTime() - startedSessionTimeDate.getTime();
duration = Math.max(duration, timeStamp + writer.getOffset());
metaDelta.setDuration(duration);
Long missingTime = deltaTimeStamp - timeStamp;
metaDelta.setMissingTime(missingTime);
metaDelta.setCurrentTime(current_date);
metaDelta.setDeltaTimeStamp(deltaTimeStamp);
metaDelta.setStartTimeStamp(startTimeStamp);
metaDeltaDao.addFlvRecordingMetaDelta(metaDelta);
}
log.trace("##REC:: timeStamp :: " + timeStamp);