bpacket.flush();
byte[] bpacketData = bpacket.getPacket();
byte [] packetData = new byte[spacketData.length+bpacketData.length];
System.arraycopy(spacketData, 0, packetData, 0, spacketData.length);
System.arraycopy(bpacketData, 0, packetData, spacketData.length, bpacketData.length);
TransportPacket tpacket = new TransportPacket(packetData.length,packetData);
rtcpiTransport.sendTransportPacket(tpacket);
byeSent=true;
} catch (Exception ex) {
System.err.println("Rtpi: could not send BYE packet when leaving the group, error was: "+ex);
}
rtcpiTransport.leaveGroup();
return;
}
} else {
initial=false;
RtcpiSourceDescriptionPacket spacket;
RtcpiSubcomponentReportPacket rpacket;
try {
//System.out.println("sending ADU");
checkTimeouts(); // we do not need to perform the reverse reconsideration algorithm since
// we are about to calculate a new transmission interval anyway.
spacket=constructSdesPacket();
spacket.flush();
byte[] spacketData = spacket.getPacket();
rpacket=constructSubRepPacket();
//System.out.println("created subreppacket: " + rpacket);
TransportPacket tpacket=null;
int tpacketLength=0;
if (rpacket==null) {
tpacket= new TransportPacket(spacketData.length, spacketData);
tpacketLength=spacketData.length;
} else {
rpacket.flush();
byte[] rpacketData = rpacket.getPacket();
byte [] packetData = new byte[spacketData.length+rpacketData.length];
System.arraycopy(spacketData, 0, packetData, 0, spacketData.length);
System.arraycopy(rpacketData, 0, packetData, spacketData.length, rpacketData.length);
tpacket = new TransportPacket(packetData.length,packetData);
tpacketLength=packetData.length;
}
rtcpiTransport.sendTransportPacket(tpacket);
//System.out.println("Sending tpacket: " + tpacket);
avg_rtcpi_size=(int) (avg_rtcpi_size*OLD_FACTOR+(tpacketLength+rtcpiTransport.getHeaderSize())*NEW_FACTOR);