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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

uses: wjdp/htmltest-action@master
with:
config: .htmltest.yml
Expand Down
6 changes: 3 additions & 3 deletions lib/src/rpc/dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.

final DateTime nominatedTime = DateTime.fromMillisecondsSinceEpoch(lpst.toInt());

final String lcid = stat.values['localCandidateId'];
final String rcid = stat.values['remoteCandidateId'];
final lcid = stat.values['localCandidateId'];
final rcid = stat.values['remoteCandidateId'];
Comment on lines +240 to +241
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).

for (var innerStat in stats) {
if (innerStat.id == lcid) {
final type = innerStat.values['candidateType'];
Expand Down
Loading