From 525d90ce40a78393c3f257e27a5cc207972bbd42 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Thu, 2 Nov 2023 22:07:21 +0800 Subject: [PATCH] Round start bitrate for svc (#920) --- .changeset/tricky-grapes-cheer.md | 5 +++++ src/room/PCTransport.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/tricky-grapes-cheer.md diff --git a/.changeset/tricky-grapes-cheer.md b/.changeset/tricky-grapes-cheer.md new file mode 100644 index 0000000000..fc8ad6ce8a --- /dev/null +++ b/.changeset/tricky-grapes-cheer.md @@ -0,0 +1,5 @@ +--- +'livekit-client': patch +--- + +Round start bitrate for svc diff --git a/src/room/PCTransport.ts b/src/room/PCTransport.ts index e6fb95ad95..4e6be9aecb 100644 --- a/src/room/PCTransport.ts +++ b/src/room/PCTransport.ts @@ -256,7 +256,9 @@ export default class PCTransport extends EventEmitter { for (const fmtp of media.fmtp) { if (fmtp.payload === codecPayload) { if (!fmtp.config.includes('x-google-start-bitrate')) { - fmtp.config += `;x-google-start-bitrate=${trackbr.maxbr * startBitrateForSVC}`; + fmtp.config += `;x-google-start-bitrate=${Math.round( + trackbr.maxbr * startBitrateForSVC, + )}`; } if (!fmtp.config.includes('x-google-max-bitrate')) { fmtp.config += `;x-google-max-bitrate=${trackbr.maxbr}`; @@ -269,9 +271,9 @@ export default class PCTransport extends EventEmitter { if (!fmtpFound) { media.fmtp.push({ payload: codecPayload, - config: `x-google-start-bitrate=${ - trackbr.maxbr * startBitrateForSVC - };x-google-max-bitrate=${trackbr.maxbr}`, + config: `x-google-start-bitrate=${Math.round( + trackbr.maxbr * startBitrateForSVC, + )};x-google-max-bitrate=${trackbr.maxbr}`, }); }