diff --git a/CHANGELOG.md b/CHANGELOG.md index c915bd737d..ea667a2294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Update uplink policy at codec degradation triggered by encoding health monitor. + ## [3.23.0] - 2024-05-14 ### Added diff --git a/src/task/MonitorTask.ts b/src/task/MonitorTask.ts index 7ff88af6bc..d1deab2ea5 100644 --- a/src/task/MonitorTask.ts +++ b/src/task/MonitorTask.ts @@ -493,6 +493,14 @@ export default class MonitorTask this.context.meetingSupportedVideoSendCodecPreferences[0] ); this.context.meetingSupportedVideoSendCodecPreferences = newMeetingSupportedVideoSendCodecPreferences; + + if (this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs) { + this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs( + this.context.meetingSupportedVideoSendCodecPreferences, + this.context.videoSendCodecPreferences + ); + } + this.context.audioVideoController.update({ needsRenegotiation: true }); } else { this.context.logger.warn( diff --git a/test/task/MonitorTask.test.ts b/test/task/MonitorTask.test.ts index adc83735ec..54cf967556 100644 --- a/test/task/MonitorTask.test.ts +++ b/test/task/MonitorTask.test.ts @@ -56,6 +56,7 @@ import DefaultVideoTileController from '../../src/videotilecontroller/DefaultVid import DefaultVideoTileFactory from '../../src/videotilefactory/DefaultVideoTileFactory'; import DefaultSimulcastUplinkPolicy from '../../src/videouplinkbandwidthpolicy/DefaultSimulcastUplinkPolicy'; import NoVideoUplinkBandwidthPolicy from '../../src/videouplinkbandwidthpolicy/NoVideoUplinkBandwidthPolicy'; +import NScaleVideoUplinkBandwidthPolicy from '../../src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy'; import DefaultWebSocketAdapter from '../../src/websocketadapter/DefaultWebSocketAdapter'; import DOMMockBehavior from '../dommock/DOMMockBehavior'; import DOMMockBuilder from '../dommock/DOMMockBuilder'; @@ -1460,7 +1461,7 @@ describe('MonitorTask', () => { ).to.be.true; }); - it('should degrade when there is more than one codec preferences', async () => { + it('should degrade when there is more than one codec preferences with NScaleVideoUplinkBandwidthPolicy', async () => { context.meetingSupportedVideoSendCodecPreferences = [ VideoCodecCapability.vp9Profile0(), VideoCodecCapability.vp8(), @@ -1469,6 +1470,28 @@ describe('MonitorTask', () => { VideoCodecCapability.vp9Profile0(), VideoCodecCapability.vp8(), ]; + context.videoUplinkBandwidthPolicy = new NScaleVideoUplinkBandwidthPolicy( + 'self', + true, + logger + ); + // @ts-ignore + task.degradeVideoCodec(); + expect( + context.meetingSupportedVideoSendCodecPreferences[0].equals(VideoCodecCapability.vp8()) + ).to.be.true; + }); + + it('should degrade when there is more than one codec preferences with DefaultSimulcastUplinkPolicy', async () => { + context.meetingSupportedVideoSendCodecPreferences = [ + VideoCodecCapability.vp9Profile0(), + VideoCodecCapability.vp8(), + ]; + context.videoSendCodecPreferences = [ + VideoCodecCapability.vp9Profile0(), + VideoCodecCapability.vp8(), + ]; + context.videoUplinkBandwidthPolicy = new DefaultSimulcastUplinkPolicy('self', logger); // @ts-ignore task.degradeVideoCodec(); expect(