diff --git a/src/sdk/conference/channel.js b/src/sdk/conference/channel.js index 4e5b46d3..3e09d893 100644 --- a/src/sdk/conference/channel.js +++ b/src/sdk/conference/channel.js @@ -1099,9 +1099,10 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { } // Only check the first one. const param = obj[0]; - return param.codecPayloadType || param.dtx || param.active || - param.ptime || param.maxFramerate || param.scaleResolutionDownBy || - param.rid; + return !!( + param.codecPayloadType || param.dtx || param.active || param.ptime || + param.maxFramerate || param.scaleResolutionDownBy || param.rid || + param.scalabilityMode); } _isOwtEncodingParameters(obj) { diff --git a/test/unit/resources/scripts/conference.js b/test/unit/resources/scripts/conference.js index 1a4af0b6..b34aa596 100644 --- a/test/unit/resources/scripts/conference.js +++ b/test/unit/resources/scripts/conference.js @@ -5,6 +5,7 @@ 'use strict'; import {ConferenceClient} from '../../../../src/sdk/conference/client.js'; +import {ConferencePeerConnectionChannel} from '../../../../src/sdk/conference/channel.js'; import * as StreamModule from '../../../../src/sdk/base/stream.js'; import * as EventModule from '../../../../src/sdk/base/event.js' @@ -49,3 +50,52 @@ describe('Unit tests for ConferenceClient', function() { }); }); }); + +describe('Unit tests for ConferencePeerConnectionChannel.', () => { + describe('Tests for codecs.', () => { + it('Correctly detect the type of publishOptions elements.', () => { + // For each element in paramters, [object to be tested, is + // RTCRtpEncodingParameters, is OwtEncodingParameters]. + const parameters = [ + [[{scalabilityMode: 'L3T3'}], true, false], + [ + [ + {rid: 'q', active: true, scaleResolutionDownBy: 4.0}, + {rid: 'h', active: true, scaleResolutionDownBy: 2.0}, + {rid: 'f', active: true} + ], + true, false + ], + [true, false, false], + [ + [ + { + codec: { + name: 'h264', + }, + }, + { + codec: { + name: 'vp9', + }, + }, + { + codec: { + name: 'vp8', + }, + } + ], + false, true + ] + ]; + const channel = new ConferencePeerConnectionChannel(); + for (const [p, isRtpEncodingParameters, isOwtEncodingParameters] of + parameters) { + expect(channel._isRtpEncodingParameters(p)) + .to.equal(isRtpEncodingParameters); + expect(channel._isOwtEncodingParameters(p)) + .to.equal(isOwtEncodingParameters); + } + }); + }); +}); \ No newline at end of file