mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 16:42:27 +00:00
Feature fix for reading flac files offline, where it was getting a bit
confused about load start times and attempting to reload for too much data, causing out of memory errors.
This commit is contained in:
parent
7ee8bdbe2c
commit
f365695b4f
@ -6,7 +6,7 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -24,6 +24,7 @@
|
||||
|
||||
# eclipse project file
|
||||
.project
|
||||
.hprof
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
@ -24,6 +24,7 @@ import Acquisition.pamAudio.PamAudioSystem;
|
||||
import PamController.OfflineFileDataStore;
|
||||
import PamDetection.RawDataUnit;
|
||||
import PamUtils.PamAudioFileFilter;
|
||||
import PamUtils.PamCalendar;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamRawDataBlock;
|
||||
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
|
||||
@ -384,6 +385,9 @@ public class OfflineWavFileServer extends OfflineFileServer<FileDataMapPoint> {
|
||||
this.fileStream = fileStream;
|
||||
this.loadObserver = loadObserver;
|
||||
this.offlineDataLoadInfo=offlineDataLoadInfo;
|
||||
// System.out.printf("New FLAC decoder %s working from %s to %s\n", offlineDataLoadInfo.toString(),
|
||||
// PamCalendar.formatDBDateTime(offlineDataLoadInfo.getStartMillis()),
|
||||
// PamCalendar.formatDBDateTime(offlineDataLoadInfo.getEndMillis()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -392,6 +396,7 @@ public class OfflineWavFileServer extends OfflineFileServer<FileDataMapPoint> {
|
||||
|
||||
try {
|
||||
fileStream.close();
|
||||
ms = Math.max(offlineDataLoadInfo.getStartMillis(), ms);
|
||||
offlineDataLoadInfo.setLastLoadInfo(new AquisitionLoadPoint(ms, -1));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package PamguardMVC.dataOffline;
|
||||
|
||||
import PamUtils.PamCalendar;
|
||||
import PamguardMVC.LoadObserver;
|
||||
import PamguardMVC.PamObserver;
|
||||
|
||||
@ -115,6 +116,7 @@ public class OfflineDataLoadInfo implements Cloneable {
|
||||
this.loadKeepLayers = 0;
|
||||
originalKeepLayers=0;
|
||||
this.allowRepeats = false;
|
||||
checkLoadSize();
|
||||
}
|
||||
|
||||
public OfflineDataLoadInfo(PamObserver dataObserver, PamObserver endObserver, long startMillis, long endMillis,
|
||||
@ -127,6 +129,7 @@ public class OfflineDataLoadInfo implements Cloneable {
|
||||
this.loadKeepLayers = loadKeepLayers;
|
||||
this.originalKeepLayers = loadKeepLayers;
|
||||
this.allowRepeats = allowRepeats;
|
||||
checkLoadSize();
|
||||
}
|
||||
|
||||
public OfflineDataLoadInfo(PamObserver dataObserver, LoadObserver loadObserver, long startMillis, long endMillis,
|
||||
@ -141,12 +144,24 @@ public class OfflineDataLoadInfo implements Cloneable {
|
||||
this.originalKeepLayers = loadKeepLayers;
|
||||
this.interrupt=interrupt;
|
||||
this.allowRepeats = allowRepeats;
|
||||
checkLoadSize();
|
||||
}
|
||||
|
||||
|
||||
public OfflineDataLoadInfo() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
private boolean checkLoadSize() {
|
||||
// if (getEndMillis()-getStartMillis() > 3600000L) {
|
||||
// System.out.printf("Silly big load from %s or %s to %s\n",
|
||||
// PamCalendar.formatDBDateTime(getStartMillis()),
|
||||
// PamCalendar.formatDBDateTime(this.startMillis),
|
||||
// PamCalendar.formatDBDateTime(getEndMillis()));
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Resets the load data for another data load.
|
||||
*/
|
||||
@ -173,7 +188,12 @@ public class OfflineDataLoadInfo implements Cloneable {
|
||||
* @return the startMillis
|
||||
*/
|
||||
public long getStartMillis() {
|
||||
if (this.lastLoadInfo!=null) return lastLoadInfo.lastLoadMillis();
|
||||
if (this.lastLoadInfo!=null) {
|
||||
// if (getEndMillis() - lastLoadInfo.lastLoadMillis() > 3600000L) {
|
||||
// System.out.printf("Weird shit with lastLoadInfo: ");
|
||||
// }
|
||||
return lastLoadInfo.lastLoadMillis();
|
||||
}
|
||||
else return startMillis;
|
||||
}
|
||||
|
||||
@ -191,6 +211,7 @@ public class OfflineDataLoadInfo implements Cloneable {
|
||||
*/
|
||||
public void setStartMillis(long startMillis) {
|
||||
this.startMillis = startMillis;
|
||||
checkLoadSize();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,6 +226,7 @@ public class OfflineDataLoadInfo implements Cloneable {
|
||||
*/
|
||||
public void setEndMillis(long endMillis) {
|
||||
this.endMillis = endMillis;
|
||||
checkLoadSize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,6 +175,13 @@ public class OfflineDataLoading<T extends PamDataUnit> {
|
||||
long t4 = t2;
|
||||
// String orderDates = String.format(" %s to %s",
|
||||
// PamCalendar.formatDateTime(startMillis), PamCalendar.formatDateTime(endMillis));
|
||||
// System.out.printf("Offline data order in %s %s from %s to %s\n", pamDataBlock.getDataName(), offlineDataInfo.toString(),
|
||||
// PamCalendar.formatDBDateTime(offlineDataInfo.getStartMillis()),
|
||||
// PamCalendar.formatDBDateTime(offlineDataInfo.getEndMillis()));
|
||||
// if (offlineDataInfo.getEndMillis()-offlineDataInfo.getStartMillis() > 3600000L) {
|
||||
// System.out.printf("Stupid long load time !");
|
||||
// return;
|
||||
// }
|
||||
try {
|
||||
if (orderData != null) {
|
||||
// System.out.println("order Data is not null");
|
||||
|
@ -20,6 +20,7 @@ import PamController.PamControllerInterface;
|
||||
import PamController.PamGUIManager;
|
||||
import PamController.PamSettingManager;
|
||||
import PamController.PamSettings;
|
||||
import PamUtils.PamCalendar;
|
||||
import PamView.MenuItemEnabler;
|
||||
import PamView.TopToolBar;
|
||||
import PamguardMVC.LoadObserver;
|
||||
@ -298,6 +299,11 @@ public class PlaybackControl extends PamControlledUnit implements PamSettings {
|
||||
this.playbackEndMillis = endMillis;
|
||||
playbackProcess.prepareProcess();
|
||||
playbackProcess.pamStart();
|
||||
|
||||
// System.out.printf("***Viewer playback request from %s to %s\n", PamCalendar.formatDBDateTime(startMillis), PamCalendar.formatDBDateTime(endMillis));
|
||||
// if (endMillis - startMillis > 600000) {
|
||||
// System.out.println("Thats a stupidly big time period");
|
||||
// }
|
||||
dataBlock.orderOfflineData(playbackProcess, new PlayLoadObserver(),
|
||||
startMillis, endMillis, 0,
|
||||
OfflineDataLoading.OFFLINE_DATA_CANCEL, true);
|
||||
|
Loading…
Reference in New Issue
Block a user