|
@@ -1,6 +1,5 @@
|
1
|
1
|
/*
|
2
|
|
- * Copyright @ 2019-present 8x8, Inc.
|
3
|
|
- * Copyright @ 2017-2018 Atlassian Pty Ltd
|
|
2
|
+ * Copyright @ 2017-present 8x8, Inc.
|
4
|
3
|
*
|
5
|
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -31,9 +30,13 @@ import com.facebook.react.devsupport.DevInternalSettings;
|
31
|
30
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
32
|
31
|
import com.facebook.react.uimanager.ViewManager;
|
33
|
32
|
import com.facebook.soloader.SoLoader;
|
|
33
|
+
|
|
34
|
+import com.oney.WebRTCModule.EglUtils;
|
34
|
35
|
import com.oney.WebRTCModule.RTCVideoViewManager;
|
35
|
36
|
import com.oney.WebRTCModule.WebRTCModule;
|
36
|
37
|
|
|
38
|
+import org.webrtc.DefaultVideoDecoderFactory;
|
|
39
|
+import org.webrtc.EglBase;
|
37
|
40
|
import org.webrtc.SoftwareVideoDecoderFactory;
|
38
|
41
|
import org.webrtc.SoftwareVideoEncoderFactory;
|
39
|
42
|
import org.webrtc.VideoDecoderFactory;
|
|
@@ -84,10 +87,19 @@ class ReactInstanceManagerHolder {
|
84
|
87
|
|
85
|
88
|
AudioDeviceModule adm = JavaAudioDeviceModule.builder(reactContext)
|
86
|
89
|
.createAudioDeviceModule();
|
87
|
|
- VideoDecoderFactory videoDecoderFactory = new SoftwareVideoDecoderFactory();
|
88
|
|
- VideoEncoderFactory videoEncoderFactory = new SoftwareVideoEncoderFactory();
|
89
|
|
-
|
90
|
90
|
options.setAudioDeviceModule(adm);
|
|
91
|
+
|
|
92
|
+ VideoEncoderFactory videoEncoderFactory = new SoftwareVideoEncoderFactory();
|
|
93
|
+ VideoDecoderFactory videoDecoderFactory;
|
|
94
|
+ // Initialize EGL context required for HW acceleration. We are only going to use it for
|
|
95
|
+ // decoding.
|
|
96
|
+ EglBase.Context eglContext = EglUtils.getRootEglBaseContext();
|
|
97
|
+ if (eglContext == null) {
|
|
98
|
+ // Fallback to the software decoder.
|
|
99
|
+ videoDecoderFactory = new SoftwareVideoDecoderFactory();
|
|
100
|
+ } else {
|
|
101
|
+ videoDecoderFactory = new DefaultVideoDecoderFactory(eglContext);
|
|
102
|
+ }
|
91
|
103
|
options.setVideoDecoderFactory(videoDecoderFactory);
|
92
|
104
|
options.setVideoEncoderFactory(videoEncoderFactory);
|
93
|
105
|
|