Do not bother with exceptions during exporting when process was cancelled

This commit is contained in:
johni0702
2015-07-16 19:08:24 +02:00
parent 56efc8c5ec
commit 84cb8b2988
2 changed files with 11 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ public class VideoWriter implements FrameConsumer<RGBFrame> {
private final OutputStream outputStream;
private final WritableByteChannel channel;
private final String commandArgs;
private volatile boolean aborted;
public VideoWriter(final RenderOptions options) throws IOException {
this.options = options.copy();
@@ -90,6 +91,9 @@ public class VideoWriter implements FrameConsumer<RGBFrame> {
channel.write(frame.getByteBuffer());
ByteBufferPool.release(frame.getByteBuffer());
} catch (Throwable t) {
if (aborted) {
return;
}
CrashReport report = CrashReport.makeCrashReport(t, "Exporting frame");
CrashReportCategory exportDetails = report.makeCategory("Export details");
exportDetails.addCrashSection("Export command", options.getExportCommand());
@@ -106,4 +110,8 @@ public class VideoWriter implements FrameConsumer<RGBFrame> {
isTrue(width == options.getWidth(), "Width has to be %d but was %d", options.getWidth(), width);
isTrue(height == options.getHeight(), "Height has to be %d but was %d", options.getHeight(), height);
}
public void abort() {
aborted = true;
}
}