-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Correct msid handling for RtpSender #217
Conversation
The previous logic would put negotiation into an endless loop after running `remove_track` due to incorrectly implementing the negotiation check and handling of stream ids.
@@ -447,27 +447,48 @@ impl RTCPeerConnection { | |||
// if t.stopping && !t.stopped { | |||
// return true | |||
// } | |||
let m = get_by_mid(t.mid().await.as_str(), local_desc); | |||
let mid = t.mid().await; | |||
let m = get_by_mid(&mid, local_desc); | |||
// Step 5.2 | |||
if !t.stopped.load(Ordering::SeqCst) && m.is_none() { | |||
return true; | |||
} | |||
if !t.stopped.load(Ordering::SeqCst) { | |||
if let Some(m) = m { | |||
// Step 5.3.1 |
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.
See https://www.w3.org/TR/webrtc/#ref-for-dfn-check-if-negotiation-is-needed-1 for the steps outlined by the specification
Codecov Report
@@ Coverage Diff @@
## master #217 +/- ##
==========================================
- Coverage 44.01% 43.79% -0.22%
==========================================
Files 68 68
Lines 9658 9667 +9
Branches 2794 2820 +26
==========================================
- Hits 4251 4234 -17
- Misses 3350 3374 +24
- Partials 2057 2059 +2
Continue to review full report at Codecov.
|
The way this code was written the `set_sending_track` call could sometimes not run if `sender.stop()` failed. With this change we make sure to attempt both operations always, even if one fails.
Match libWebrtc's behaviour which doesn't update `transcevier.[[Direction]]` instead of following the specification. See: https://webrtc.googlesource.com/src/+/c501f30333ce8b46a92b75a6bf75733ddb0e9741/pc/sdp_offer_answer.cc#2018
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. I don't know about the logic, because I don't know the spec.
The previous logic would put negotiation into an endless loop after
running
remove_track
due to incorrectly implementing the negotiationcheck and handling of stream ids.
Upon calling
remove_track
the following steps were carried out:remove_track
is associated withNone
.There were three problems with this:
remove_track
implementation is mostly correct, but it didn't always update the transceivers direction.In total this meant that when removing a track, at least some times, we'd end up in an endless negotiation loop where the check if negotiation was needed was always returning true, even after negotiating with the peer.