From 0cec499565f4b0b2260d5d3f9c4fa32c5ee9893b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 30 Dec 2022 12:16:19 +0100 Subject: [PATCH] =?UTF-8?q?make=20sure=20we=20don=E2=80=99t=20dispose=20vi?= =?UTF-8?q?deo=20source=20twice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../conversations/xmpp/jingle/VideoSourceWrapper.java | 10 +++++++++- .../siacs/conversations/xmpp/jingle/WebRTCWrapper.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/VideoSourceWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/VideoSourceWrapper.java index b837131e8..c1ff24521 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/VideoSourceWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/VideoSourceWrapper.java @@ -87,7 +87,15 @@ class VideoSourceWrapper { public void dispose() { this.cameraVideoCapturer.dispose(); if (this.videoSource != null) { - this.videoSource.dispose(); + dispose(this.videoSource); + } + } + + private static void dispose(final VideoSource videoSource) { + try { + videoSource.dispose(); + } catch (final IllegalStateException e) { + Log.e(Config.LOGTAG, "unable to dispose video source", e); } } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index d2979d57e..08154260a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -460,6 +460,7 @@ public class WebRTCWrapper { this.localVideoTrack = null; this.remoteVideoTrack = null; if (videoSourceWrapper != null) { + this.videoSourceWrapper = null; try { videoSourceWrapper.stopCapture(); } catch (final InterruptedException e) {