|
|
@@ -6,6 +6,7 @@ import FeatureFlags from '../flags/FeatureFlags';
|
|
6
|
6
|
import MediaSessionEvents from '../xmpp/MediaSessionEvents';
|
|
7
|
7
|
|
|
8
|
8
|
const logger = getLogger(__filename);
|
|
|
9
|
+const MAX_LOCAL_RESOLUTION = 2160;
|
|
9
|
10
|
|
|
10
|
11
|
/**
|
|
11
|
12
|
* The class manages send video constraints across media sessions({@link JingleSessionPC}) which belong to
|
|
|
@@ -24,6 +25,7 @@ export default class SendVideoController {
|
|
24
|
25
|
*/
|
|
25
|
26
|
constructor(conference, rtc) {
|
|
26
|
27
|
this._conference = conference;
|
|
|
28
|
+ this._preferredSendMaxFrameHeight = MAX_LOCAL_RESOLUTION;
|
|
27
|
29
|
this._rtc = rtc;
|
|
28
|
30
|
|
|
29
|
31
|
/**
|
|
|
@@ -37,12 +39,30 @@ export default class SendVideoController {
|
|
37
|
39
|
session => this._onMediaSessionStarted(session));
|
|
38
|
40
|
this._conference.on(
|
|
39
|
41
|
JitsiConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED,
|
|
40
|
|
- () => this._propagateSendMaxFrameHeight());
|
|
|
42
|
+ () => this._configureConstraintsForLocalSources());
|
|
41
|
43
|
this._rtc.on(
|
|
42
|
44
|
RTCEvents.SENDER_VIDEO_CONSTRAINTS_CHANGED,
|
|
43
|
45
|
videoConstraints => this._onSenderConstraintsReceived(videoConstraints));
|
|
44
|
46
|
}
|
|
45
|
47
|
|
|
|
48
|
+ /**
|
|
|
49
|
+ * Configures the video encodings on the local sources when a media connection is established or becomes active.
|
|
|
50
|
+ *
|
|
|
51
|
+ * @returns {Promise<void[]>}
|
|
|
52
|
+ * @private
|
|
|
53
|
+ */
|
|
|
54
|
+ _configureConstraintsForLocalSources() {
|
|
|
55
|
+ if (FeatureFlags.isSourceNameSignalingEnabled()) {
|
|
|
56
|
+ for (const track of this._rtc.getLocalVideoTracks()) {
|
|
|
57
|
+ const sourceName = track.getSourceName();
|
|
|
58
|
+
|
|
|
59
|
+ sourceName && this._propagateSendMaxFrameHeight(sourceName);
|
|
|
60
|
+ }
|
|
|
61
|
+ } else {
|
|
|
62
|
+ this._propagateSendMaxFrameHeight();
|
|
|
63
|
+ }
|
|
|
64
|
+ }
|
|
|
65
|
+
|
|
46
|
66
|
/**
|
|
47
|
67
|
* Handles the {@link JitsiConferenceEvents.MEDIA_SESSION_STARTED}, that is when the conference creates new media
|
|
48
|
68
|
* session. It doesn't mean it's already active though. For example the JVB connection may be created after
|
|
|
@@ -56,7 +76,7 @@ export default class SendVideoController {
|
|
56
|
76
|
MediaSessionEvents.REMOTE_VIDEO_CONSTRAINTS_CHANGED,
|
|
57
|
77
|
session => {
|
|
58
|
78
|
if (session === this._conference.getActiveMediaSession()) {
|
|
59
|
|
- this._propagateSendMaxFrameHeight();
|
|
|
79
|
+ this._configureConstraintsForLocalSources();
|
|
60
|
80
|
}
|
|
61
|
81
|
});
|
|
62
|
82
|
}
|
|
|
@@ -65,6 +85,8 @@ export default class SendVideoController {
|
|
65
|
85
|
* Propagates the video constraints if they have changed.
|
|
66
|
86
|
*
|
|
67
|
87
|
* @param {Object} videoConstraints - The sender video constraints received from the bridge.
|
|
|
88
|
+ * @returns {Promise<void[]>}
|
|
|
89
|
+ * @private
|
|
68
|
90
|
*/
|
|
69
|
91
|
_onSenderConstraintsReceived(videoConstraints) {
|
|
70
|
92
|
if (FeatureFlags.isSourceNameSignalingEnabled()) {
|
|
|
@@ -88,7 +110,7 @@ export default class SendVideoController {
|
|
88
|
110
|
}
|
|
89
|
111
|
|
|
90
|
112
|
/**
|
|
91
|
|
- * Figures out the send video constraint as specified by {@link selectSendMaxFrameHeight} and sets it on all media
|
|
|
113
|
+ * Figures out the send video constraint as specified by {@link _selectSendMaxFrameHeight} and sets it on all media
|
|
92
|
114
|
* sessions for the reasons mentioned in this class description.
|
|
93
|
115
|
*
|
|
94
|
116
|
* @param {string} sourceName - The source for which sender constraints have changed.
|
|
|
@@ -99,7 +121,7 @@ export default class SendVideoController {
|
|
99
|
121
|
if (FeatureFlags.isSourceNameSignalingEnabled() && !sourceName) {
|
|
100
|
122
|
throw new Error('sourceName missing for calculating the sendMaxHeight for video tracks');
|
|
101
|
123
|
}
|
|
102
|
|
- const sendMaxFrameHeight = this.selectSendMaxFrameHeight(sourceName);
|
|
|
124
|
+ const sendMaxFrameHeight = this._selectSendMaxFrameHeight(sourceName);
|
|
103
|
125
|
const promises = [];
|
|
104
|
126
|
|
|
105
|
127
|
if (sendMaxFrameHeight >= 0) {
|
|
|
@@ -117,8 +139,9 @@ export default class SendVideoController {
|
|
117
|
139
|
*
|
|
118
|
140
|
* @param {string} sourceName - The source for which sender constraints have changed.
|
|
119
|
141
|
* @returns {number|undefined}
|
|
|
142
|
+ * @private
|
|
120
|
143
|
*/
|
|
121
|
|
- selectSendMaxFrameHeight(sourceName = null) {
|
|
|
144
|
+ _selectSendMaxFrameHeight(sourceName = null) {
|
|
122
|
145
|
if (FeatureFlags.isSourceNameSignalingEnabled() && !sourceName) {
|
|
123
|
146
|
throw new Error('sourceName missing for calculating the sendMaxHeight for video tracks');
|
|
124
|
147
|
}
|