Package rtpi.packets

Examples of rtpi.packets.RtcpiSourceDescriptionPacket


      rtcpiTransport.leaveGroup();
      return;
  }
  if (members<MAX_PARTICIPANTS_FOR_IMMEDIATE_BYE) {
      try {
    RtcpiSourceDescriptionPacket spacket=constructSdesPacket();
    spacket.flush();
    byte[] spacketData = spacket.getPacket();
    RtcpiByePacket bpacket=new RtcpiByePacket(localParticipant.getParticipantID());
    bpacket.flush();
    byte[] bpacketData = bpacket.getPacket();
    byte [] packetData = new byte[spacketData.length+bpacketData.length];
    System.arraycopy(spacketData, 0, packetData, 0, spacketData.length);
View Full Code Here


 
  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());
  }
View Full Code Here

    if (byeSent) {
        return;
    } else {
        //System.out.println("Sending ADU");
        try {
      RtcpiSourceDescriptionPacket spacket=constructSdesPacket();
      spacket.flush();
      byte[] spacketData = spacket.getPacket();
      RtcpiByePacket bpacket=new RtcpiByePacket(localParticipant.getParticipantID());
      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) {
View Full Code Here

  if ((item=localParticipant.getStandardItem(SourceDescriptionItem.NOTE))!=null) {
      noteFinishedCount=NOTE_FINISHED_COUNT;
      if(sendNote) {
    sendNote=!sendNote;
    itemList.add(item);
    RtcpiSourceDescriptionPacket packet = new RtcpiSourceDescriptionPacket(localParticipant.getParticipantID(), itemList);
    return packet;
      }
      sendNote=!sendNote;
  } else if (noteFinishedCount>0) {
      if(sendNote) {
    noteFinishedCount--;
    sendNote=!sendNote;
    item=new SourceDescriptionItem(SourceDescriptionItem.NOTE, new byte[0]);
    itemList.add(item);
    RtcpiSourceDescriptionPacket packet = new RtcpiSourceDescriptionPacket(localParticipant.getParticipantID(), itemList);
    return packet;
      }
      sendNote=!sendNote;
  }

  if (sendName && (item=localParticipant.getStandardItem(SourceDescriptionItem.NAME))!=null) {
      sendName=!sendName;
      itemList.add(item);
      RtcpiSourceDescriptionPacket packet = new RtcpiSourceDescriptionPacket(localParticipant.getParticipantID(), itemList);
      return packet;
  }
  sendName=!sendName;
  switch(othersCount) {
  case 0:
      if ((item=localParticipant.getStandardItem(SourceDescriptionItem.EMAIL))!=null) {
    itemList.add(item);
      }
      break;
  case 1:
      if ((item=localParticipant.getStandardItem(SourceDescriptionItem.PHONE))!=null) {
    itemList.add(item);
      }
      break;
  case 2:
      if ((item=localParticipant.getStandardItem(SourceDescriptionItem.LOC))!=null) {
    itemList.add(item);
      }
      break;
  case 3:
      if ((item=localParticipant.getStandardItem(SourceDescriptionItem.TOOL))!=null) {
    itemList.add(item);
      }
      break;
  default:
      System.err.println("Rtpi: illegal value for othersCount!");
  }
 
  othersCount=(othersCount+1)%4;

  RtcpiSourceDescriptionPacket packet = new RtcpiSourceDescriptionPacket(localParticipant.getParticipantID(),itemList);
  return packet;
    }
View Full Code Here

TOP

Related Classes of rtpi.packets.RtcpiSourceDescriptionPacket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.