Przeglądaj źródła

fix(testing): Fixes for multi-stream torture tests to work.

factor2
Jaya Allamsetty 3 lat temu
rodzic
commit
7393c20ed8

+ 37
- 10
react/features/base/testing/functions.js Wyświetl plik

@@ -1,7 +1,9 @@
1 1
 // @flow
2 2
 
3
-import { MEDIA_TYPE } from '../media';
4
-import { getTrackByMediaTypeAndParticipant } from '../tracks';
3
+import { getMultipleVideoSupportFeatureFlag } from '../config';
4
+import { MEDIA_TYPE, VIDEO_TYPE } from '../media';
5
+import { getParticipantById } from '../participants';
6
+import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../tracks';
5 7
 
6 8
 /**
7 9
  * Indicates whether the test mode is enabled. When it's enabled
@@ -22,10 +24,17 @@ export function isTestModeEnabled(state: Object): boolean {
22 24
  *
23 25
  * @param {Store} store - The redux store.
24 26
  * @param {string} id - The participant ID for the remote video.
25
- * @returns {MEDIA_TYPE}
27
+ * @returns {VIDEO_TYPE}
26 28
  */
27
-export function getRemoteVideoType({ getState }: Object, id: String): boolean {
28
-    return getTrackByMediaTypeAndParticipant(getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, id)?.videoType;
29
+export function getRemoteVideoType({ getState }: Object, id: String): VIDEO_TYPE {
30
+    const state = getState();
31
+    const participant = getParticipantById(state, id);
32
+
33
+    if (getMultipleVideoSupportFeatureFlag(state) && participant?.isVirtualScreenshareParticipant) {
34
+        return VIDEO_TYPE.DESKTOP;
35
+    }
36
+
37
+    return getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id)?.videoType;
29 38
 }
30 39
 
31 40
 /**
@@ -35,10 +44,19 @@ export function getRemoteVideoType({ getState }: Object, id: String): boolean {
35 44
  * @returns {boolean}
36 45
  */
37 46
 export function isLargeVideoReceived({ getState }: Object): boolean {
38
-    const largeVideoParticipantId = getState()['features/large-video'].participantId;
39
-    const videoTrack = getTrackByMediaTypeAndParticipant(
40
-        getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, largeVideoParticipantId);
41
-    const lastMediaEvent = getState()['features/large-video']?.lastMediaEvent;
47
+    const state = getState();
48
+    const largeVideoParticipantId = state['features/large-video'].participantId;
49
+    const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId);
50
+    const tracks = state['features/base/tracks'];
51
+    let videoTrack;
52
+
53
+    if (getMultipleVideoSupportFeatureFlag(state) && largeVideoParticipant?.isVirtualScreenshareParticipant) {
54
+        videoTrack = getVirtualScreenshareParticipantTrack(tracks, largeVideoParticipantId);
55
+    } else {
56
+        videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, largeVideoParticipantId);
57
+    }
58
+
59
+    const lastMediaEvent = state['features/large-video']?.lastMediaEvent;
42 60
 
43 61
     return videoTrack && !videoTrack.muted && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough');
44 62
 }
@@ -51,7 +69,16 @@ export function isLargeVideoReceived({ getState }: Object): boolean {
51 69
  * @returns {boolean}
52 70
  */
53 71
 export function isRemoteVideoReceived({ getState }: Object, id: String): boolean {
54
-    const videoTrack = getTrackByMediaTypeAndParticipant(getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
72
+    const state = getState();
73
+    const tracks = state['features/base/tracks'];
74
+    const participant = getParticipantById(state, id);
75
+    let videoTrack;
76
+
77
+    if (getMultipleVideoSupportFeatureFlag(state) && participant?.isVirtualScreenshareParticipant) {
78
+        videoTrack = getVirtualScreenshareParticipantTrack(tracks, id);
79
+    } else {
80
+        videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, id);
81
+    }
55 82
     const lastMediaEvent = videoTrack?.lastMediaEvent;
56 83
 
57 84
     return videoTrack && !videoTrack.muted && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough');

+ 18
- 9
react/features/filmstrip/components/web/Thumbnail.tsx Wyświetl plik

@@ -1106,13 +1106,14 @@ class Thumbnail extends Component<Props, State> {
1106 1106
      * @returns {ReactElement}
1107 1107
      */
1108 1108
     render() {
1109
-        const { _participant, _isVirtualScreenshareParticipant } = this.props;
1109
+        const { _participant, _isTestModeEnabled, _isVirtualScreenshareParticipant } = this.props;
1110
+        const videoEventListeners: any = {};
1110 1111
 
1111 1112
         if (!_participant) {
1112 1113
             return null;
1113 1114
         }
1114 1115
 
1115
-        const { isFakeParticipant, local } = _participant;
1116
+        const { isFakeParticipant, isLocalScreenShare, local } = _participant;
1116 1117
 
1117 1118
         if (local) {
1118 1119
             return this._renderParticipant(true);
@@ -1126,12 +1127,19 @@ class Thumbnail extends Component<Props, State> {
1126 1127
             const { isHovered } = this.state;
1127 1128
             const { _videoTrack, _isMobile, classes, _thumbnailType } = this.props;
1128 1129
 
1130
+            if (_isTestModeEnabled) {
1131
+                VIDEO_TEST_EVENTS.forEach(attribute => {
1132
+                    videoEventListeners[attribute] = this._onTestingEvent;
1133
+                });
1134
+                videoEventListeners.onCanPlay = this._onCanPlay;
1135
+            }
1136
+
1129 1137
             return (
1130 1138
                 <VirtualScreenshareParticipant
1131 1139
                     classes = { classes }
1132 1140
                     containerClassName = { this._getContainerClassName() }
1133 1141
                     isHovered = { isHovered }
1134
-                    isLocal = { local }
1142
+                    isLocal = { isLocalScreenShare }
1135 1143
                     isMobile = { _isMobile }
1136 1144
                     onClick = { this._onClick }
1137 1145
                     onMouseEnter = { this._onMouseEnter }
@@ -1165,12 +1173,13 @@ function _mapStateToProps(state: IState, ownProps: any): Object {
1165 1173
     const participant = getParticipantByIdOrUndefined(state, participantID);
1166 1174
     const id = participant?.id;
1167 1175
     const isLocal = participant?.local ?? true;
1168
-    const tracks = state['features/base/tracks'];
1176
+    const multipleVideoSupportEnabled = getMultipleVideoSupportFeatureFlag(state);
1169 1177
     const sourceNameSignalingEnabled = getSourceNameSignalingFeatureFlag(state);
1178
+    const tracks = state['features/base/tracks'];
1170 1179
 
1171 1180
     let _videoTrack;
1172 1181
 
1173
-    if (sourceNameSignalingEnabled && participant?.isVirtualScreenshareParticipant) {
1182
+    if (multipleVideoSupportEnabled && participant?.isVirtualScreenshareParticipant) {
1174 1183
         _videoTrack = getVirtualScreenshareParticipantTrack(tracks, id);
1175 1184
     } else {
1176 1185
         _videoTrack = isLocal
@@ -1293,19 +1302,19 @@ function _mapStateToProps(state: IState, ownProps: any): Object {
1293 1302
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1294 1303
         _isTestModeEnabled: isTestModeEnabled(state),
1295 1304
         _isVideoPlayable: id && isVideoPlayable(state, id),
1296
-        _isVirtualScreenshareParticipant: sourceNameSignalingEnabled && participant?.isVirtualScreenshareParticipant,
1305
+        _isVirtualScreenshareParticipant: multipleVideoSupportEnabled && participant?.isVirtualScreenshareParticipant,
1297 1306
         _localFlipX: Boolean(localFlipX),
1298
-        _multipleVideoSupport: getMultipleVideoSupportFeatureFlag(state),
1307
+        _multipleVideoSupport: multipleVideoSupportEnabled,
1299 1308
         _participant: participant,
1300 1309
         _raisedHand: hasRaisedHand(participant),
1310
+        _sourceNameSignalingEnabled: sourceNameSignalingEnabled,
1301 1311
         _stageFilmstripLayout: isStageFilmstripAvailable(state),
1302 1312
         _stageParticipantsVisible: _currentLayout === LAYOUTS.STAGE_FILMSTRIP_VIEW,
1303 1313
         _thumbnailType: tileType,
1304 1314
         _videoObjectPosition: getVideoObjectPosition(state, participant?.id),
1305 1315
         _videoTrack,
1306 1316
         ...size,
1307
-        _gifSrc: mode === 'chat' ? null : gifSrc,
1308
-        _sourceNameSignalingEnabled: sourceNameSignalingEnabled
1317
+        _gifSrc: mode === 'chat' ? null : gifSrc
1309 1318
     };
1310 1319
 }
1311 1320
 

Ładowanie…
Anuluj
Zapisz