There are scenarios when it's ok to call setP2PStatus again with
the same value. For example when P2P is stopped, before it starts with
the A/B testing mode enabled. It's only important to know that it
happened, but it's not an error, because the code will not execute
and return immediately.
The 'ondatachannel' even listener must be set as soon as
the TraceablePeerConnection is created and before the offer is accepted.
We've observed situations where the ondatachannel event was missed,
because the listener is bound too late from the JingleSessionPC
'acceptOffer' success callback.
* ref: Moves the deployment info variables to config.js
instead of using globals.
* feat: If configured, adds the user's region to presence.
* fix: Guards against accessing undefined properties,
and uses the crossRegion variable from the config.
* style: Fixes formatting.
* ref(JSPC): simplify SSRC owner in P2P
There's no need for any extra extensions for SSRCs owner signalling in
P2P, because it's always the remote peer who owns them.
This also fixes a problem where no SSRC owner was added for 'source-add'
in P2P (for JVB conference Jicofo adds that).
* fix(TPC): always advertise 'sendrecv'
Our media direction is only ever updated on the remote side with
the initial offer (or answer). Because of that we want to advertise
'sendrecv' even if we start with no video (or audio) track.
It is OK to adjust this direction in the localDescription getter,
because it's adjusted again in the setter to the correct value based on
local tracks, so the SDP transformation chain still works fine.
feat(JingleSessionPC): add options for P2P evaluation
Add 'forceJVB121Ratio' config option which allows to enforce JVB
conference even if the P2P connection can be established. In such case
'forceJVB121' permanent analytics property will be added.
Will also set 'p2pFailed' analytics property to 'true' in case ICE fails
on the P2P connection.
Reorders JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED event arguments by
putting TraceablePeerConnection at the end. This way it's easier to
treat it as "library internal".
Will actively terminate P2P session by the responder (not moderator) in
order to shutdown P2P in case of eventual initiator's crash. Otherwise
the responder will stay in P2P for too long (until P2P ICE fails).
Prevents from printing Jingle 'session-terminate' error response in case
both responder and initiator terminates their sessions simultaneously
(gracefully). In that case 'item-not-found' error is returned by each
party, because the session is removed immediately from the memory on
termination (see strophe.jingle.js).
fix(JitsiConference): case for stopping JVB transfer
If for any reason invite for the JVB JingleSession is delayed and
arrives after the P2P connection has been established then
the media transfer needs to be disabled after the offer is accepted.
If the app depends on tracking current tracks state using
"track added/removed" events, the tracks will be leaking if
JitsiConference.leave() method is used. That's because peerconnections
are closed and removed from RTC module and then from onMemberLeft those
events will not be fired, because tracks will be gone with
the peerconnections.
Also removes error message log, because it no longer makes sense if
the tracks can be removed early by "stop P2P" logic without actually
removing them from the TPC. Then when the TPC is closed it will try to
emit the events again. But this time it will not match any tracks in
the JitsiParticipant, because it has been removed already.
Avoid a crash if for whatever reason there is no JVB JingleSessionPC at
the time when P2P is being stopped.
Add FIXME about possible situation where Jicofo invite will arrive after
the P2P has been established already.
Dominant speaker detection which is just based on current audio level of local or remote p2p track. The threshold value is the same used for talk while muted detection.
* move all local deployment properties into window.jitsiAnalyticsPermanentProperties property
no longer need to set jitsiRegionInfo from external_connect, now set from Jitsi meet local.html, can be customized by deployment
* change to using shorter lines by extracting longer property name into a shorter local variable name
* changed to using more generic variable name jitsiDeploymentInfo after discussion with the team
added comment describing source of this variable
* doc(JitsiConference): deprecate 'isInLastN'
The 'isInLastN' method should not be used for the UI purposes, but
ParticipantConnectionStatus value should be used instead.
* fix(ParticipantConn..Status): speed up INACTIVE transition
Before this change when user's video stops playing, after user is
removed from last N we were waiting 2 seconds, before going to INACTIVE
state. This commit reduces the time to 500ms for such case.
* fix(ParticipantConn...): reduce logging
Reduce logging verbosity.
* fix(ParticipantConn...): handle LastN == 0
When LastN is set to 0 we should not rely on video playback and last N
set for figuring out participant connection status.
* fix(JitsiConference): undefined participants
Fixes a crash when this.participants field is accessed from _init.
feat: Allow override of the infrastructure level channel LastN value.
For debugging purposes, it's sometimes useful to override the
infrastructure level channel LastN value via the URL (i.e. by launching
https://meet.example.org/room#config.channelLastN=X). This commit
achieves this by calling the JitsiConference.setLastN method during the
Jitsi conference initialization phase.
* feat: multiple, simultaneous RTP stats
Makes it possible to have remote RTP stats running for more than one
peerconnection at a time.
* feat(stats): report RTT all the time
Will report JVB RTT (and end to end) while in P2P mode and vice versa.
* fix(JitsiConferenceEvents): remove CONNECTION_STATS
CONNECTION_STATS event is no longer emitted.
* fix(AvgRTPStatsReported): users with no video
Do not include FPS == 0 in average remote FPS calculation. Report NaN
for local FPS when video muted or no video device. NaN will be reported
for avg remote FPS if no video is received.
* fix(AvgRTPStatsReported): reset total packet loss
* feat(AvgRTPStatsReported): report 'screen' FPS
Will report average FPS for screen videos separately from camera videos,
but only if available (camera video reports NaN FPS when not available).
* fix(AvgRTPStatsReported): end2endRTT
Needs to report JSON with value.
* feat(AVG RTP stats): separate audio and video bitrate
Will report average audio and video bitrates separately.
* doc(JitsiConference): try to improve comment
* fix(AvgRTPStatsReporter): remove confusing reset
There's no a clear reason for doing reset there.
* ref(AvgRTPStatsReporter): rename var
AvgRTPStatsReporter will calculate arithmetic means of 'n' samples
and submit the values to the analytics module. The 'n' value is
configurable through 'avgRtpStatsN' conference config option. When set
to non-positive value the AvgRTPStatsReporter will be disabled.
The following values are reported:
- average upload bitrate => 'stat.avg.bitrate.upload'
- average download bitrate => 'stat.avg.bitrate.download'
- average upload bandwidth => 'stat.avg.bandwidth.upload'
- average download bandwidth => 'stat.avg.bandwidth.download'
- average total packet loss => 'stat.avg.packetloss.total'
- average upload packet loss => 'stat.avg.packetloss.upload'
- average download packet loss => 'stat.avg.packetloss.download'
- average FPS for remote videos => 'stat.avg.framerate.remote'
- average FPS for local video => 'stat.avg.framerate.local'
- average connection quality as defined by
the ConnectionQuality module => 'stat.avg.cq'
If the conference runs in P2P mode 'p2p.' prefix will be added to
the event's name. Any pending calculations are wiped out on every switch
between P2P and JVB modes and samples have to be collected from
the start.
* ref(CallStats): cleanup constructor
Changes CallStats constructor to not take the whole JingleSessionPC as
it only needs an alias and the TraceablePeerConnection instance.
Describes the arguments in JSDoc.
* ref(CallStats): rename var
Everything is callstats c'mon...
* ref(CallStats): remove _checkInitialize
The _checkInitialize was trying to workaround CallStats lib issue
without really checking for any specific type of error on whether or not
it makes sense to retry.
Also it depended on some internal fields of 'callStatsBackend' and was
binding 'initCallback' to the backend instead of CallStats instance
which made no sense (it means it's very likely this functionality was
broken anyway).
It would be hard to fix it in a clean way, because CallStats instance
fields would have to be stored in static variables in order to make
the initCallback work (called from '_checkInitialize').
We also need to have more than one CallStats instance running at the
same time, because of the P2P which makes things even more complex.
* fix(CallStats): do not catch 'sendApplicationLog'
Wrapping 'sendApplicationLog' in 'tryCatch' will result in an endless
loop, because it will be logged on the logger.error which then tries
to send the logs immediately again.
* ref(CallStats): do not use call on static
There's nothing more confusing that seeing 'this' in a static method.
Wow maybe these methods are not really static !?
* ref(stats): fix var name
* feat(stats): report P2P to CallStats
Will create new CallStats fabric for the P2P peerconnection in order to
log peer to peer connections.
Refactoring was required in the statistics and CallStats module to be
able to have more than one CallStats instance. Because each CallStats
fabric reports one peer connection now each CallStats will correspond to
one TraceablePeerConnection. CallStats instances are now stored in a Map
mapped by the TraceablePeerConnection.id field.
In order to be able to execute some global/static CallStats reporting
methods all Statistics instances also need to be stored in a static
field.
CallStats API backend(new callstats()) will be initialized only once for
the values provided in the first call to initializeBackend. It is not
possible to have more that one CallStats backend running at the same
time (at the time of this writing). If we would have a routine for
disposing global "Statistics" module we could try to cleanup static
reference and allow to initialize it with new values (but no such use
case yet).
* ref(CallStats): move initCallback
Since there is no alphabetic order preserved in this file anyway at
least place it closer to it's usage.
* ref(CallStats): remove tryCatch
Temporarily removes tryCatch to make the ES6 conversion easier.
* ref(CallStats): convert to ES6
* style(CallStats): fix indentation
* fix(statistics): use import for CallStats
* ref(CallStats): convert static methods
Some of the methods should not be static, because it only make sense
to call it when there is CallStats instance available.
* ref(CallStats): rename var
* doc(CallStats): remove misplaced comment
* chore(CallStats): remove invalid eslint comment
* fix(CallStats): undefined CallStats namespace
If no CallStats ID namespace option is provided the conference will be
reported without it.
* style(stats|CallStats): remove extra lines
* fix(CallStats): do not log error from tryCatch
GlobalOnErrorHandler calls logger.error anyway.
* fix(CallStats): cleanup tryCatch
If I understand correctly our initial intention with doing tryCatch was
to avoid crashing the whole app in case the CallStats backend would
crash. With this commit the tryCatch is done by wrapping original
backend instance methods or using explicit try catch block where
the method is called only from one place or a value needs to be returned
in case of a crash.
* ref(CallStats): make backend a static var
* fix(CallStats): invalid eslint comments
* ref(CallStats): use for..of
* ref(CallStats): fixes around REST args
* ref(CallStats): rename var
* ref(CallStats): reorder static methods
Also renamed some callbacks
* doc(CallStats): adds some docs
* ref(CallStats): make methods not static
Both 'sendDominantSpeakerEvent' and 'sendScreenSharingEvent' methods are
not really static as they require instance to be called.
* fix(CallStats): invalid key
* fix(CallStats): reduce amount of debug logs
* feat(p2p|CallStats): log hold/resume
Will put CallStats fabric for the JVB connection "on hold" while in p2p
mode.
* doc(CallStats): add FIXME
* doc(JitsiConference,CallStats): typos and renaming
When muted track was added to conference "mute" operation was
executed again which was not executing anything because the state
of the track was already muted.
* Adds peer connection statuses (active/inactive/interrupted/restoring).
The peer connection used to be check with is connection active. Adding new states like active, inactive, when the connection was intentionally stopped by the bridge, interrupted due to network problem and restoring, which is the state of a peer which was inactive as being out of lastN and is now entering lastM and eventually will become active.
* Adds timers to track restoring status.
If restoring too long we set the connection status to interrupted. We save timestamps for all participants entering lastN and set the status for the connection to restoring for 5 seconds, or till it goes into active or exits lastN.
* Adds initial connectionStatus of newly created participant - active.
* Fixes some jsdocs.
* Uses symbols for strings and use of map, fixing comments on PR.
* Removes symbols.
* ref(JingleSessionPC): add local tracks with offer/answer
Refactor the current code to add local tracks together with initial
offer/answer to make this atomic/single operation on
the modificationQueue.
This is required to be able to get rid of 'delayedIceCandidates' list
and to execute 'addIceCandidate' task on the queue. If local track
addition is not bundled with initial offer it will often happen that ICE
candidates are queued, before the offer/answer which is queued only once
the local tracks task is done.
* ref(JSPC): use queue for ICE candidates
Refactors the code to get rid of 'delayedIceCandidates' buffer and
use the modification queue to synchronise with the initial offer/answer.
* doc(JingleSessionPC): improve docs
* ref(p2p): use SDP 'inactive' for JVB
This commit gets rid of detach/attach logic and
replaces it with SDP media direction modification.
Now after switching to P2P instead of detaching local
tracks from the JVB peerconnection only the media direction
will be changed to 'inactive'. This will suspend media
transfer on the JVB connection.
It's meant to mitigate Chrome issue where it would randomly
choose to stop sending audio stream, after we modify it's
local SSRC.
* ref(SdpConsistency): cleanup 'recvonly'
Checking on 'recvonly' is no longer reliable way for detecting
whether video media is recvonly, because it can be set to
'inactive' at any point.
Added a check to make sure that the recvonly SSRC is not generated
more than once from '_createOfferOrAnswer'.
* log TPC instance
Logs the TraceablePeerConnection from LocalSdpMunger and
SdpConsistency as part of log messages. Given that there can be
2 TPCs at the same time it was hard to tell for which connection
a log message was printed.
* fix(SdpConsistency): depend on 'recvonly' direction
When createAnswer/createOffer returns SDP it will contain 'recvonly'
direction to reflect current media stream state even though we set
it to 'sendrecv' previously. Using 'hasAnyTracksOfType(VIDEO)' can
not be used to reliably detect 'recvonly' direction when doing video
mute, because muted video track is still in the TPC's map.
* doc(LocalSdpMunger): update description
LocalSdpMunger is currently used only for muted local video tracks.
* fix(P2P): enable P2P on Firefox
After 'detach/attach' is gone it seems that P2P works fine with Firefox.
* ref(TPC): simplify expression
* ref(SdpConsistency): do not pass whole TPC
There's no need to pass whole TPC instance if the only thing needed is
a logging prefix.
* Adds video sip gw handling.
Parsing presence and availability of the service. Adding possibility to start/stop a video sip gw session.
* Fix comments.
* Adds more jsdoc about create session and renames import to use the filename is imports.
* ref(RTC): store remote tracks in peer TPC
In order to implement P2P <-> JVB connection switching we need to
be able to associate remote tracks with the TraceablePeerConnections.
* feat(ChatRoom): multiple presence handlers
Add support for more than 1 presence handler per tag name.
* feat(JitsiLocalTrack): update stored MSID
* ref(stats): add peer connection arg to BYTE_SENT_STATS
Required to store local SSRCs in TraceablePeerConnection.
* ref: change local SSRCs strategy
* fix: generate recvonly SSRC if 0 video tracks
Video SSRC has to be generated for the recvonly stream if there are no
video tracks in the PeerConnection.
* feat: add "attach" and "detach" methods
* feat(jitsi tracks): improve logging
Adds toString methods and improve log messages around local and remote
tracks.
* ref(modify SSRCs): optimisations + fixes
- adds _doRenegotiate to JingleSessionPC that wraps some of
the duplicated logic
- fixes problems with attach/detach
- renames methods to reflect what that they really do (operate on
JitsiTrack rather than streams)
* ref(JingleSessionPC): remove duplication
Extracts common code for the 'modificationQueue' execution
* ref(VideoMuteSdpHack): rename, add docs, fix minor
Renames, adds docs and moves 'modified' flag and media direction
modification.
* ref(TPC): add 'isSimulcastOn'
* ref(MungeLocalSdp): move to RTC module
* ref: move "ufrag" events to the RTC module
* ref(JitsiConference): use promises for mute
* feat(XMPPEvents): add CONNECTION_ESTABLISHED
* feat: add peer to peer
* fix(P2P): deal with everyone's a moderator + fixes
* feat(P2P): implement "backToP2PDelay"
* fix(TPC): crash on FF accessing LD/RD
Firefox return null/undefined for localDescription/remoteDescription
objects if they have not been set yet, while Chrome does return empty
object instead. This commit makes the behaviour consistent by making
sure that at least empty object is returned for all browsers.
* fix(TPC): replace isFirefox with feature
* fix(JSPC): fix renegotiate crash on FF
FF does not allow to call 'createAnswer' in 'have-local-offer' state
* fix(JSPC): fix addIceCandidate crash on FF
* doc(JitsiConference): fix outdated comment
To be squashed with "ref(ChatRoom): remove unnecessary JingleSessionPC dependency"
* style(JitsiConference): rename arg to "jingleSession"
* feat(stats): add 'p2p' to 'transport'
The new p2p field will inform whether the transport comes from the peer
to peer type of connection or not.
* doc(TPC): describe local maps
* fix(P2P): multiplex between JVB and P2P ICE status
Will make sure that when in P2P mode the conference will be updated
with the ICE state coming from P2P and when in the JVB mode will get
the JVB one.
* doc(TPC): fixes docs and adds FIXME
* ref: use 'doesVideoMuteByStreamRemove'
* feat(P2P): stop P2P when ICE enters FAILED
The conference will switch back to the JVB connection when P2P
connection breaks (ICE enters failed state).
* feat(P2P): "connectivity-error" for ICE failed
Will use "connectivity-error" reason element name when ending P2P
session due to ICE failure.
* feat(xmpp): make P2P Stun servers configurable
STUN servers used in the P2P connection can be configured through
"p2pStunServers" option.
* ref(JitsiConference): use 'getActivePeerConnection'
* fix(P2P): re-create 'dtmfManager'
* ref(P2P): deal with ICE "completed" state
* ref(RTC): rename "owner" to "ownerEndpointId"
* fix(MungeLocalSdp): fix directions
* ref(ParticipantConnectionStatus): use for..of and () =>
* remove double 'l'
* ref: fix ESLint errors
* fix(MungeLocalSdp): adopt to new SdpTransformerUtil
* ref(MungeLocalSdp): use for .. of
* ref(SdpTransformUtil): remove "forEachSSRCAttr"
* fix(SDPDiffer): fix invalid "arrayEquals" call
* doc(MungeLocalSdp): add fixme
* fix(P2PEnabledConference): JVB tracks not added
* ref(JitsiConference): doc + rename mute methods
* ref(JitsiConference): adjust log level
* fix(JitsiConference): remove invalid eslint comments
Some mistake during rebase merge
* doc(JitsiConference): add FIXME
* ref(JitsiConferenceEventManager): stick to "tpc"
* ref(JitsiLocalTrack): use Set for "peerConnections"
* ref(JitsiLocalTrack): simplify expression
* ref(MungeLocalSdp): style + doc fixes
* ref: rename MungeLocalSdp to LocalSdpMunger
* ref(ParticipantConn..Status): rename method
* ref(SignalingLayerImpl): use Map and =>
* fix(strophe.jingle.js): minor style fixes + rename
* doc(XMPPEvents): typo
* doc(P2PEnabledConference): typo and style
* ref(P2PEnabledConference): rename methods
* ref(P2PEnabledConference): do not use "window"
* fix(P2PEnabledConference): cleanup deferred task
* ref(TPC): make options the last arg
* ref(TPC): use Map
* ref(TPC): syntax and other fixes...
* doc(ChatRoom): remove comment
* ref: remove P2PEnabledConference
* fix: remove JSUtil.js
* ref(LocalSdpMunger): re-use 'RtxModifier'
Reuses RtxModifier for injecting local RTX SSRCs as part of
the LocalSdpMunger logic.
* doc(LocalSdpMunger): remove confusing FIXME
* fix(TPC): setLocalDescription for FF
* fix(LocalSdpMunger): crash on react-native
* fix(JingleSessionPC): no events when ended
The instance once terminated should not emit connection state events.
* fix(P2P): do not start P2P on react-native
* fix: log meaningful error
Prior to this change you would see something like:
JitsiConference <error>: null
* fix(JingleSessionPC): no IQs once ended
* fix(JingleSessionPC): Jingle error logging
* fix: arguments order
* fix: make audio SSRC consistent
Audio SSRC needs to stay consistent between detach and attach operations
in order to avoid source-remove/source-add.
* fix(P2P): disable P2P on FF
There are problems with going back from P2P to JVB in FireFox. Other
participants will not see FF video. Looks like something related to
detach/attach.
* fix(JitsiConference): attach local tracks
Local tracks should be attached back to the JVB connection only
if the P2P was established.
* ref(JitsiConference): PR review fixes
ref(JitsiConference): else if
ref(JitsiConference): use getter
doc(JitsiConference): add comment
style(JitsiConference): remove extra line
log(JitsiConference): misleading msg
ref(JitsiConference): rename method
* ref(RTC): del _iteratePeerConnections
* ref: move getUfrag to SDPUtil
* fix(LocalSdpMunger): docs and if check
* fix(TPC): docs and typo
* ref(JingleSessionPC): PR review fixes
ref(JingleSessionPC): rename 'candidates'
ref(JitsiConference): remove extra check
ref(JitsiConference): rename isP2PEstablished
ref(JitsiConference): rename field (typo)
* doc(JitsiConferenceEventManager): typo
* ref(JitsiLocalTrack): rename var
* ref(JitsiConference): PR review fixes
ref(JitsiConference): rename var
doc(JitsiConference): add comment
doc(JitsiConference): add comment
doc(JitsiConference): fix comment
ref(JitsiConference): rename listener
ref(JitsiConference): rename var
* doc(RTC): remove duplicated arg description
doc(RTC): fill docs
* doc(SignalingLayerImpl): remove fixed FIXME
* ref(strophe.jingle.js): remove comment and break line
* style(TPC): formatting
doc(TPC): add FIXME
ref(TPC): remove unused code
doc(TPC): add docs
* doc(JingleSessionPC): mark "send" methods private
style(JingleSessionPC): extra lines