Skip to content

Commit

Permalink
Add Firefox120 handler (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Feb 29, 2024
1 parent 179ab65 commit d4c021f
Show file tree
Hide file tree
Showing 3 changed files with 1,164 additions and 10 deletions.
11 changes: 10 additions & 1 deletion src/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Chrome74 } from './handlers/Chrome74';
import { Chrome70 } from './handlers/Chrome70';
import { Chrome67 } from './handlers/Chrome67';
import { Chrome55 } from './handlers/Chrome55';
import { Firefox120 } from './handlers/Firefox120';
import { Firefox60 } from './handlers/Firefox60';
import { Safari12 } from './handlers/Safari12';
import { Safari11 } from './handlers/Safari11';
Expand All @@ -29,6 +30,7 @@ export type BuiltinHandlerName =
| 'Chrome70'
| 'Chrome67'
| 'Chrome55'
| 'Firefox120'
| 'Firefox60'
| 'Safari12'
| 'Safari11'
Expand Down Expand Up @@ -140,7 +142,9 @@ export function detectDevice(): BuiltinHandlerName | undefined {
return 'Chrome55';
}
// Firefox.
else if (isFirefox && !isIOS && browserVersion >= 60) {
else if (isFirefox && !isIOS && browserVersion >= 120) {
return 'Firefox120';
} else if (isFirefox && !isIOS && browserVersion >= 60) {
return 'Firefox60';
}
// Firefox on iOS (so Safari).
Expand Down Expand Up @@ -308,6 +312,11 @@ export class Device {
break;
}

case 'Firefox120': {
this._handlerFactory = Firefox120.createFactory();
break;
}

case 'Firefox60': {
this._handlerFactory = Firefox60.createFactory();
break;
Expand Down
12 changes: 3 additions & 9 deletions src/handlers/Chrome111.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,11 @@ export class Chrome111 extends HandlerInterface {
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);

if (encodings && encodings.length > 1) {
encodings.forEach((encoding, idx: number) => {
encoding.rid = `r${idx}`;
});

// Set rid and verify scalabilityMode in each encoding.
// NOTE: Even if WebRTC allows different scalabilityMode (different number
// of temporal layers) per simulcast stream, we need that those are the
// same in all them, so let's pick up the highest value.
// NOTE: If scalabilityMode is not given, Chrome will use L1T3.

let nextRid = 1;
let maxTemporalLayers = 1;

for (const encoding of encodings) {
Expand All @@ -351,10 +345,10 @@ export class Chrome111 extends HandlerInterface {
}
}

for (const encoding of encodings) {
encoding.rid = `r${nextRid++}`;
encodings.forEach((encoding, idx: number) => {
encoding.rid = `r${idx}`;
encoding.scalabilityMode = `L1T${maxTemporalLayers}`;
}
});
}

const sendingRtpParameters: RtpParameters = utils.clone<RtpParameters>(
Expand Down

0 comments on commit d4c021f

Please sign in to comment.