feat(webcams): preserve floor holder's original camera profile
This commit is contained in:
parent
f76475f77e
commit
67ec798758
@ -251,14 +251,23 @@ class VideoProvider extends Component {
|
||||
this.setState({ socketOpen: true });
|
||||
}
|
||||
|
||||
updateThreshold(numberOfPublishers) {
|
||||
findAllPrivilegedStreams () {
|
||||
const { streams } = this.props;
|
||||
// Privileged streams are: floor holders
|
||||
return streams.filter(stream => stream.floor);
|
||||
}
|
||||
|
||||
updateQualityThresholds(numberOfPublishers) {
|
||||
const { threshold, profile } = VideoService.getThreshold(numberOfPublishers);
|
||||
if (profile) {
|
||||
const publishers = Object.values(this.webRtcPeers)
|
||||
const privilegedStreams = this.findAllPrivilegedStreams();
|
||||
Object.values(this.webRtcPeers)
|
||||
.filter(peer => peer.isPublisher)
|
||||
.forEach((peer) => {
|
||||
// 0 means no threshold in place. Reapply original one if needed
|
||||
const profileToApply = (threshold === 0) ? peer.originalProfileId : profile;
|
||||
// 1) Threshold 0 means original profile/inactive constraint
|
||||
// 2) Privileged streams are: floor holders
|
||||
const exempt = threshold === 0 || privilegedStreams.some(vs => vs.stream === peer.stream)
|
||||
const profileToApply = exempt ? peer.originalProfileId : profile;
|
||||
VideoService.applyCameraProfile(peer, profileToApply);
|
||||
});
|
||||
}
|
||||
@ -302,7 +311,7 @@ class VideoProvider extends Component {
|
||||
this.disconnectStreams(streamsToDisconnect);
|
||||
|
||||
if (CAMERA_QUALITY_THRESHOLDS_ENABLED) {
|
||||
this.updateThreshold(this.props.totalNumberOfStreams);
|
||||
this.updateQualityThresholds(this.props.totalNumberOfStreams);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,10 @@ export const sortLocalPresenterAlphabetical = (s1, s2) => {
|
||||
// 1.1.: the sorting function has the same behaviour as a regular .sort callback
|
||||
// 2 - add an entry to SORTING_METHODS, the key being the name to be used
|
||||
// in settings.yml and the value object like the aforementioned
|
||||
const MANDATORY_DATA_TYPES = { userId: 1, stream: 1, name: 1, deviceId: 1, };
|
||||
const MANDATORY_DATA_TYPES = {
|
||||
userId: 1, stream: 1, name: 1, deviceId: 1, floor: 1,
|
||||
};
|
||||
|
||||
const SORTING_METHODS = Object.freeze({
|
||||
// Default
|
||||
LOCAL_ALPHABETICAL: {
|
||||
@ -120,5 +123,6 @@ export const sortVideoStreams = (streams, mode) => {
|
||||
stream: videoStream.stream,
|
||||
userId: videoStream.userId,
|
||||
name: videoStream.name,
|
||||
floor: videoStream.floor,
|
||||
}));
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user