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 dynamic logic for ICE stats #239

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

benjirewis
Copy link
Member

No description provided.

@@ -234,11 +234,11 @@ Future _logConnectionStats(Stopwatch webrtcDialSW, RTCPeerConnection peerConnect
if (stat.type == 'candidate-pair' && stat.values['nominated']) {
// Use 'lastPacketSentTimestamp' on candidate pair to estimate when the
// pair was nominated.
final double lpst = stat.values['lastPacketSentTimestamp'];
final double lpst = stat.values['lastPacketSentTimestamp'] ?? 0;
Copy link
Member

Choose a reason for hiding this comment

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

[nit] not set on the ?? 0 if there is a better default value - or if we should set it to null to do some exception handling than that may be preferred. I'll leave that up to you though!

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I think I'm fine with the ?? 0.

Comment on lines +240 to +241
final lcid = stat.values['localCandidateId'];
final rcid = stat.values['remoteCandidateId'];
Copy link
Member

Choose a reason for hiding this comment

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

are you comfortable with these being instantiated as dynamic? you'll need to cast them later, I think.

if not, you could do like above:

Suggested change
final lcid = stat.values['localCandidateId'];
final rcid = stat.values['remoteCandidateId'];
final String? lcid = stat.values['localCandidateId'];
final String? rcid = stat.values['remoteCandidateId'];

or

Suggested change
final lcid = stat.values['localCandidateId'];
final rcid = stat.values['remoteCandidateId'];
final lcid = stat.values['localCandidateId'] ?? ''; // or some default value
final rcid = stat.values['remoteCandidateId'] ?? '';

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting... they seem to string-interpolate just fine as dynamics; is it preferred for them to be String? or String?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not familiar with Dart, but was there a reason to remove the String type?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are not in fact Strings; they are of type dynamic and could be cast to String? (nullable String).

@benjirewis benjirewis marked this pull request as ready for review July 1, 2024 13:54
@benjirewis benjirewis requested a review from a team as a code owner July 1, 2024 13:54
@@ -27,7 +27,7 @@ jobs:
- name: Test HTML
# https://github.com/wjdp/htmltest-action/
# Don't fail the build on broken links
continue-on-error: false
continue-on-error: true
Copy link
Member Author

Choose a reason for hiding this comment

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

We were getting CI failures due to a broken link; given the comment above, I think this should be true.

@benjirewis benjirewis merged commit bc59042 into viamrobotics:main Jul 3, 2024
4 checks passed
@benjirewis benjirewis deleted the fix-ice-stats branch July 3, 2024 13:30
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