Commit Graph

10114 Commits

Author SHA1 Message Date
Nextcloud bot
c821fc6a96
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-01-09 14:34:01 +00:00
Nextcloud bot
83fdb1cdba
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-01-09 14:10:00 +00:00
Marcel Hibbe
dd37c7e08c
Merge pull request #4582 from nextcloud/backport/4551/stable-20.1
[stable-20.1] show message send button when there is text in input message field
2025-01-08 17:47:59 +01:00
sowjanyakch
f19cb6c1e1 show send button when there is text in input message field
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
2025-01-08 15:59:04 +00:00
Marcel Hibbe
41d2535d51
Merge pull request #4581 from nextcloud/backport/4558/stable-20.1
[stable-20.1] Fix sending local state to other participants
2025-01-08 14:09:16 +01:00
Daniel Calviño Sánchez
e3d274252e Send state also through signaling messages
The speaking state is still sent only through data channels, as it is
not currently handled by other clients when sent through signaling
messages.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
eb35a2ed9a Rename variable
This will be used to have separate counts for data channel and signaling
messages.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
57ed4340f8 Add support for sending signaling messages in the MessageSender
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
0e258e91e0 Move attributes to local variables
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
a5bbff7e92 Send current state to remote participants when they join
Note that this implicitly send the current state to remote participants
when the local participant joins, as in that case all the remote
participants already in the call join from the point of view of the
local participant

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
0443bff9ca Add support for sending data channel messages to a single participant
This is not possible when Janus is used, as Janus only allows
broadcasting data channel messages to all the subscribers of the
publisher connection.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
036e4b4403 Add helper class to broadcast the local participant state
The LocalStateBroadcaster observes changes in the
LocalCallParticipantModel and notifies other participants in the call as
needed. Although it is created right before joining the call there is a
slim chance of the state changing before the local participant is
actually in the call, but even in that case other participants would not
be notified about the state due to the MessageSender depending on the
list of call participants / peer connections passed to it, which should
not be initialized before the local participant is actually in the call.

There is, however, a race condition that could cause participants to not
be added to the participant list if they join at the same time as the
local participant and a signaling message listing them but not the local
participant as in the call is received once the CallParticipantList was
created, but that is unrelated to the broadcaster and will be fixed
in another commit.

Currently only changes in the audio, speaking and video state are
notified, although in the future it should also notify about the nick,
the raised hand or any other state (but not one-time events, like
reactions). The notifications right now are sent only through data
channels, but at a later point they will be sent also through signaling
messages as needed.

Similarly, although right now it only notifies of changes in the state
it will also take care of notifying other participants about the current
state when they join the call (or the local participant joins).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
2b98a994ff Add data model for local call participants
This is the counterpart of CallParticipantModel for the local
participant. For now it just stores whether audio and video are enabled
or not, and whether the local participant is speaking or not, but it
will be eventually extended with further properties.

It is also expected that the views, like the button with the microphone
state, will update themselves based on the model. Similarly the model
should be moved from the CallActivity to a class similar to
CallParticipant but for the local participant. In any case, all that is
something for the future; the immediate use of the model will be to know
when the local state changes to notify other participants.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
756e2cd8cb Send data channel messages only to "video" peer connections
Data channel messages are expected to be sent only to peer connections
with "video" type, which provide the audio and video tracks of the
participant (and, in fact, peer connections for screen shares do not
even have data channels enabled in the WebUI).

Note that this could change if at some point several audio/video tracks
are sent in the same peer connection, or if "speaking" messages are
added to screen shares, but that will be addressed if/when that happens.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
c0ab707523 Add helper class to send messages to call participants
For now it just provides support for sending a data channel message to
all participants, so notifying all participants when the media is
toggled or the speaking status change can be directly refactored to use
it.

While it would have been fine to use a single class for both MCU and no
MCU they were split for easier and cleaner unit testing in future
stages.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Daniel Calviño Sánchez
514efdd0b3 Set "hasMCU" once its value is known
"hasMCU" (which has always been the wrong name, because it is an SFU
rather than an MCU, but it is wrong even in the signaling server so for
now the legacy name is kept) was set again and again whenever the call
participant list changed. Now it is set instead once its value is known,
that is, when it is known that the internal signaling server is used (as
no "MCU" is used in that case), or when the connection with the external
signaling server is established, as its supported features are not known
until then.

This change should have no effect in the usages of "hasMCU", as it is
used when the call participant list change, which will happen only after
joining the call in the signaling server, or when sending "isSpeaking"
and toggling media, in both cases guarded by "isConnectionEstablished",
which will be true only once "performCall" was called or if the call is
active with other participants.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-08 12:50:53 +00:00
Marcel Hibbe
a90bfe3d60
Merge pull request #4578 from nextcloud/backport/4553/stable-20.1
[stable-20.1] open .webm video files with internal player
2025-01-08 10:50:52 +01:00
sowjanyakch
b3ff5fae20 open .webm video files with internal player
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
2025-01-07 18:59:54 +00:00
Nextcloud bot
1ce30f54d9
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-01-04 03:03:54 +00:00
Marcel Hibbe
c3df5863a0
Merge pull request #4576 from nextcloud/backport/4569/stable-20.1
[stable-20.1] Fix audio and video not received
2025-01-03 14:42:50 +01:00
Daniel Calviño Sánchez
7287a45907 Fix SDP constraints used by PeerConnectionWrapper
The SDP constraints for publisher connections when the MCU is used were
set for all connections. Those constraints set "OfferToReceiveAudio" and
"OfferToReceiveVideo" to false, which disables receiving audio and video
when the local participant is the one sending the offer. Therefore,
audio and video was not received when the MCU was not used and the local
participant was the one initiating the connection.

The "OfferToReceiveXXX" configurations have no effect when set on an
answer (and thus are not even set, an empty MediaConstraints is used in
that case). However, when "OfferToReceiveVideo = false" is set the video
transceiver is explicitly stopped (which is used to avoid receiving
video when joining a call with audio only). Therefore, as
"OfferToReceiveVideo = false" was always set, video was never received
in subscriber connections when the MCU is used, or connections initiated
by the other peer when the MCU is not used.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 12:47:16 +00:00
Daniel Calviño Sánchez
94fba1fc35 Rename attribute to a more accurate name
The SDP constraints should be set when the MCU is used, but only for
publisher connections; receiver connections should use the general SDP
constraints.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 12:47:16 +00:00
Andy Scherzinger
058db13660
Merge pull request #4575 from nextcloud/backport/4574/stable-20.1
[stable-20.1] Convert log class to kotlin
2025-01-03 13:29:03 +01:00
Marcel Hibbe
b1145c5d12 convert Log class to kotlin
@JvmStatic is necessary to keep the static behavior of the method calls

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
2025-01-03 12:14:11 +00:00
Marcel Hibbe
6ce95de3c9 Rename .java to .kt
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
2025-01-03 12:14:11 +00:00
Marcel Hibbe
958d4c30a5
Merge pull request #4572 from nextcloud/backport/4536/stable-20.1
[stable-20.1] Improve handling of data channels
2025-01-03 12:47:25 +01:00
Daniel Calviño Sánchez
f4380f0833 Fix "send" not respecting order of pending messages
When the data channel is not open yet data channel messages are queued
and then sent once opened. "onStateChange" is called from the WebRTC
signaling thread, while "send" can be called potentially from any
thread, so to send the data channel messages in the same order that they
were added new messages need to be enqueued until all the pending
messages have been sent. Otherwise, even if there is synchronization
already, it could happen that "onStateChange" was called but, before
getting the lock, "send" gets it and sends the new message before the
pending messages were sent.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
cb81bca72a Fix "removePeerConnection" not being thread-safe
Adding and disposing remote data channels is done from different
threads; they are added from the WebRTC signaling thread when
"onDataChannel" is called, while they can be disposed potentially from
any thread when "removePeerConnection" is called. To prevent race
conditions between them now both operations are synchronized.

However, as "onDataChannel" belongs to an inner class it needs to use a
synchronized statement with the outer class lock. This could still cause
a race condition if the same data channel was added again; this should
not happen, but it is handled just in case.

Moreover, once a data channel is disposed it can be no longer used, and
trying to call any of its methods throws an "IllegalStateException". Due
to this, as sending can be also done potentially from any thread, it
needs to be synchronized too with removing the peer connection.

State changes on data channels as well as receiving messages are also
done in the WebRTC signaling thread. State changes needs synchronization
as well, although receiving messages should not, as it does not directly
use the data channel (and it is assumed that using the buffers of a
disposed data channel is safe). Nevertheless a little check (which in
this case requires synchronization) was added to ignore the received
messages if the peer connection was removed already.

Finally, the synchronization added to "send" and "onStateChange" had the
nice side effect of making the pending data channel messages thread-safe
too, as before it could happen that a message was enqueued when the
pending messages were being sent, which caused a
"ConcurrentModificationException".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
bbeb85d8a3 Store data channel label
Getting the label is no longer possible once the data channel has been
disposed. This will help to make the observer thread-safe.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
89a69327c8 Add logs for sending data channel messages
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
f387e57628 Queue data channel messages sent when data channel is not open
Data channel messages can be sent only when the data channel is open.
Otherwise the message is simply lost. Clients of the
PeerConnectionWrapper do not need to be aware of that detail or keep
track of whether the data channel was open already or not, so now data
channel messages sent before the data channel is open are queued and
sent once the data channel is opened.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
4eaa2f3e2c Split condition
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
f34bc17b36 Rewrite method to return early
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
a3cf897d13 Move variable declaration into try block
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
014b18de89 Fix remote data channels not disposed when removing peer connection
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
3ffc6db56d Send data channel messages using "status" data channel
Data channel messages are expected to be sent using the "status" data
channel that is locally created. However, if another data channel was
opened by the remote peer the reference to the "status" data channel was
overwritten with the new data channel, and messages were sent instead on
the remote data channel.

In current Talk versions that was not a problem, and the change makes no
difference either, because since the support for Janus 1.x was added
data channel messages are listened on all data channels, independently
of their label or whether they were created by the local or remote peer.

However, in older Talk versions this fixes a regression introduced with
the support for Janus 1.x. In those versions only messages coming from
the "status" or "JanusDataChannel" data channels were taken into
account. When Janus is not used the WebUI opens the legacy
"simplewebrtc" data channel, so that data channel may be the one used to
send data channel messages (if it is open after the "status" data
channel), but the messages received on that data channel were ignored by
the WebUI. Nevertheless, at this point this is more an academic problem
than a real world problem, as it is unlikely that there are many
Nextcloud servers with Talk < 16 and without HPB being used.

Independently of all that, when the peer connection is removed only the
"status" data channel is disposed, but none of the remote data channels
are. This is just a variation of an already existing bug (the last open
data channel was the one disposed due to being the last saved reference,
but the rest were not) and it will be fixed in another commit.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
d1a4265491 Rename "sendChannelData" to "send"
The legacy name was a bit strange, so now it is renamed to just "send"
as the parameter type ("DataChannelMessage") gives enough context.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
1f4c25caa3 Include data channel label in log message
This implicitly fixes trying to send the initial state on the latest
remote data channel found (which is the one stored in the "dataChannel"
attribute of the "PeerConnectionWrapper") when any other existing data
channel changes its status to open. Nevertheless, as all this will be
reworked, no unit test was added for it.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
0555e0edbd Unify log messages for received data channel messages
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
a43a33a16a Add unit tests for receiving data channel messages
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
26be065545 Add dummy Log implementation to be used in tests
Log methods are static, so they can not be mocked using Mockito.
Although it might be possible to use PowerMockito a dummy implementation
was added instead, as Log uses are widespread and it is not something
worth mocking anyway.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:22 +00:00
Daniel Calviño Sánchez
a1eb90da9f Remove Dagger related code from PeerConnectionWrapper
The PeerConnectionWrapper does not need to be injected in the
application, nor the Context needs to be injected in the
PeerConnectionWrapper. This all seems to be leftovers from the past, and
removing them would ease adding unit tests for the
PeerConnectionWrapper.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-01-03 11:29:21 +00:00
Nextcloud bot
3aa2be2ece
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-01-03 03:04:18 +00:00
Nextcloud bot
1628993b73
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-28 03:04:45 +00:00
Nextcloud bot
159096cc64
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-27 03:04:41 +00:00
Nextcloud bot
3e59a289f7
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-26 03:04:53 +00:00
Nextcloud bot
bfe7a6576f
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-25 03:04:26 +00:00
Nextcloud bot
7cf93e9ffc
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-24 03:02:29 +00:00
Nextcloud bot
cb51f85037
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-23 03:02:16 +00:00
Nextcloud bot
ced2ac0951
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-12-22 03:19:17 +00:00