do not close parcel file descriptor fd twice

pull/7/head
Taner Sener 4 years ago
parent 457b0fb1b1
commit 4e8aafae76
  1. 3
      android/app/src/main/cpp/saf_wrapper.c
  2. 2
      android/app/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java

@ -91,9 +91,8 @@ static AVIOContext *create_fd_avio_context(const char *filename, int flags) {
static void close_fd_avio_context(AVIOContext *ctx) { static void close_fd_avio_context(AVIOContext *ctx) {
if (fd_seek(ctx->opaque, 0, AVSEEK_SIZE) >= 0) { if (fd_seek(ctx->opaque, 0, AVSEEK_SIZE) >= 0) {
int *fd = ctx->opaque; int *fd = ctx->opaque;
close(*fd);
closeParcelFileDescriptor(*fd); closeParcelFileDescriptor(*fd);
av_freep(fd); av_freep(&fd);
} }
ctx->opaque = NULL; ctx->opaque = NULL;
} }

@ -979,7 +979,7 @@ public class FFmpegKitConfig {
pfdMap.delete(fd); pfdMap.delete(fd);
} }
} catch (final Throwable t) { } catch (final Throwable t) {
android.util.Log.e(TAG, String.format("Failed to close file descriptor %d.%s", fd, Exceptions.getStackTraceString(t))); android.util.Log.e(TAG, String.format("Failed to close file descriptor: %d.%s", fd, Exceptions.getStackTraceString(t)));
} }
} }

Loading…
Cancel
Save