Regular DatagramSocket works fine... ICE4J DatagramSocket seems to truncate data!?
The sending size packet is 2,500 but the receiving end is always 1500 (with regular Java DatagramSocket the receive packet size is the same as the send size).
Receive End:
Component rtpComponent = stream.getComponent(org.ice4j.ice.Component.RTCP);
CandidatePair rtpPair = rtpComponent.getSelectedPair();
videoDS = rtpPair.getDatagramSocket();
In a Thread:
byte[] buffer = new byte[250000000];
final DatagramPacket dp = new DatagramPacket(buffer, buffer.length);
videoDS.receive(dp);
final byte[] clone = new byte[dp.getLength()];
System.arraycopy(dp.getData(), dp.getOffset(), clone, 0, dp.getLength());
final Image image = new Image(new ByteArrayInputStream(clone));
The sending side is pretty much the same except it is run on an Android...
The only difference between non-working code is that the first paragraph is used for Sending and Receiving. If I use a regular Java Socket it will work (but of course not behind routers, which is why I am using Ice4J).
I found the prime issue....
See org.ice4j.stack.Connector line 160
/*
* Make sure localSock's receiveBufferSize is taken into
* account including after it gets changed.
*/
int receiveBufferSize = 1500;
The data is CLEARLY being cutoff.... see line 188
packet.setData(
new byte[receiveBufferSize],
0,
receiveBufferSize);
....
localSock.receive(packet); //line 200
My Current solution is to edit the receiveBufferSize to 25000 and the actual packet data is the correct amount. Perhaps I will request to merge.