talk-android/app/src/main/java/com/nextcloud/talk/call/MessageSenderNoMcu.java
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

31 lines
954 B
Java

/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2024 Daniel Calviño Sánchez <danxuliu@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package com.nextcloud.talk.call;
import com.nextcloud.talk.models.json.signaling.DataChannelMessage;
import com.nextcloud.talk.webrtc.PeerConnectionWrapper;
import java.util.List;
/**
* Helper class to send messages to participants in a call when an MCU is not used.
*/
public class MessageSenderNoMcu extends MessageSender {
public MessageSenderNoMcu(List<PeerConnectionWrapper> peerConnectionWrappers) {
super(peerConnectionWrappers);
}
public void sendToAll(DataChannelMessage dataChannelMessage) {
for (PeerConnectionWrapper peerConnectionWrapper: peerConnectionWrappers) {
if ("video".equals(peerConnectionWrapper.getVideoStreamType())){
peerConnectionWrapper.send(dataChannelMessage);
}
}
}
}