Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaStreamTrack has been disposed. #176

Open
YoussefHachicha opened this issue Aug 3, 2024 · 1 comment
Open

MediaStreamTrack has been disposed. #176

YoussefHachicha opened this issue Aug 3, 2024 · 1 comment

Comments

@YoussefHachicha
Copy link

YoussefHachicha commented Aug 3, 2024

Versions:
kotlin = "2.0.0"
streamWebRTC = "1.1.2"

Issue description:
when I leave the call I call the disconnet() function

    override fun disconnect() {
        // dispose audio & video tracks.
        remoteVideoTrackFlow.replayCache.forEach { videoTrack ->
            videoTrack.dispose()
        }
        localVideoTrackFlow.replayCache.forEach { videoTrack ->
            videoTrack.dispose()
        }
        localAudioTrack.dispose()
        localVideoTrack.dispose()

        // dispose audio handler and video capturer.
        audioHandler.stop()
        videoCapturer.stopCapture()
        videoCapturer.dispose()

        // dispose signaling clients and socket.
        signalingClient.dispose()
    }

then if I try to join again the app will crash with this exception

java.lang.IllegalStateException: MediaStreamTrack has been disposed.
at org.webrtc.MediaStreamTrack.checkMediaStreamTrackExists(MediaStreamTrack.java:120)
at org.webrtc.MediaStreamTrack.getNativeMediaStreamTrack(MediaStreamTrack.java:114)
at org.webrtc.VideoTrack.addSink(VideoTrack.java:40)
at quran.ui.components.session.VideoRendererKt.setupVideo(VideoRenderer.kt:77)
at quran.ui.components.session.VideoRendererKt.VideoRenderer$lambda$8(VideoRenderer.kt:47)
at quran.ui.components.session.VideoRendererKt.$r8$lambda$n6UVi621O36qTiSUJBF7tT5eapI(Unknown Source:0)

What have I tried:
my current solution for this is to dispose the entire WebRtcSessionManager and create an other one, I followed this solution because I wasn't able to identify how to recreate the MediaStreamTrack if it was disposed, and I figured out since it worked the first time then disposing the entire class and recreating it from the start would solve the issue but I would like to understand.

Other:
why even bother calling disconnet() since it disposes the MediaStreamTrack not calling it will not result in a crash but the camera wont show up

@skydoves
Copy link
Member

Hi @YoussefHachicha, the new release, version 1.3.0, is now available and includes the m125 patches. Could you check if this issue still occurs with the updated release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants