Skip to content

Commit f07435d

Browse files
committed
android: fix crash when SurfaceTexttureHelper fails to be created
This was previously patched on WebRTC but it makes more sense to handle it at the application level.
1 parent 92a336d commit f07435d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ private VideoTrack createVideoTrack(ReadableMap constraints) {
9393
EglBase.Context eglContext = EglUtils.getRootEglBaseContext();
9494
SurfaceTextureHelper surfaceTextureHelper =
9595
SurfaceTextureHelper.create("CaptureThread", eglContext);
96+
97+
if (surfaceTextureHelper == null) {
98+
Log.d(TAG, "Error creating SurfaceTextureHelper");
99+
return null;
100+
}
101+
96102
VideoSource videoSource = pcFactory.createVideoSource(videoCapturer.isScreencast());
97103
videoCapturer.initialize(surfaceTextureHelper, reactContext, videoSource.getCapturerObserver());
98104

0 commit comments

Comments
 (0)