diff --git a/CHANGELOG.md b/CHANGELOG.md index f319b025a0..6120e9fb8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog +[0.14.1] - 2025-05-22 + +* [Android] fix: Recording bug (#1839) +* [Android] fix: calls in terminated mode by disabling orientation manager (#1840) +* [Android] fix: Wait for audio and video thread to fully stop to avoid corrupted recordings (#1836) + [0.14.0] - 2025-05-06 * [iOS/Android]feat: Media Recorder implementation Android and iOS (#1810) diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java index f2a0de795c..030c36bf16 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java @@ -1,3 +1,5 @@ +// Modifications by Signify, Copyright 2025, Signify Holding - SPDX-License-Identifier: MIT + package com.cloudwebrtc.webrtc.record; import android.media.MediaCodec; @@ -19,6 +21,7 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.util.concurrent.CountDownLatch; class VideoFileRenderer implements VideoSink, SamplesReadyCallback { private static final String TAG = "VideoFileRenderer"; @@ -127,27 +130,50 @@ private void renderFrameOnRenderThread(VideoFrame frame) { /** * Release all resources. All already posted frames will be rendered first. */ + // Start Signify modification void release() { isRunning = false; - if (audioThreadHandler != null) + CountDownLatch latch = new CountDownLatch(audioThreadHandler != null ? 2 : 1); + if (audioThreadHandler != null) { audioThreadHandler.post(() -> { - if (audioEncoder != null) { - audioEncoder.stop(); - audioEncoder.release(); + try{ + if (audioEncoder != null) { + audioEncoder.stop(); + audioEncoder.release(); + } + audioThread.quit(); + } finally { + latch.countDown(); } - audioThread.quit(); }); + } + renderThreadHandler.post(() -> { - if (encoder != null) { - encoder.stop(); - encoder.release(); + try { + if (encoder != null) { + encoder.stop(); + encoder.release(); + } + eglBase.release(); + if (muxerStarted) { + mediaMuxer.stop(); + mediaMuxer.release(); + muxerStarted = false; + } + renderThread.quit(); + } finally { + latch.countDown(); } - eglBase.release(); - mediaMuxer.stop(); - mediaMuxer.release(); - renderThread.quit(); }); + + try { + latch.await(); + } catch (InterruptedException e) { + Log.e(TAG, "Release interrupted", e); + Thread.currentThread().interrupt(); + } } + // End Signify modification private boolean encoderStarted = false; private volatile boolean muxerStarted = false; @@ -174,7 +200,7 @@ private void drainEncoder() { Log.e(TAG, "encoder output format changed: " + newFormat); trackIndex = mediaMuxer.addTrack(newFormat); - if (audioTrackIndex != -1 && !muxerStarted) { + if (trackIndex != -1 && !muxerStarted) { mediaMuxer.start(); muxerStarted = true; } @@ -230,7 +256,7 @@ private void drainAudio() { Log.w(TAG, "encoder output format changed: " + newFormat); audioTrackIndex = mediaMuxer.addTrack(newFormat); - if (trackIndex != -1 && !muxerStarted) { + if (audioTrackIndex != -1 && !muxerStarted) { mediaMuxer.start(); muxerStarted = true; } diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java b/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java index 04c189eeec..12802ce1d0 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/video/camera/CameraUtils.java @@ -45,7 +45,14 @@ public CameraUtils(GetUserMediaImpl getUserMediaImpl, Activity activity) { this.getUserMediaImpl = getUserMediaImpl; this.activity = activity; this.deviceOrientationManager = new DeviceOrientationManager(activity, 0); - this.deviceOrientationManager.start(); + // commented out because you cannot register a reciever when the app is terminated + // because the activity is null? + // this causes the call to break if the app is terminated + // the manager seems to end up at handleOrientationChange which does not do + // anything at the moment so this should be ok + + // TODO: get a proper fix at some point + // this.deviceOrientationManager.start(); } public void setFocusMode(MethodCall call, AnyThreadResult result) { diff --git a/pubspec.yaml b/pubspec.yaml index e3e380b6f5..719c1a1309 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_webrtc description: Flutter WebRTC plugin for iOS/Android/Destkop/Web, based on GoogleWebRTC. -version: 0.14.0 +version: 0.14.1 homepage: https://github.com/cloudwebrtc/flutter-webrtc environment: sdk: ">=3.3.0 <4.0.0" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy