Skip to content

Commit 2687f23

Browse files
shi-suShi Su
and
Shi Su
authored
Update uplink policy at codec degradation triggered by encoding health monitor (#2942)
--------- Co-authored-by: Shi Su <[email protected]>
1 parent 5987ecd commit 2687f23

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
### Fixed
1717

18+
- Update uplink policy at codec degradation triggered by encoding health monitor.
19+
1820
## [3.23.0] - 2024-05-14
1921

2022
### Added

src/task/MonitorTask.ts

+8
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ export default class MonitorTask
493493
this.context.meetingSupportedVideoSendCodecPreferences[0]
494494
);
495495
this.context.meetingSupportedVideoSendCodecPreferences = newMeetingSupportedVideoSendCodecPreferences;
496+
497+
if (this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs) {
498+
this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(
499+
this.context.meetingSupportedVideoSendCodecPreferences,
500+
this.context.videoSendCodecPreferences
501+
);
502+
}
503+
496504
this.context.audioVideoController.update({ needsRenegotiation: true });
497505
} else {
498506
this.context.logger.warn(

test/task/MonitorTask.test.ts

+24-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import DefaultVideoTileController from '../../src/videotilecontroller/DefaultVid
5656
import DefaultVideoTileFactory from '../../src/videotilefactory/DefaultVideoTileFactory';
5757
import DefaultSimulcastUplinkPolicy from '../../src/videouplinkbandwidthpolicy/DefaultSimulcastUplinkPolicy';
5858
import NoVideoUplinkBandwidthPolicy from '../../src/videouplinkbandwidthpolicy/NoVideoUplinkBandwidthPolicy';
59+
import NScaleVideoUplinkBandwidthPolicy from '../../src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy';
5960
import DefaultWebSocketAdapter from '../../src/websocketadapter/DefaultWebSocketAdapter';
6061
import DOMMockBehavior from '../dommock/DOMMockBehavior';
6162
import DOMMockBuilder from '../dommock/DOMMockBuilder';
@@ -1460,7 +1461,7 @@ describe('MonitorTask', () => {
14601461
).to.be.true;
14611462
});
14621463

1463-
it('should degrade when there is more than one codec preferences', async () => {
1464+
it('should degrade when there is more than one codec preferences with NScaleVideoUplinkBandwidthPolicy', async () => {
14641465
context.meetingSupportedVideoSendCodecPreferences = [
14651466
VideoCodecCapability.vp9Profile0(),
14661467
VideoCodecCapability.vp8(),
@@ -1469,6 +1470,28 @@ describe('MonitorTask', () => {
14691470
VideoCodecCapability.vp9Profile0(),
14701471
VideoCodecCapability.vp8(),
14711472
];
1473+
context.videoUplinkBandwidthPolicy = new NScaleVideoUplinkBandwidthPolicy(
1474+
'self',
1475+
true,
1476+
logger
1477+
);
1478+
// @ts-ignore
1479+
task.degradeVideoCodec();
1480+
expect(
1481+
context.meetingSupportedVideoSendCodecPreferences[0].equals(VideoCodecCapability.vp8())
1482+
).to.be.true;
1483+
});
1484+
1485+
it('should degrade when there is more than one codec preferences with DefaultSimulcastUplinkPolicy', async () => {
1486+
context.meetingSupportedVideoSendCodecPreferences = [
1487+
VideoCodecCapability.vp9Profile0(),
1488+
VideoCodecCapability.vp8(),
1489+
];
1490+
context.videoSendCodecPreferences = [
1491+
VideoCodecCapability.vp9Profile0(),
1492+
VideoCodecCapability.vp8(),
1493+
];
1494+
context.videoUplinkBandwidthPolicy = new DefaultSimulcastUplinkPolicy('self', logger);
14721495
// @ts-ignore
14731496
task.degradeVideoCodec();
14741497
expect(

0 commit comments

Comments
 (0)