webrtc-java
webrtc-java copied to clipboard
Ununderstandible behaviour of data channel
Test scenario:
Chunk size 15kb. For 200 files (avg 5 parallel downloads)
- Open datachannel (line 1..5 below)
- Transmit 5Mb file (sending chunks via channel.send(RTCDataChannelBuffer))
- Close data channel (after receiving confirmation from receiver or by timeout (1 minute))
Result: after ~100 successfully downloaded files I see next behaviour
After executing line 1..5 channel change state immediately to CLOSING -> CLOSED. State of the peerConnection = 'connected'
1. RTCDataChannelInit init = new RTCDataChannelInit();
2. init.priority = RTCPriorityType.VERY_LOW;
3. init.ordered = true;
4. RTCDataChannel fileChannel = rtcClient.peerConnection.createDataChannel(channelName, init);
5. fileChannel.registerObserver(new FileDownloaderRTCDataChannelObserver(fileChannel, fileResourceId, downloadStream));
6.
7. class FileDownloaderRTCDataChannelObserver implements RTCDataChannelObserver {
8. ...
9. @Override
10. public void onStateChange() {
11. File fileToTransmit = downloadStream.getFile();
12. RTCDataChannelState state = fileChannel.getState();
13. switch (state) {
14. case OPEN -> {
15. log.info("File download channel opened: {}", fileChannel.getLabel());
16. .......
17. }
18. case CLOSED -> {
19. log.info("File download channel closed: {}", fileChannel.getLabel());
20. ...
21. }
22. }
23. }
24. ...
25. }
Expected behaviour: Channel should not closed after creation.
- OS: Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz, 12 cores, 31G, Windows 10 , 64 bit Build 19041 (10.0.19041.2364)
- JRE version: Java(TM) SE Runtime Environment (17.0.2+8) (build 17.0.2+8-LTS-86)
- webrtc 0.7.0
- spring-boot 2.7.5
Additional context
- After reconnecting peer client (refresh page in browser) data channel beginning to work.
- Some strange on the Ethernet graphic in Task manager I see execution of the code below in debug mode
RTCDataChannelBuffer channelBuffer = new RTCDataChannelBuffer(byteBuffer, true);
channel.send(channelBuffer);
But I don't see the network traffic. states of peer connection = connected, channel = open (When file transmittion is active this line generates traffic 10-15 mbits)