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

Don't call .stop() in onremotetrack when track is notified as removed by janus.js (fixes #3055) #3056

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

lminiero
Copy link
Member

@lminiero lminiero commented Sep 6, 2022

This is a fix for the issue reported in #3055, where the symptom was the multistream VideoRoom demo breaking when someone left a room and then joined again (or someone else joined): for existing subscribers, m-lines would be reused, and media would be broken. This was caused by us closing the remote stream in the onremotetrack callback for a removed track: since the new track (new user) actually remains the same after the renegotiation, this ends up breaking the rendering.

Initially we thought it might be caused by us re-using track IDs in SDPs from Janus, but even after making sure we generate fresh ones when needed, the problem remained the same, and we could see the ontrack callback of the PeerConnection would still report the previous track ID as being added: not sure why, but maybe because as far as SDP is concerned the fact we changed the ID of the track didn't change anything, since the m-line still "lives", and so the browser assumed the previous one was still in use and ignored the new one.

As such, we decided to go for a different fix, and just removed all calls to .stop() for the remote track when one is removed. We gave this some thought and realized this could have caused issues also when a track was only temporarily paused, e.g., freezed because of losses: in fact, the onremotetrack(false) event is fired in response to an onmuted event on the track, not onended, which is by definition not conclusive. Besides, the .stop() calls we had were probably a leftover when we still cloned tracks before using them in demos, which is something we stopped doing in #3009.

Not sure if this can cause leaks in demos, now, but it definitely fixes the problem. Feedback would be welcome before we merge, of course. Also pinging @fippo who may point out gross mistakes we're doing 🤭

@lminiero lminiero added the multistream Related to Janus 1.x label Sep 6, 2022
@lminiero
Copy link
Member Author

lminiero commented Sep 9, 2022

Merging.

@lminiero lminiero merged commit 7846018 into master Sep 9, 2022
@lminiero lminiero deleted the removetrack-dontstop branch September 9, 2022 10:23
@fippo
Copy link
Contributor

fippo commented Sep 9, 2022

You are doing less gross mistakes now which is always the way to go ;-)

mwalbeck pushed a commit to mwalbeck/docker-janus-gateway that referenced this pull request Oct 4, 2022
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [meetecho/janus-gateway](https://github.com/meetecho/janus-gateway) | minor | `v1.0.4` -> `v1.1.0` |

---

### Release Notes

<details>
<summary>meetecho/janus-gateway</summary>

### [`v1.1.0`](https://github.com/meetecho/janus-gateway/blob/HEAD/CHANGELOG.md#v110---2022-10-03)

[Compare Source](meetecho/janus-gateway@v1.0.4...v1.1.0)

-   Added versioning to .so files \[[PR-3075](meetecho/janus-gateway#3075)]
-   Allow plugins to specify msid in SDPs \[[PR-2998](meetecho/janus-gateway#2998)]
-   Fixed broken RTCP timestamp on 32bit architectures \[[Issue-3045](meetecho/janus-gateway#3045)]
-   Fixed problems compiling against recent versions of libwebsockets \[[Issue-3039](meetecho/janus-gateway#3039)]
-   Updated deprecated DTLS functions to OpenSSL v3.0 [PR-3048](meetecho/janus-gateway#3048)]
-   Switched to SHA256 for signing self signed DTLS certificates (thanks [@&#8203;tgabi333](https://github.com/tgabi333)!) \[[PR-3069](meetecho/janus-gateway#3069)]
-   Started using strnlen to optimize performance of some strlen calls (thanks [@&#8203;tmatth](https://github.com/tmatth)!) \[[PR-3059](meetecho/janus-gateway#3059)]
-   Added checks to avoid RTX payload type collisions \[[PR-3080](meetecho/janus-gateway#3080)]
-   Added new APIs for cascading VideoRoom publishers \[[PR-3014](meetecho/janus-gateway#3014)]
-   Fixed deadlock when using legacy switch in VideoRoom \[[Issue-3066](meetecho/janus-gateway#3066)]
-   Fixed disabled property not being advertized to subscribers when VideoRoom publishers removed tracks
-   Fixed occasional deadlock when using G.711 in the AudioBridge \[[Issue-3062](meetecho/janus-gateway#3062)]
-   Added new way of capturing devices/tracks in janus.js \[[PR-3003](meetecho/janus-gateway#3003)]
-   Removed call to .stop() for remote tracks in demos \[[PR-3056](meetecho/janus-gateway#3056)]
-   Fixed missing message/info/transfer buttons in SIP demo page
-   Fixed postprocessing compilation issue on older FFmpeg versions \[[PR-3064](meetecho/janus-gateway#3064)]
-   Other smaller fixes and improvements (thanks to all who contributed pull requests and reported issues!)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMTMuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIxMy4wIn0=-->

Reviewed-on: https://git.walbeck.it/walbeck-it/docker-janus-gateway/pulls/91
Co-authored-by: renovate-bot <bot@walbeck.it>
Co-committed-by: renovate-bot <bot@walbeck.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multistream Related to Janus 1.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants