Skip to content

Commit

Permalink
Merge branch 'gh-pages' into muxer
Browse files Browse the repository at this point in the history
  • Loading branch information
fippo authored Feb 29, 2024
2 parents 2b97963 + 358eb24 commit 7373cf2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ let preferredAudioCodecMimeType = 'audio/opus';
// eslint-disable-next-line prefer-const
let preferredVideoCodecMimeType = 'video/VP8';

const supportsSetCodecPreferences = window.RTCRtpTransceiver &&
'setCodecPreferences' in window.RTCRtpTransceiver.prototype;

let hasEnoughAPIs = !!window.RTCRtpScriptTransform;

if (!hasEnoughAPIs) {
Expand Down Expand Up @@ -150,7 +153,7 @@ function setupReceiverTransform(receiver) {
}

function maybeSetCodecPreferences(trackEvent) {
if (!'setCodecPreferences' in window.RTCRtpTransceiver.prototype) return;
if (!supportsSetCodecPreferences) return;
if (trackEvent.track.kind === 'audio' && preferredAudioCodecMimeType ) {
const {codecs} = RTCRtpReceiver.getCapabilities('audio');
const selectedCodecIndex = codecs.findIndex(c => c.mimeType === preferredAudioCodecMimeType);
Expand Down

0 comments on commit 7373cf2

Please sign in to comment.