try {
while(currentStart<length) {
switch (RtcpiPacket.inspectPayloadType(data,currentStart)) {
case RtcpiSourceDescriptionPacket.SDES:
rtcpiPacket = new RtcpiSourceDescriptionPacket(data, currentStart);
rtcpiPacket.parse();
rtcpiPackets.add(rtcpiPacket);
break;
case RtcpiByePacket.BYE:
rtcpiPacket = new RtcpiByePacket(data, currentStart);
rtcpiPacket.parse();
rtcpiPackets.add(rtcpiPacket);
break;
case RtcpiSubcomponentReportPacket.SUBREP:
rtcpiPacket = new RtcpiSubcomponentReportPacket(data, currentStart);
rtcpiPacket.parse();
rtcpiPackets.add(rtcpiPacket);
break;
default:
System.err.println("Rtpi: Unknown Rtcpi packet received -ignored! Type was "+RtcpiPacket.inspectPayloadType(data,currentStart));
}
currentStart+=RtcpiPacket.inspectLength(data,currentStart);
}
} catch (Exception ex) {
System.err.println("Rtpi: invalid RTCP/I compound packet received - ignored! Error was: "+ex);
return;
}
if(!(rtcpiPackets.getFirst() instanceof RtcpiSourceDescriptionPacket)) {
System.err.println("Rtpi: Received invalid RTCP/I compound packet. It did not start with an SDES packet!");
return;
}
RtcpiSourceDescriptionPacket sdesPacket=(RtcpiSourceDescriptionPacket) rtcpiPackets.getFirst();
LinkedList items = sdesPacket.getSourceDescriptionItems();
if (((SourceDescriptionItem) items.getFirst()).getType()!=SourceDescriptionItem.CNAME) {
System.err.println("Rtpi: Received invalid RTCP/I compound packet. SDES packet did not start with a CNAME item!");
return;
}
// now we are sure that we have received a valid RTCPI packet!
avg_rtcpi_size=(int) (avg_rtcpi_size*OLD_FACTOR+(packet.getLength()+rtcpiTransport.getHeaderSize())*NEW_FACTOR);
RtpiSourceInfo info = (RtpiSourceInfo) remoteParticipants.get(new Integer(sdesPacket.getParticipantID()));
if (info!=null) {
info.heardFrom();
//System.out.println("calling heardFrom for source info: " + sdesPacket.getParticipantID());
}