Fix video capturer null handling and reset localVideoTrack on teardown#69
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 542406b4da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| val activeCapturer = videoCapturer | ||
| if (activeCapturer == null) { | ||
| Log.w("WebRTC", "⚠️ No compatible camera capturer available. Falling back to audio-only call.") | ||
| isVideoCall = false |
There was a problem hiding this comment.
Propagate video fallback to negotiation metadata
When createVideoCapturer() fails, startLocalVideo() flips the field isVideoCall to false, but startCall()/answerCall() still build SDP constraints and signaling JSON from their isVideoCall parameter (the original requested mode). In the no-camera path, this means the app logs an audio-only fallback locally yet still advertises a video call remotely, which can leave the peer/UI in a mismatched call mode and expect video that will never be published.
Useful? React with 👍 / 👎.
Motivation
createVideoCapturer()returnsnulland by ensuring the local video track is rebuilt between calls.localVideoTrackto thePeerConnection, which can cause subsequent calls to fail.Description
startLocalVideo()against anullcapturer by checkingcreateVideoCapturer()and logging a warning while falling back to audio-only mode when no capturer is available, avoiding!!force-unwraps (file:app/src/main/java/com/example/intra/WebRTCClient.kt).localVideoTrackto the peer connection when the track is actually non-null, with a log warning when unavailable.endCall()teardown, dispose and nulllocalVideoTrackso subsequent calls recreate a fresh capture pipeline instead of reusing a disposed track.Testing
./gradlew :app:compileDebugKotlin, which ran but the build could not complete in this environment due to a missing Android SDK/platform dependency (25.0.1).Codex Task