diff --git a/source/net/filebot/mediainfo/MediaInfo.java b/source/net/filebot/mediainfo/MediaInfo.java index 6e0c652d..7cb64a17 100644 --- a/source/net/filebot/mediainfo/MediaInfo.java +++ b/source/net/filebot/mediainfo/MediaInfo.java @@ -63,7 +63,7 @@ public class MediaInfo implements Closeable { } private boolean openViaBuffer(RandomAccessFile f) throws IOException { - byte[] buffer = new byte[64 * 1024]; + byte[] buffer = new byte[4 * 1024 * 1024]; // use large buffer to reduce JNA calls int read = -1; if (MediaInfoLibrary.INSTANCE.Open_Buffer_Init(handle, f.length(), 0) <= 0) { @@ -77,8 +77,8 @@ public class MediaInfo implements Closeable { break; } - if (MediaInfoLibrary.INSTANCE.Open_Buffer_Continue_GoTo_Get(handle) != -1) { - long gotoPos = MediaInfoLibrary.INSTANCE.Open_Buffer_Continue_GoTo_Get(handle); + long gotoPos = MediaInfoLibrary.INSTANCE.Open_Buffer_Continue_GoTo_Get(handle); + if (gotoPos >= 0) { f.seek(gotoPos); MediaInfoLibrary.INSTANCE.Open_Buffer_Init(handle, f.length(), gotoPos); }