From 613d25d03362b56ad601b4cbc22994d553994eab Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Wed, 17 Aug 2022 12:36:19 -0700 Subject: [PATCH] webrtc: remove frame duration argument due to buggy webrtc implementations --- plugins/webrtc/src/webrtc-required-codecs.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/webrtc/src/webrtc-required-codecs.ts b/plugins/webrtc/src/webrtc-required-codecs.ts index 994d3e473..2f05aec1f 100644 --- a/plugins/webrtc/src/webrtc-required-codecs.ts +++ b/plugins/webrtc/src/webrtc-required-codecs.ts @@ -63,13 +63,8 @@ export function getFFmpegRtpAudioOutputArguments(inputCodec: string, outputCodec ret.push('-acodec', 'copy'); } else { - // this may not work for anything but opus, but that's probably fine since opus is - // the preferred default. webrtc will never try to transcode to a non-pcm format currently - // i think? need to investigate ring pcm cameras. ret.push( '-acodec', encoder, - '-application', 'lowdelay', - '-frame_duration', '60', '-flags', '+global_header', '-ar', '48k', // choose a better birate? this is on the high end recommendation for voice. @@ -77,6 +72,14 @@ export function getFFmpegRtpAudioOutputArguments(inputCodec: string, outputCodec '-bufsize', '96k', '-ac', outputCodecParameters.channels.toString(), ) + + if (encoder === 'libopus') + ret.push( + '-application', 'lowdelay', + // webrtc is supposed to support various frame durations but + // in practice it expects the default 20 in various implementations. + // '-frame_duration', '60', + ); } return ret; }