Skip to content
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

Fix ice candidate proto to webrtc interface conversion #386

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

edaniels
Copy link
Contributor

No description provided.

@edaniels edaniels requested a review from a team as a code owner October 10, 2024 21:25
@edaniels edaniels requested review from njooma and lia-viam October 10, 2024 21:25
@@ -30,6 +30,12 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
'unicorn/prefer-add-event-listener': 'warn',
'@typescript-eslint/strict-boolean-expressions': [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning this on with the exception of booleans feels very worth it to me. I've written numerous bugs due to how optionals are checked in a truthy/falsey way.

@@ -365,30 +366,30 @@ const iceCandidateFromProto = (i: ICECandidate) => {
const candidate: RTCIceCandidateInit = {
candidate: i.candidate,
};
if (i.sdpMid) {
if (i.sdpMid !== undefined) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix. We we were excluding the right properties because some of them were falsey

@@ -242,8 +242,9 @@ export class SignalingExchange {
try {
await this.pc.addIceCandidate(cand);
} catch (error) {
console.log('error adding ice candidate', error); // eslint-disable-line no-console
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will report an error if this ever happens again and bubble up to the reason of dial failure instead of undefined.

Copy link
Contributor

@ethanlookpotts ethanlookpotts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not review code but I did try it in a deployed temp environment and it works! https://github.com/viamrobotics/app/pull/6514

@edaniels edaniels merged commit 1449855 into viamrobotics:main Oct 11, 2024
3 checks passed
@edaniels edaniels deleted the fix_ice_cand_proto_to_wrtc branch October 11, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants