make sure we don’t dispose video source twice

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/xmpp/jingle/VideoSourceWrapper.java | 10 
src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java      |  1 
2 files changed, 10 insertions(+), 1 deletion(-)

Detailed changes

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