react-native-webrtc 106.0.5 → 106.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +11 -0
- package/LICENSE +2 -1
- package/android/src/main/java/com/oney/WebRTCModule/AbstractVideoCaptureController.java +0 -1
- package/android/src/main/java/com/oney/WebRTCModule/CameraCaptureController.java +7 -15
- package/android/src/main/java/com/oney/WebRTCModule/CameraEventsHandler.java +3 -12
- package/android/src/main/java/com/oney/WebRTCModule/DataChannelWrapper.java +12 -16
- package/android/src/main/java/com/oney/WebRTCModule/DisplayUtils.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/EglUtils.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +29 -43
- package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +123 -116
- package/android/src/main/java/com/oney/WebRTCModule/RTCVideoViewManager.java +60 -61
- package/android/src/main/java/com/oney/WebRTCModule/ReactBridgeUtil.java +1 -2
- package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +11 -13
- package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +116 -119
- package/android/src/main/java/com/oney/WebRTCModule/StringUtils.java +8 -14
- package/android/src/main/java/com/oney/WebRTCModule/ThreadUtils.java +1 -2
- package/android/src/main/java/com/oney/WebRTCModule/TrackCapturerEventsEmitter.java +3 -4
- package/android/src/main/java/com/oney/WebRTCModule/VideoTrackAdapter.java +5 -9
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +335 -350
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModulePackage.java +4 -10
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +74 -98
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/ProcessorProvider.java +10 -9
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoEffectProcessor.java +2 -6
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessorFactoryInterface.java +4 -5
- package/ios/RCTWebRTC/CaptureController.h +2 -9
- package/ios/RCTWebRTC/CaptureController.m +0 -7
- package/ios/RCTWebRTC/DataChannelWrapper.h +9 -13
- package/ios/RCTWebRTC/DataChannelWrapper.m +4 -5
- package/ios/RCTWebRTC/RCTConvert+WebRTC.h +2 -2
- package/ios/RCTWebRTC/RCTConvert+WebRTC.m +166 -171
- package/ios/RCTWebRTC/RTCMediaStreamTrack+React.h +1 -1
- package/ios/RCTWebRTC/RTCMediaStreamTrack+React.m +1 -1
- package/ios/RCTWebRTC/RTCVideoViewManager.h +0 -8
- package/ios/RCTWebRTC/RTCVideoViewManager.m +205 -214
- package/ios/RCTWebRTC/ScreenCaptureController.h +2 -9
- package/ios/RCTWebRTC/ScreenCaptureController.m +10 -16
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.h +0 -7
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +26 -34
- package/ios/RCTWebRTC/ScreenCapturer.h +1 -8
- package/ios/RCTWebRTC/ScreenCapturer.m +56 -55
- package/ios/RCTWebRTC/SerializeUtils.h +16 -16
- package/ios/RCTWebRTC/SerializeUtils.m +98 -99
- package/ios/RCTWebRTC/SocketConnection.h +1 -8
- package/ios/RCTWebRTC/SocketConnection.m +31 -38
- package/ios/RCTWebRTC/TrackCapturerEventsEmitter.h +4 -4
- package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +5 -6
- package/ios/RCTWebRTC/VideoCaptureController.h +6 -7
- package/ios/RCTWebRTC/VideoCaptureController.m +54 -53
- package/ios/RCTWebRTC/WebRTCModule+Permissions.m +14 -13
- package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.h +3 -3
- package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.m +105 -100
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +3 -2
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +196 -226
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.h +7 -14
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +625 -603
- package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +128 -139
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.h +4 -5
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.m +26 -35
- package/ios/RCTWebRTC/WebRTCModule.h +13 -20
- package/ios/RCTWebRTC/WebRTCModule.m +69 -84
- package/ios/RCTWebRTC.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/RTCPeerConnection.js +79 -56
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCRtpEncodingParameters.js +12 -3
- package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpTransceiver.js +1 -1
- package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +79 -56
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCRtpEncodingParameters.js +12 -3
- package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/module/RTCRtpTransceiver.js +1 -1
- package/lib/module/RTCRtpTransceiver.js.map +1 -1
- package/lib/typescript/RTCPeerConnection.d.ts +4 -4
- package/package.json +3 -2
- package/src/RTCPeerConnection.ts +70 -63
- package/src/RTCRtpEncodingParameters.ts +12 -3
- package/src/RTCRtpTransceiver.ts +1 -1
- package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
|
@@ -10,18 +10,12 @@ import java.util.List;
|
|
|
10
10
|
|
|
11
11
|
public class WebRTCModulePackage implements ReactPackage {
|
|
12
12
|
@Override
|
|
13
|
-
public List<NativeModule> createNativeModules(
|
|
14
|
-
|
|
15
|
-
return Arrays.<NativeModule>asList(
|
|
16
|
-
new WebRTCModule(reactContext)
|
|
17
|
-
);
|
|
13
|
+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
14
|
+
return Arrays.<NativeModule>asList(new WebRTCModule(reactContext));
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
@Override
|
|
21
|
-
public List<ViewManager> createViewManagers(
|
|
22
|
-
|
|
23
|
-
return Arrays.<ViewManager>asList(
|
|
24
|
-
new RTCVideoViewManager()
|
|
25
|
-
);
|
|
18
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
19
|
+
return Arrays.<ViewManager>asList(new RTCVideoViewManager());
|
|
26
20
|
}
|
|
27
21
|
}
|
|
@@ -4,19 +4,13 @@ import android.annotation.SuppressLint;
|
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
import android.graphics.Color;
|
|
6
6
|
import android.graphics.Point;
|
|
7
|
-
|
|
8
|
-
import androidx.core.view.ViewCompat;
|
|
9
|
-
|
|
7
|
+
import android.util.Log;
|
|
10
8
|
import android.view.View;
|
|
11
9
|
import android.view.ViewGroup;
|
|
12
|
-
import android.util.Log;
|
|
13
10
|
|
|
14
|
-
import
|
|
11
|
+
import androidx.core.view.ViewCompat;
|
|
15
12
|
|
|
16
|
-
import
|
|
17
|
-
import java.lang.reflect.Method;
|
|
18
|
-
import java.util.List;
|
|
19
|
-
import java.util.Objects;
|
|
13
|
+
import com.facebook.react.bridge.ReactContext;
|
|
20
14
|
|
|
21
15
|
import org.webrtc.EglBase;
|
|
22
16
|
import org.webrtc.Logging;
|
|
@@ -27,6 +21,11 @@ import org.webrtc.RendererCommon.ScalingType;
|
|
|
27
21
|
import org.webrtc.SurfaceViewRenderer;
|
|
28
22
|
import org.webrtc.VideoTrack;
|
|
29
23
|
|
|
24
|
+
import java.lang.reflect.InvocationTargetException;
|
|
25
|
+
import java.lang.reflect.Method;
|
|
26
|
+
import java.util.List;
|
|
27
|
+
import java.util.Objects;
|
|
28
|
+
|
|
30
29
|
public class WebRTCView extends ViewGroup {
|
|
31
30
|
/**
|
|
32
31
|
* The scaling type to be utilized by default.
|
|
@@ -43,8 +42,7 @@ public class WebRTCView extends ViewGroup {
|
|
|
43
42
|
* pillarboxed. Areas of the element's playback area that do not contain the
|
|
44
43
|
* video represent nothing.
|
|
45
44
|
*/
|
|
46
|
-
private static final ScalingType DEFAULT_SCALING_TYPE
|
|
47
|
-
= ScalingType.SCALE_ASPECT_FIT;
|
|
45
|
+
private static final ScalingType DEFAULT_SCALING_TYPE = ScalingType.SCALE_ASPECT_FIT;
|
|
48
46
|
|
|
49
47
|
private static final String TAG = WebRTCModule.TAG;
|
|
50
48
|
|
|
@@ -97,22 +95,17 @@ public class WebRTCView extends ViewGroup {
|
|
|
97
95
|
* The {@code RendererEvents} which listens to rendering events reported by
|
|
98
96
|
* {@link #surfaceViewRenderer}.
|
|
99
97
|
*/
|
|
100
|
-
private final RendererEvents rendererEvents
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
98
|
+
private final RendererEvents rendererEvents = new RendererEvents() {
|
|
99
|
+
@Override
|
|
100
|
+
public void onFirstFrameRendered() {
|
|
101
|
+
WebRTCView.this.onFirstFrameRendered();
|
|
102
|
+
}
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
videoWidth, videoHeight,
|
|
113
|
-
rotation);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
104
|
+
@Override
|
|
105
|
+
public void onFrameResolutionChanged(int videoWidth, int videoHeight, int rotation) {
|
|
106
|
+
WebRTCView.this.onFrameResolutionChanged(videoWidth, videoHeight, rotation);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
116
109
|
|
|
117
110
|
/**
|
|
118
111
|
* The {@code Runnable} representation of
|
|
@@ -120,13 +113,12 @@ public class WebRTCView extends ViewGroup {
|
|
|
120
113
|
* to allow the use of the latter with {@link #post(Runnable)} without
|
|
121
114
|
* initializing new instances on every (method) call.
|
|
122
115
|
*/
|
|
123
|
-
private final Runnable requestSurfaceViewRendererLayoutRunnable
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
};
|
|
116
|
+
private final Runnable requestSurfaceViewRendererLayoutRunnable = new Runnable() {
|
|
117
|
+
@Override
|
|
118
|
+
public void run() {
|
|
119
|
+
requestSurfaceViewRendererLayout();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
130
122
|
|
|
131
123
|
/**
|
|
132
124
|
* The scaling type this {@code WebRTCView} is to apply to the video
|
|
@@ -176,8 +168,7 @@ public class WebRTCView extends ViewGroup {
|
|
|
176
168
|
|
|
177
169
|
if (streamURL != null) {
|
|
178
170
|
ReactContext reactContext = (ReactContext) getContext();
|
|
179
|
-
WebRTCModule module
|
|
180
|
-
= reactContext.getNativeModule(WebRTCModule.class);
|
|
171
|
+
WebRTCModule module = reactContext.getNativeModule(WebRTCModule.class);
|
|
181
172
|
MediaStream stream = module.getStreamForReactTag(streamURL);
|
|
182
173
|
|
|
183
174
|
if (stream != null) {
|
|
@@ -245,9 +236,7 @@ public class WebRTCView extends ViewGroup {
|
|
|
245
236
|
* @param videoHeight The new height of the rendered video frame.
|
|
246
237
|
* @param rotation The new rotation of the rendered video frame.
|
|
247
238
|
*/
|
|
248
|
-
private void onFrameResolutionChanged(
|
|
249
|
-
int videoWidth, int videoHeight,
|
|
250
|
-
int rotation) {
|
|
239
|
+
private void onFrameResolutionChanged(int videoWidth, int videoHeight, int rotation) {
|
|
251
240
|
boolean changed = false;
|
|
252
241
|
|
|
253
242
|
synchronized (layoutSyncRoot) {
|
|
@@ -292,41 +281,36 @@ public class WebRTCView extends ViewGroup {
|
|
|
292
281
|
}
|
|
293
282
|
|
|
294
283
|
switch (scalingType) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
=
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
t = (height - frameDisplaySize.y) / 2;
|
|
326
|
-
r = l + frameDisplaySize.x;
|
|
327
|
-
b = t + frameDisplaySize.y;
|
|
328
|
-
}
|
|
329
|
-
break;
|
|
284
|
+
case SCALE_ASPECT_FILL:
|
|
285
|
+
// Fill this ViewGroup with surfaceViewRenderer and the latter
|
|
286
|
+
// will take care of filling itself with the video similarly to
|
|
287
|
+
// the cover value the CSS property object-fit.
|
|
288
|
+
r = width;
|
|
289
|
+
l = 0;
|
|
290
|
+
b = height;
|
|
291
|
+
t = 0;
|
|
292
|
+
break;
|
|
293
|
+
case SCALE_ASPECT_FIT:
|
|
294
|
+
default:
|
|
295
|
+
// Lay surfaceViewRenderer out inside this ViewGroup in accord
|
|
296
|
+
// with the contain value of the CSS property object-fit.
|
|
297
|
+
// SurfaceViewRenderer will fill itself with the video similarly
|
|
298
|
+
// to the cover or contain value of the CSS property object-fit
|
|
299
|
+
// (which will not matter, eventually).
|
|
300
|
+
if (frameHeight == 0 || frameWidth == 0) {
|
|
301
|
+
l = t = r = b = 0;
|
|
302
|
+
} else {
|
|
303
|
+
float frameAspectRatio = (frameRotation % 180 == 0) ? frameWidth / (float) frameHeight
|
|
304
|
+
: frameHeight / (float) frameWidth;
|
|
305
|
+
Point frameDisplaySize =
|
|
306
|
+
RendererCommon.getDisplaySize(scalingType, frameAspectRatio, width, height);
|
|
307
|
+
|
|
308
|
+
l = (width - frameDisplaySize.x) / 2;
|
|
309
|
+
t = (height - frameDisplaySize.y) / 2;
|
|
310
|
+
r = l + frameDisplaySize.x;
|
|
311
|
+
b = t + frameDisplaySize.y;
|
|
312
|
+
}
|
|
313
|
+
break;
|
|
330
314
|
}
|
|
331
315
|
}
|
|
332
316
|
surfaceViewRenderer.layout(l, t, r, b);
|
|
@@ -340,9 +324,7 @@ public class WebRTCView extends ViewGroup {
|
|
|
340
324
|
if (rendererAttached) {
|
|
341
325
|
if (videoTrack != null) {
|
|
342
326
|
try {
|
|
343
|
-
ThreadUtils.submitToExecutor(() -> {
|
|
344
|
-
videoTrack.removeSink(surfaceViewRenderer);
|
|
345
|
-
}).get();
|
|
327
|
+
ThreadUtils.submitToExecutor(() -> { videoTrack.removeSink(surfaceViewRenderer); }).get();
|
|
346
328
|
} catch (Throwable tr) {
|
|
347
329
|
// XXX If WebRTCModule#mediaStreamTrackRelease has already been
|
|
348
330
|
// invoked on videoTrack, then it is no longer safe to call removeSink
|
|
@@ -379,8 +361,7 @@ public class WebRTCView extends ViewGroup {
|
|
|
379
361
|
// rotation change. The following will suffice.
|
|
380
362
|
if (!ViewCompat.isInLayout(this)) {
|
|
381
363
|
onLayout(
|
|
382
|
-
|
|
383
|
-
getLeft(), getTop(), getRight(), getBottom());
|
|
364
|
+
/* changed */ false, getLeft(), getTop(), getRight(), getBottom());
|
|
384
365
|
}
|
|
385
366
|
}
|
|
386
367
|
|
|
@@ -413,10 +394,8 @@ public class WebRTCView extends ViewGroup {
|
|
|
413
394
|
* {@code WebRTCView} i.e. {@code RTCView}.
|
|
414
395
|
*/
|
|
415
396
|
public void setObjectFit(String objectFit) {
|
|
416
|
-
ScalingType scalingType
|
|
417
|
-
|
|
418
|
-
? ScalingType.SCALE_ASPECT_FILL
|
|
419
|
-
: ScalingType.SCALE_ASPECT_FIT;
|
|
397
|
+
ScalingType scalingType =
|
|
398
|
+
"cover".equals(objectFit) ? ScalingType.SCALE_ASPECT_FILL : ScalingType.SCALE_ASPECT_FIT;
|
|
420
399
|
|
|
421
400
|
setScalingType(scalingType);
|
|
422
401
|
}
|
|
@@ -511,15 +490,15 @@ public class WebRTCView extends ViewGroup {
|
|
|
511
490
|
*/
|
|
512
491
|
public void setZOrder(int zOrder) {
|
|
513
492
|
switch (zOrder) {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
493
|
+
case 0:
|
|
494
|
+
surfaceViewRenderer.setZOrderMediaOverlay(false);
|
|
495
|
+
break;
|
|
496
|
+
case 1:
|
|
497
|
+
surfaceViewRenderer.setZOrderMediaOverlay(true);
|
|
498
|
+
break;
|
|
499
|
+
case 2:
|
|
500
|
+
surfaceViewRenderer.setZOrderOnTop(true);
|
|
501
|
+
break;
|
|
523
502
|
}
|
|
524
503
|
}
|
|
525
504
|
|
|
@@ -528,9 +507,7 @@ public class WebRTCView extends ViewGroup {
|
|
|
528
507
|
* all preconditions for the start of rendering are met.
|
|
529
508
|
*/
|
|
530
509
|
private void tryAddRendererToVideoTrack() {
|
|
531
|
-
if (!rendererAttached
|
|
532
|
-
&& videoTrack != null
|
|
533
|
-
&& ViewCompat.isAttachedToWindow(this)) {
|
|
510
|
+
if (!rendererAttached && videoTrack != null && ViewCompat.isAttachedToWindow(this)) {
|
|
534
511
|
EglBase.Context sharedContext = EglUtils.getRootEglBaseContext();
|
|
535
512
|
|
|
536
513
|
if (sharedContext == null) {
|
|
@@ -544,14 +521,13 @@ public class WebRTCView extends ViewGroup {
|
|
|
544
521
|
surfaceViewRendererInstances++;
|
|
545
522
|
surfaceViewRenderer.init(sharedContext, rendererEvents);
|
|
546
523
|
} catch (Exception e) {
|
|
547
|
-
Logging.e(
|
|
524
|
+
Logging.e(
|
|
525
|
+
TAG, "Failed to initialize surfaceViewRenderer on instance " + surfaceViewRendererInstances, e);
|
|
548
526
|
surfaceViewRendererInstances--;
|
|
549
527
|
}
|
|
550
528
|
|
|
551
529
|
try {
|
|
552
|
-
ThreadUtils.submitToExecutor(() -> {
|
|
553
|
-
videoTrack.addSink(surfaceViewRenderer);
|
|
554
|
-
}).get();
|
|
530
|
+
ThreadUtils.submitToExecutor(() -> { videoTrack.addSink(surfaceViewRenderer); }).get();
|
|
555
531
|
} catch (Throwable tr) {
|
|
556
532
|
// XXX If WebRTCModule#mediaStreamTrackRelease has already been
|
|
557
533
|
// invoked on videoTrack, then it is no longer safe to call addSink
|
|
@@ -8,29 +8,30 @@ import java.util.Map;
|
|
|
8
8
|
* get, add and remove functionality.
|
|
9
9
|
*/
|
|
10
10
|
public class ProcessorProvider {
|
|
11
|
-
private static Map<String, VideoFrameProcessorFactoryInterface> methodMap =
|
|
12
|
-
|
|
11
|
+
private static Map<String, VideoFrameProcessorFactoryInterface> methodMap =
|
|
12
|
+
new HashMap<String, VideoFrameProcessorFactoryInterface>();
|
|
13
|
+
|
|
13
14
|
public static VideoFrameProcessor getProcessor(String name) {
|
|
14
15
|
if (methodMap.containsKey(name)) {
|
|
15
16
|
return methodMap.get(name).build();
|
|
16
|
-
} else{
|
|
17
|
+
} else {
|
|
17
18
|
return null;
|
|
18
|
-
}
|
|
19
|
+
}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
public static void addProcessor(
|
|
22
|
-
VideoFrameProcessorFactoryInterface videoFrameProcessorFactoryInterface) {
|
|
22
|
+
public static void addProcessor(
|
|
23
|
+
String name, VideoFrameProcessorFactoryInterface videoFrameProcessorFactoryInterface) {
|
|
23
24
|
if (name != null && videoFrameProcessorFactoryInterface != null) {
|
|
24
25
|
methodMap.put(name, videoFrameProcessorFactoryInterface);
|
|
25
|
-
} else{
|
|
26
|
-
|
|
26
|
+
} else {
|
|
27
|
+
throw new NullPointerException("Name or VideoFrameProcessorFactry can not be null");
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
public static void removeProcessor(String name) {
|
|
31
32
|
if (name != null && methodMap.containsKey(name)) {
|
|
32
33
|
methodMap.remove(name);
|
|
33
|
-
} else{
|
|
34
|
+
} else {
|
|
34
35
|
throw new RuntimeException("VideoFrameProcessorFactry with " + name + " does not exist");
|
|
35
36
|
}
|
|
36
37
|
}
|
|
@@ -20,14 +20,10 @@ public class VideoEffectProcessor implements VideoProcessor {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@Override
|
|
23
|
-
public void onCapturerStarted(boolean success) {
|
|
24
|
-
|
|
25
|
-
}
|
|
23
|
+
public void onCapturerStarted(boolean success) {}
|
|
26
24
|
|
|
27
25
|
@Override
|
|
28
|
-
public void onCapturerStopped() {
|
|
29
|
-
|
|
30
|
-
}
|
|
26
|
+
public void onCapturerStopped() {}
|
|
31
27
|
|
|
32
28
|
@Override
|
|
33
29
|
public void setSink(VideoSink sink) {
|
|
@@ -4,10 +4,9 @@ package com.oney.WebRTCModule.videoEffects;
|
|
|
4
4
|
* Factory for creating VideoFrameProcessor instances.
|
|
5
5
|
*/
|
|
6
6
|
public interface VideoFrameProcessorFactoryInterface {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
7
|
+
/**
|
|
8
|
+
* Dynamically allocates a VideoFrameProcessor instance and returns a pointer to it.
|
|
9
|
+
* The caller takes ownership of the object.
|
|
10
|
+
*/
|
|
12
11
|
public VideoFrameProcessor build();
|
|
13
12
|
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CaptureController.h
|
|
3
|
-
// RCTWebRTC
|
|
4
|
-
//
|
|
5
|
-
// Created by Alex-Dan Bumbu on 11/01/2021.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
1
|
#import <Foundation/Foundation.h>
|
|
9
2
|
#import "CapturerEventsDelegate.h"
|
|
10
3
|
|
|
11
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
12
5
|
|
|
13
|
-
@interface CaptureController: NSObject
|
|
6
|
+
@interface CaptureController : NSObject
|
|
14
7
|
|
|
15
|
-
@property
|
|
8
|
+
@property(nonatomic, strong) id<CapturerEventsDelegate> eventsDelegate;
|
|
16
9
|
|
|
17
10
|
- (void)startCapture;
|
|
18
11
|
- (void)stopCapture;
|
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <WebRTC/RTCDataChannel.h>
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
6
5
|
|
|
7
6
|
@class DataChannelWrapper;
|
|
8
7
|
|
|
9
|
-
@protocol DataChannelWrapperDelegate
|
|
8
|
+
@protocol DataChannelWrapperDelegate<NSObject>
|
|
10
9
|
|
|
11
10
|
- (void)dataChannelDidChangeState:(DataChannelWrapper *)dataChannelWrapper;
|
|
12
|
-
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper
|
|
13
|
-
|
|
14
|
-
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper
|
|
15
|
-
didChangeBufferedAmount:(uint64_t)amount;
|
|
11
|
+
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer;
|
|
12
|
+
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper didChangeBufferedAmount:(uint64_t)amount;
|
|
16
13
|
|
|
17
14
|
@end
|
|
18
15
|
|
|
19
|
-
@interface DataChannelWrapper: NSObject
|
|
16
|
+
@interface DataChannelWrapper : NSObject
|
|
20
17
|
|
|
21
|
-
- (instancetype)initWithChannel:(RTCDataChannel *)
|
|
22
|
-
reactTag:(NSString *)tag;
|
|
18
|
+
- (instancetype)initWithChannel:(RTCDataChannel *)channel reactTag:(NSString *)tag;
|
|
23
19
|
|
|
24
|
-
@property
|
|
25
|
-
@property
|
|
26
|
-
@property
|
|
27
|
-
@property
|
|
20
|
+
@property(nonatomic, nonnull, copy) NSNumber *pcId;
|
|
21
|
+
@property(nonatomic, nonnull, readonly) RTCDataChannel *channel;
|
|
22
|
+
@property(nonatomic, nonnull, readonly) NSString *reactTag;
|
|
23
|
+
@property(nonatomic, nullable, weak) id<DataChannelWrapperDelegate> delegate;
|
|
28
24
|
|
|
29
25
|
@end
|
|
30
26
|
|
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
|
|
4
4
|
#import <WebRTC/RTCDataChannel.h>
|
|
5
5
|
|
|
6
|
-
@interface DataChannelWrapper ()
|
|
6
|
+
@interface DataChannelWrapper ()<RTCDataChannelDelegate>
|
|
7
7
|
@end
|
|
8
8
|
|
|
9
9
|
@implementation DataChannelWrapper
|
|
10
10
|
|
|
11
|
-
- (instancetype)initWithChannel:(RTCDataChannel *)
|
|
12
|
-
reactTag:(NSString *)tag {
|
|
11
|
+
- (instancetype)initWithChannel:(RTCDataChannel *)channel reactTag:(NSString *)tag {
|
|
13
12
|
self = [super init];
|
|
14
13
|
if (self) {
|
|
15
14
|
_channel = channel;
|
|
16
15
|
_reactTag = tag;
|
|
17
|
-
|
|
16
|
+
|
|
18
17
|
// Set ourselves as the deletagate.
|
|
19
18
|
_channel.delegate = self;
|
|
20
19
|
}
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
return self;
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#import <React/RCTConvert.h>
|
|
2
|
-
#import <WebRTC/RTCDataChannelConfiguration.h>
|
|
3
2
|
#import <WebRTC/RTCConfiguration.h>
|
|
3
|
+
#import <WebRTC/RTCDataChannelConfiguration.h>
|
|
4
|
+
#import <WebRTC/RTCIceCandidate.h>
|
|
4
5
|
#import <WebRTC/RTCIceServer.h>
|
|
5
6
|
#import <WebRTC/RTCSessionDescription.h>
|
|
6
|
-
#import <WebRTC/RTCIceCandidate.h>
|
|
7
7
|
|
|
8
8
|
@interface RCTConvert (WebRTC)
|
|
9
9
|
|