From 86dac0ceed5632e5f2ae996db34f1950e869c681 Mon Sep 17 00:00:00 2001 From: jawad1257 <154244458+jawad1257@users.noreply.github.com> Date: Tue, 13 May 2025 10:30:25 +0200 Subject: [PATCH 1/4] Wait for audio and video thread to fully stop to avoid corrupted recordings (#1836) --- .../webrtc/record/VideoFileRenderer.java | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) 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..212a868e2a 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,47 @@ 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(); + mediaMuxer.stop(); + mediaMuxer.release(); + 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; From 46d04800cc7077683b993b5e3335da9fe1f1fa91 Mon Sep 17 00:00:00 2001 From: td <152161658+td-famedly@users.noreply.github.com> Date: Wed, 21 May 2025 02:34:31 +0200 Subject: [PATCH 2/4] fix: calls in terminated mode by disabling orientation manager (#1840) --- .../com/cloudwebrtc/webrtc/video/camera/CameraUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) { From 88f7b311f5dded250cc958028ccd5d669aecbbc9 Mon Sep 17 00:00:00 2001 From: suhoge Date: Thu, 22 May 2025 11:18:38 +0800 Subject: [PATCH 3/4] Recording bug (#1839) --- .../cloudwebrtc/webrtc/record/VideoFileRenderer.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 212a868e2a..030c36bf16 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java @@ -155,8 +155,11 @@ void release() { encoder.release(); } eglBase.release(); - mediaMuxer.stop(); - mediaMuxer.release(); + if (muxerStarted) { + mediaMuxer.stop(); + mediaMuxer.release(); + muxerStarted = false; + } renderThread.quit(); } finally { latch.countDown(); @@ -197,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; } @@ -253,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; } From 51ca79ca5aaaf01241bb48604f322bbad9ead4e0 Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Thu, 22 May 2025 11:22:08 +0800 Subject: [PATCH 4/4] release: 0.14.1. --- CHANGELOG.md | 6 ++++++ pubspec.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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/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