-
Notifications
You must be signed in to change notification settings - Fork 509
Disconnect received videos when not needed #6862
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
Disconnect received videos when not needed #6862
Conversation
6ade95c to
da0c6d2
Compare
a35401b to
9c17bf5
Compare
If the HPB is used it is enough to reconnect only with the receiver peer that needs a negotiation rather than forcing a full reconnection. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Before a negotiation needed event in a receiver Peer caused a forced reconnection, so the whole call was reset. Now only the affected Peer object is reset, so the simulcast levels previously set need to be set again on the new Peer object. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When an offer is requested to the HPB the old connection is stopped and a new one is created. If the HPB has support for updating the subscribers this is now used instead when negotiation is needed, as this prevents the existing connection (and thus the media) to be interrupted during the renegotiation. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Remote video can be blocked and allowed again by adjusting the direction of the video transceiver of RTCPeerConnections, which triggers a "negotiationneeded" event. When a negotiation is needed a new exchange of offers and answers needs to be made between the peers. Renegotiations need to be supported by both peers, so currently this is available only with the HPB, and only on versions that support the "update-sdp" feature. When the HPB is being used "negotiationneeded" event causes a new offer to be requested, which will be an update if the HPB supports it. Updates rather than new connections are needed to prevent an audio interruption while the connection changes. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
If the connection transitions to "disconnected" (or was disconnected before starting the renegotiation) the UI will wrongly show the message about reconnecting due to connection problems. I have not found an easy way to solve this, as it would require to keep track of whether a renegotiation started due to handling the "negotiationneeded" event or something else (and, in the future, once renegotiations are implemented also without HPB, it should be necessary to know too if the offer was sent by the remote peer for other reasons). Due to this, for now a slightly misleading message will be shown if the connection is updated while "disconnected". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
A remote video is not needed when it was explicitly disabled by the local user (independently of whether it is enabled by the remote participant) or when it is not visible. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Now the remote videos will be blocked when not needed, that is, when explicitly disabled by the local user or when not visible. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The "talk:video:toggled" event is triggered by VideoBottomBar and only handled in CallView to enable or disable the remote video. As the handling just calls a method in the RemoteVideoBlocker this can be directly done in the VideoBottomBar instead. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
9c17bf5 to
4e4ff9b
Compare
So it worked for me using a private window, but a normal window did not work 😕 . Is that a bug with about:webrtc? |
nickvergessen
left a comment
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.
Other than that it seems to work.
PR state is still developing?
No idea :-/ I have just tried and it worked fine for me when blocking the video in a normal window and when blocking the video in a private window 🤷
The pull request is ready, but it may require changes if something is changed in strukturag/nextcloud-spreed-signaling#191 (that is why I did not set it to To review). |
|
strukturag/nextcloud-spreed-signaling#191 was merged, so ready for review. The pending items can be done in follow ups. |
|
/backport to stable24 |
Fixes #5388
Requires strukturag/nextcloud-spreed-signaling#191
If a received video is explicitly disabled by the user, or if the remote participant is not visible, the received video is not needed. Until now the video was simply not rendered, but with this pull request the received video is disconnected/blocked, so it is not even transmitted nor decoded.
Note that, for now, this works only when the HPB is used. When the HPB is not used the renegotiation would need to be implemented by all clients, so something for the future.
If the external signaling server does not support the new
update-sdpfeature the video will not be disconnected when not needed either. Ifupdate-sdpis not supported then requesting a new offer would close the previous connection and create a new one, which would cause the audio to be interrupted during the connection change.Pending:
negotiationneededevent if the expected transceiver direction does not match once the connection is establishedframesDecodedproperty of theinbound-rtpstat could be monitored to know when the video has started to play again. However, in older browser versions that property was not available, and stats for received connections were not updated at a regular rate, so this should be carefully tested. Therefore it would be better to do it in a follow up pull request.How to test (scenario 1)
about:webrtc, in Chromiumchrome://webrtc-internalsRTCMediaStreamTrack_receiver_2 (track)(or something similar)Result with this pull request
The video is no longer received according to the stats; if the video is enabled again the video will be received again
Result without this pull request
The video is still received according to the stats
How to test (scenario 2)
about:webrtc, in Chromiumchrome://webrtc-internalsRTCMediaStreamTrack_receiver_2 (track)(or something similar)Result with this pull request
The video is no longer received according to the stats; if the video is shown again the video will be received again
Result without this pull request
The video is still received according to the stats