fix(SignalingLayer) Update SSRC owners on leave. (#2184)
* fix(SignalingLayer) Update SSRC owners on leave.
Update the SSRC owners in the following cases:
1. When a remote endpoint leaves the call.
2. When a source-remove is received.
3. When a source is remapped (with ssrc-rewriting enabled).
Create the remote track even if presence is not yet received. The ssrc owner check prevents the client from creating a dummy track when the call switches over from p2p to jvb when the last remote endpoint leaves the call.
* ref(SignalingLayer) alpha sort methods.
Clean up unused methods, _findEndpointSourceInfoForMediaType is not used anymore.
* squash: Address review comments.
fix(TPC) Allow remote tracks to be created if no presence is found.
Currently, remote tracks are not created if presence for the endpoint is not received before source signaling. With ssrc-rewriting, the source information will be received on the bridge channel and presence on the prosody ws so there are chances that they can be out of sync. We do not want to skip remote track creation when that happens.
Remove support for legacy endpoint based signaling. (#2147)
* Remove support for legacy endpoint based signaling and make source-name signaling as the only signaling mode. The legacy screensharing mode will no longer be supported. The client will still be able to process remote presence sent in the old format to support interop with very old mobile clients and jigasi that do not support source-name signaling.
* remove code related to presenter mode.
Instead of Jicofo signaling all the remote sources available in the call, the bridge now signals only a limited set of SSRCs and then rewrites the SSRC on the outgoing media streams. The SSRC mapping is done based on the sources requested by the clients through the receiver constraints. This limits the number of m-lines in the remote/local SDPs on the client and therefore results in better performance in large calls.
* Handle source remapping messages from bridge
* Added track_owner_changed events
* don't process an invalid rtx ssrc.
* keep track of remote ssrcs, only renegotiate on new ones.
* Change source name on remote track on ssrc remapping.
* Don't remove tracks on member leave.
* Remove (orphaned) tracks on session terminated.
* Use serial number (per media type) to create msid attribute.
* Update videoType on remapping.
Co-authored-by: James A <jqdrqgnq@users.noreply.github.com>
Fix codec negotiation and other multi-stream issues (#2133)
* fix(codec-selection) Munge all related m-lines for multi-stream.
Munge all the video m-lines to apply the preferred codec settings in multi-stream mode.
* fix(TPC) Cache transceiver mids for all local video tracks.
There will be multiple video tracks in multi-stream, we need to cache the mids for all the the associated transceivers.
* fix(sender-constraints) Do not apply sender constraints if value hasn't changed for a given source.
* fix(TPC) Configure the direction correctly for all m-lines.
Ignore negotiationneeded events for p2p to avoid going into a renegotiation loop.
* squash: Address review comments.
Adds a helper function getSourceIndexFromSourceName to
have track index parsing in one place.
In _processLocalSSRCsMap there was an assumption that a track
index can be a single digit only.
Use "last index of" or search from the end of the collection to
make parsing a bit more universal (does not matter as much for
Jitsi endpoint IDs, but if fixes issues if someone has
a customization there).
fix(TPC) Do not force immediate O/A cycles after track replace operations.
In Unified-plan mode, we rely on the browser to fire 'negotiationneeded' event to start a O/A cycle. Also add muted tracks to PC. Fixes issues where the streams are not being signaled when call switches over from p2p to jvb in multi-stream mode.
ref(RTC) Make the remove and add track method names more generic.
Since Track effects and mute/unmute operations use the same flow, i.e., removing/adding the track from the RTCPeerConnection but not from TPC, make the names of the methods involved more generic.
fix(multi-stream) Fix VP9 bitrates in the multi-stream mode.
Set the bitrates on the video m-lines based on the associated track type. In multi-stream mode, there will be two separate m-lines for camera and desktop tracks. Also fallback to SDP munging for setting codec preferences on Chromium.
fix(TPC) Stop munging remote desc for imploding the SIM groups.
Jicofo by default now strips the simulcast SSRCs and sends only the primary SSRC and RTX to all the receiving endpoints in the call. Therefore remote SDP munging is not required on the clients anymore.
fix(SDP): Reset sources to MSID map for plan-b clients.
When source-name signaling is enabbled on plan-b clients, the sources to MSID map needs to be cleared after every transformation since browser in plan-b mode produces a new set of SSRCs and trackID when a track is removed and new track is added to the peerconnection. This fixes an issue where the track index in the source-name gets incremented after a track replace operation.
fix(multi-stream): Fix local SSRC cache to include multiple video streams. (#2006)
* fix(multi-stream): Fix local SSRC cache to include multiple video streams.
If multiple local video streams are found in the SDP, cache all of them instead of the first video SSRC. This fixes an issue where the resolution/fps stats for the screenshare track are not available.
* squash: new track inherits the source name of old track if it exists.
fix(video-quality) Update frame heights in content-modify for p2p. (#1983)
* fix(video-quality) Update frame heights in content-modify for p2p.
When the user changes the preferred video quality settings from the UI, update the frame height values in content-modify for p2p connection when source-name signaling is enabled.
* fix(multi-stream) Send presence for desktop track before signaling when it is the first track to be added to the conference.
Also do not suppress renegotiation for desktop track on p2p since the browser doesn't fire negotiation needed event.
* squash: fix build
* squash: fix linter issues
* squash: add comment.
fix(presence) Parse peer presence in legacy format correctly.
When source-name signaling is enabled, get correct peermedia info when the peer sends presence in the legacy format. This fixes an issue where Jigasi users cannot be heard by endpoints that have source-name signaling enabled.
fix(multi-stream) fix p2p issues with secondary video sources.
* fix(multi-stream) add new m-line when remote adds a second video source in p2p.
A new m-line needs to be added in the remote description when a new secondary video source is signaled by the peer.
* fix(TPC) Suppress lower layers only for screenshare tracks.
With multi-stream support enabled, an extra check for videoType for local track is needed to dtermine if the lower layers need to be suppressed.
* fix(TPC) Mark the direction inactive on inactive media connection.
If a new secondary video source is added on the jvb connection while p2p is active, make sure the direction is set to inactive on the jvb connection, so that no media is being sent out on the jvb connection.
* squash: Address review comments.
fix(multi-stream-support) Support muting of desktop track.
* fix(multi-stream-support) Support muting of desktop track.
* fix(multi-stream) Always initiate responder renegotiation even for p2p.
This is needed since the new m-line is always added to the remote description.
* fix(multi-stream) Support multi-stream only on Unfied plan endpoints.
* fix(multi-stream) Advertise source-name signaling to Jicofo when supported.
* fix(JitsiLocalTrack): Remove unnecessary reject.
* fix: add the correct source name attribute for the second video track.
* squash: Address review comments.
Chrome doesn't render media when the SSRC is added back to the m-line after removing it because of source-remove->source-add from peer. Avoid renegotiations so that these source removes and adds are not sent to the peer after the track is replaced.
feat(multi-stream-support) Configure the senders based on SenderVideoConstraintsV2.
The encodings for local video tracks are confiugured based on the SenderVideoConstraintsV2 constraints received from the bridge. The constraints are sourceName based. Also ignore enableLayerSuspension flag since it has been deprecated and layer suspension has been enabled by default. Also having it off makes screensharing on Chrome in unified plan not work as expected.
feat(multi-stream-support) Add the support for multiple local video streams.
* feat(multi-stream-support) Add the support for multiple local video streams.
This feature is behind 'sendMultipleVideoStreams' config.js flag and is currently supported only on clients running in Unified plan mode.
* squash: Use the track index from source name to find the matching transceiver on unmute.
feat(multi-stream-support) Handle SDP munging for multiple local/remote streams per ep. (#1868)
* feat(multi-stream-support) Handle SDP munging for multiple local/remote streams/ep.
A new SDPSimulcast class is added for handling SDP munging for local and remote descriptions to handle multiple streams for both local and remote endpoints. This new class will be used only for unified plan implentation. The sdp-simucast npm package will be used for plan-b and deprecated later when all the clients switch to unified plan.
* fix(build) fix building with TS code
Use the Babel preset for the webpack bundle since Babel 7 already
understands TS and ts-loader uses tsc instead, which we configure
differently.
* squash: Add unit test and address review comments.
Co-authored-by: Saúl Ibarra Corretgé <saghul@jitsi.org>