-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add disableTwcc helper function #19
Conversation
src/munge.ts
Outdated
@@ -40,6 +41,15 @@ export function disableRemb(sdp: Sdp) { | |||
disableRtcpFbValue(sdp, 'goog-remb'); | |||
} | |||
|
|||
/** | |||
* Disable REMB from all media blocks in the given SDP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here (should say TWCC instead of REMB).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
udpated.
src/munge.ts
Outdated
@@ -40,6 +41,15 @@ export function disableRemb(sdp: Sdp) { | |||
disableRtcpFbValue(sdp, 'goog-remb'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update this to take an sdpOrAv
while we're at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
udpated. also add UT for disableRemb.
src/munge.spec.ts
Outdated
* @param rtcpFbValue - The rtcp-fb value to check. | ||
* @returns True if the offer contains rtcp-fb value. | ||
*/ | ||
const checkOfferContainsRtcpFeedbacks = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: plural of "feedback" is still "feedback". This function should be called checkOfferContainsRtcpFeedback
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
udpated.
src/munge.spec.ts
Outdated
): boolean => { | ||
let bContains = false; | ||
const mediaDescriptions = offer instanceof Sdp ? offer.avMedia : [offer]; | ||
mediaDescriptions.forEach((av: AvMediaDescription) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter here since it's a spec file so you don't need to change it, but a minor optimization would be to use every
instead of forEach
, since every
would break out of the loop as soon as it finds a value that fails the condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to use some() here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm other than the stuff bryce called out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Left a minor style comment but it's not a big deal.
return [...av.codecs.values()].some((ci: CodecInfo) => { | ||
return ci.feedback.includes(rtcpFbValue); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you omit the curly braces, you don't need to use return here. So this can be:
return mediaDescriptions.some((av: AvMediaDescription) =>
[...av.codecs.values()].some((ci: CodecInfo) => ci.feedback.includes(rtcpFbValue))
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to do this as well but I'll then get a eslint warning saying -
Array.prototype.some() expects a return value from arrow function.eslintarray-callback-return
So as discussed, I'll just keep the return here.
# [1.6.0](v1.5.0...v1.6.0) (2023-12-20) ### Features * add disableTwcc helper function ([#19](#19)) ([c9ec114](c9ec114))
This pr adds a new function disableTwcc to and also modifies the existing function disableRtcpFbValue in munge.ts.
With this change we'll be able to disable audio twcc, which impacts probing and bandwidth estimation according to our test.