fix(p2p) Fix an issue where unmute fails on p2p with channelLastN=0.
Always initiate a sRD->cA->sLD cycle since renegotiation fails in the following scenario.
In a p2p call when channelLastN=0, the direction on the video tranceiver is set to'inactive'.
At this point, if the user unmutes, the track is replaced on the video sender.
If a cO->sLD->sRD is triggered, the browser adds a third m-line which isn't expected and possibly is a bug. All renegotiations fail as a result.
However, the browser does not add a third m-line in the answer it generates and renegotiation succeeds.
1. Checks peer's preferred codec in p2p case. Mobile and web have different preferred codecs.
2. Log an error message when the preferred codec is not offered by JVB.
3. Clean up code related to deprecated config.js settings 'preferH264' and 'disableH264'.
4. Refactor the codec selection logic so that correct codec is picked.
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.
ref(JingleSessionPC): Remove unncessary reneg cycles for p2p.
When an answer is received from the p2p peer, only set remote description instead of calling the full renegotiation cycle. Also, always initiate a sRD->cA->sLD cycle when adding remote sources irrespective of whether the local endpoint is an initiator or responder for the p2p connection. This lets us remove the hacks added for Chromium (unified-plan) bugs related to video not rendering in p2p cases.
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) Set the source name of replaced track before configuring it.
With just source-name enabled, set the source name of the replaced track before configuring the encodings, this fixes an issues where the sender constraints are not applied on the p2p connection because the source name is undefined.
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(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) Reject m-lines associated with removed sources.
We do not want the client to re-use the inactive transceivers that are associated with m-lines for removed remote tracks. Rejecting a m-line on source-remove clears it from the list of available transceivers.
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.
fix(JingleSessionPC) Remove the ssrc lines in remote desc sdp on source removal.
In P2P and unified mode, Chrome does not render the media if an SSRC is removed and the same one is added back (happens when the sender is camera muted->starts SS->stops SS->turns camera on). That is why SSRC was not being removed. However, mobile endpoints that are running in plan-b generate a new SSRC when the client switches between camera and screenshare. This will cause issues on a p2p receiver that is running in unified mode. Fixes https://github.com/jitsi/jitsi-meet/issues/11010.
fix(rn,JingleSessionPC) remove aggressive layer suspension in RN
It's possible we get sender constraint messages while operations to
change the direction in the JVB session are in progress so we currently
have no predictable way to properly suspend video without races.
Since this will be solved when we move to transceivers, this is a
compromise we are making.
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.
fix(JingleSessionPC) Do not force track removal at pc level on user leave.
When a user leaves, the ssrcs associated with the ep are removed from the remote description and a renegotiation is forced. The browser then fires 'removetrack' event on the associated MediaStream when sRD is called with ssrcs removed. The remote track is then disposed of in the event handler. Therefore, there is no need to delete the tracks at the TPC level before renegotiation. This also prevents the 'Removed track not found for stream' events from showing up in the browser console log.
ref(JingleSession) Recycle m-lines by rejecting them on source removal.
* ref(JingleSession) Recycle m-lines by rejecting them on source removal.
By rejecting the m-lines on source removal (setting the port to 0 on the associated m-line), m-lines can be recycled for new sources instead of appending new ones.
* chore(deps) update sdp-interop@latest.
* feat: Adds events for session-add, session-remove and session-accept.
* feat: Refactor updating presence for audio/video mute and video type.
This brings few changes and fixes. Thew initial presence will always miss audioMuted and videoMuted value, those will be added on session accept. All updates to presence are done on sessionAccept, on source-add or on source-remove and the only one not signalled when camera track is replaced by video track and vice versa.
This change brings more presence updates when number of participants are below startAudioMuted/startVideoMuted, but when participants are above those numbers we get less presence update. This is important for big meetings.
Fixes wrong videoMuted state, as replace track and mute are both executed in promise, sometimes the replace-track one finishes first and when the mute one is resolved there is no conference object in the track to be able to update the presence (hitting this when we pass the startAudioMuted threshold).
* squash: Put back the tracks for _setTrackMuteStatus and _setNewVideoType.
* squash: Fix line length.
* squash: Fix skip sending presence twice.
* squash: Adds the error to the error callback.
* squash: Fix newJingleErrorHandler.
* Save track source name to JitsiRemoteTrack
* add feature flag checks. code review adjustments.
* eslint cleanup1
* eslint cleanup2
* fix: move sourceName declaration outside of if block.
Co-authored-by: Dennis Dowhy <ddowhy@gmail.com>
Co-authored-by: William Liang <wliang67@bloomberg.net>
ref(JitsiConference) Remove remote tracks from conf before reneg is done.
We do not have to wait for the removal of the ssrcs from the remote description for removing the remote tracks associated with a participant that left the call. This speeds up removal of the participant from call even if the JingleSession modification queue is backed up.
ref(JingleSessionPC) Do not renegotiate on every local source change.
Instead rely on the 'negotiationneeded' event fired by the browser for JVB connection. This makes local source changes faster even if the modification queue is backed up.
* ref(TPC) Configure encodings in one go.
Configure the active state, maxBitrate and degradation preference in one go instead of configuring them separately.
* squash: Address review comments.
* squash: fix a comment.
* feat: Support plain endpoint ID.
Support the ID of the owner of sources being encoded directly instead of
using the full JID.
* feat: Support JSON-encoded sources.
* feat: Advertise support for JSON-encoded sources.