From e32b6fd17411123f0bd50dd6536de48b50c924ce Mon Sep 17 00:00:00 2001 From: vamshi-dhulipala <140465707+vamshi-dhulipala@users.noreply.github.com> Date: Fri, 26 Apr 2024 09:39:07 -0700 Subject: [PATCH] Release file descriptor even when releasing of android muxer fails (#274) --- .../linkedin/android/litr/io/MediaMuxerMediaTarget.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java b/litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java index 9c5b9819..adef2873 100644 --- a/litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java +++ b/litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java @@ -146,8 +146,11 @@ public void writeSampleData(int targetTrack, @NonNull ByteBuffer buffer, @NonNul @Override public void release() { - mediaMuxer.release(); - releaseFileDescriptor(); + try { + mediaMuxer.release(); + } finally { + releaseFileDescriptor(); + } } @Override