Skip to content

Fix android camera crashing while spamming toggle#48

Merged
Magmusacy merged 3 commits into
masterfrom
android-camera-crash/FCE-3210
Jun 1, 2026
Merged

Fix android camera crashing while spamming toggle#48
Magmusacy merged 3 commits into
masterfrom
android-camera-crash/FCE-3210

Conversation

@Magmusacy

Copy link
Copy Markdown

No description provided.

@linear

linear Bot commented May 26, 2026

Copy link
Copy Markdown

FCE-3210

@Magmusacy Magmusacy marked this pull request as ready for review May 26, 2026 13:20
Copilot AI review requested due to automatic review settings May 26, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent Android camera crashes when rapidly toggling the camera by reducing EGL context churn and keeping rendering/capture EGL resources reusable across toggle cycles.

Changes:

  • Updated WebRTCView#setVideoTrack to avoid releasing/reinitializing SurfaceViewRenderer when the track becomes null, keeping the EGL context alive while the view remains attached.
  • Introduced a reusable SurfaceTextureHelper for camera captures in GetUserMediaImpl to avoid allocating a new EGL context per camera session.
  • Adjusted track disposal logic so reusable camera SurfaceTextureHelper instances are not fully disposed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
android/src/main/java/com/oney/WebRTCModule/WebRTCView.java Keeps SurfaceViewRenderer alive across VideoTrack toggles to reduce EGL context churn.
android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java Reuses a single camera SurfaceTextureHelper and changes disposal behavior to retain its EGL context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread android/src/main/java/com/oney/WebRTCModule/WebRTCView.java Outdated
Comment thread android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java
Comment thread android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@MiloszFilimowski MiloszFilimowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Magmusacy Magmusacy merged commit 2526d8a into master Jun 1, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

3 participants