do not close parcel file descriptor fd twice

This commit is contained in:
Taner Sener 2021-01-25 15:22:49 +00:00
parent 457b0fb1b1
commit 4e8aafae76
2 changed files with 2 additions and 3 deletions

View File

@ -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;
} }

View File

@ -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)));
} }
} }