Fix data channel suport with newer Janus versions

When Janus is used even if it is possible to open several data channels
with different labels and send data on them all the messages are
received in the first data channel opened.

In Talk the "status" data channel is used to send the data channel
messages, and before Janus 0.7.0 it was the first data channel opened,
so the messages were received on it.

However, since Janus 0.7.0 the data channel messages are received
instead on a data channel opened by Janus, which is named
"JanusDataChannel". It is not possible to change that behaviour on Janus
except by patching it, so for broader compatibility the messages
received in "JanusDataChannel" are treated like messages received in the
"status" data channel

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2020-10-02 20:15:03 +02:00
parent 93c12a89de
commit fcb45e94f3

View file

@ -406,7 +406,7 @@ public class MagicPeerConnectionWrapper {
@Override @Override
public void onDataChannel(DataChannel dataChannel) { public void onDataChannel(DataChannel dataChannel) {
if (dataChannel.label().equals("status")) { if (dataChannel.label().equals("status") || dataChannel.label().equals("JanusDataChannel")) {
magicDataChannel = dataChannel; magicDataChannel = dataChannel;
magicDataChannel.registerObserver(new MagicDataChannelObserver()); magicDataChannel.registerObserver(new MagicDataChannelObserver());
} }