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

libwebrtc: replace MS_ASSERT with MS_ERROR #988

Merged
merged 3 commits into from
Jan 26, 2023
Merged

Conversation

ibc
Copy link
Member

@ibc ibc commented Jan 24, 2023

  • Fixes [worker] Must replace MS_ASSERT() with a non aborting warn/error log #986
  • Let's use MS_ERROR instead of MS_WARN_TAG(bwe) to make these errors as visible as possible.
  • Sometimes use more modern libwebrtc code such as the usage of absl::optional somewhere in code diff.
  • Original RTC_DCHECK in libwebrtc does NOT abort so we must only show error logs and, depending on each case, do early return or not. If not, it means that code below keeps running with inconsistent data. I've tried to return earlier as much as possible but it's not always possible. In fact, RTC_CHECK *does abort even in Release mode. However, RTC_DCHECK just logs it.

- Fixes #986
- Let's use `MS_ERROR` instead of `MS_WARN_TAG(bwe)` to make these errors as visible as possible.
- Sometimes use more modern libwebrtc code such as the usage of `absl::optional` somewhere in code diff.
- Original `RTC_DCHECK` is supposed to not abort in libwebrtc Release mode, which means that code below keeps running with inconsistent data. I've tried to return eariler as much as possible but it's not always possible.
@ibc ibc requested a review from jmillan January 24, 2023 11:52
Comment on lines +206 to +208
if (clusters_.empty() || probing_state_ != ProbingState::kActive) {
return absl::nullopt;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is how modern libwebrtc code looks.

@@ -66,7 +66,7 @@ class BitrateProber {
int TimeUntilNextProbe(int64_t now_ms);

// Information about the current probing cluster.
PacedPacketInfo CurrentCluster() const;
absl::optional<PacedPacketInfo> CurrentCluster() const;
Copy link
Member Author

Choose a reason for hiding this comment

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

Copied from modern libwebrtc version.

@@ -185,7 +194,7 @@ void PacedSender::Process() {
PacedPacketInfo pacing_info;
absl::optional<size_t> recommended_probe_size;

pacing_info = prober_.CurrentCluster();
pacing_info = prober_.CurrentCluster().value_or(PacedPacketInfo());
Copy link
Member Author

Choose a reason for hiding this comment

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

Hope this is ok. Used in libwebrtc modern version somewhere.

@github-actions
Copy link

Pull reviewers stats

Stats of the last 365 days for mediasoup:

User Total reviews Time to review Total comments
ibc
🥇
67
▀▀▀▀
3h 38m
171
▀▀▀▀▀▀
jmillan
🥈
54
▀▀▀
14h 7m
50
▀▀
nazar-pc
🥉
30
▀▀
2h 26m
41
ggarber
4
3h 11m
3
eli-schwartz
2
1h 34m
2
fippo
1
8h 29m
2
SteveMcFarlin
1
2d 8h 1m
3
Hartigan
1
2d 5h 7m
6
balazskreith
1
55d 2h 38m
▀▀▀▀▀▀▀▀▀
12

if (!positive_semi_definite) {
MS_ERROR("The over-use estimator's covariance matrix is no longer "
"semi-definite.");
MS_ERROR("the over-use estimator's covariance matrix is no longer semi-definite");
Copy link
Member

Choose a reason for hiding this comment

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

return missing here?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no such a return in libwebrtc.

Comment on lines 271 to 281
int64_t BitrateProber::GetNextProbeTime(const ProbeCluster& cluster) {
// RTC_CHECK_GT(cluster.pace_info.send_bitrate_bps, 0);
// RTC_CHECK_GE(cluster.time_started_ms, 0);
MS_ASSERT(cluster.pace_info.send_bitrate_bps > 0, "cluster.pace_info.send_bitrate_bps must be > 0");
MS_ASSERT(cluster.time_started_ms > 0, "cluster.time_started_ms must be > 0");
if (cluster.pace_info.send_bitrate_bps <= 0) {
MS_ERROR("cluster.pace_info.send_bitrate_bps must be > 0");
return 0;
}
if (cluster.time_started_ms <= 0) {
MS_ERROR("cluster.time_started_ms must be > 0");
return 0;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@jmillan I'm gonna revert these changes because those were RTC_CHECK so assertion is needed.

@ibc ibc merged commit 21285cb into v3 Jan 26, 2023
@ibc ibc deleted the libwebrtc-replace-msassert branch January 26, 2023 10:57
piranna pushed a commit to dyte-in/mediasoup that referenced this pull request Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[worker] Must replace MS_ASSERT() with a non aborting warn/error log
2 participants