Package rtpi.packets

Examples of rtpi.packets.RtpiDataPacket


  return null;
    }

    LinkedList packetize(int transportPayloadSize) {
  LinkedList packets=new LinkedList();
  RtpiDataPacket packet = new RtpiDataPacket(payload, payloadStart, payloadLength);
  setPacketFields(packet, 0, 1);
  packets.add(packet);
  return packets;
    }     
View Full Code Here


  if (recipient == null)
  {
    //System.out.println("Recipient has not yet been specified, returning ...");
    return;
  }
  RtpiDataPacket packet = (RtpiDataPacket) adu.getFirst();
  //System.out.println("packet is: " + packet);
  int thisSendersID = packet.getParticipantID();
  //System.out.println("senders ID is: " + thisSendersID);
  if (thisSendersID==localParticipant.getParticipantID()) {
      // System.err.println("Rtpi: WARNING: received RtpiAdu with same PID as local user, this may be cause by a PID collision or a routing loop!");
      return;
 

  //System.out.println("remoteParticipants: " + remoteParticipants);
  //System.out.println("deletedParticipants: " + deletedParticipants);
  if (!remoteParticipants.containsKey(new Integer(thisSendersID)) && !deletedParticipants.containsKey(new Integer(thisSendersID))) {
      //System.out.println("In if");
      RtpiSourceInfo participant = new RtpiSourceInfo(thisSendersID);
      remoteParticipants.put(new Integer(thisSendersID), participant);
      members++;
      //System.out.println("recipient is : " + recipient);
      recipient.changeSourceInfo(this, participant);
  }

  if (!remoteParticipants.containsKey(new Integer(thisSendersID))) {
      return;
  }
 
    //System.out.println("calling heard from for pid: " + thisSendersID);
  ((RtpiSourceInfo) remoteParticipants.get(new Integer(thisSendersID))).heardFrom();

  switch (packet.getType()) {
  case RtpiDataPacket.EVENT:
      try {
    //System.out.println("Got event packet");
    recipient.receiveEvent(this, new RtpiEvent(adu));
      } catch (Exception ex) {
View Full Code Here

  payload = new byte[totalLength];
 
  it = list.listIterator();
   
  RtpiDataPacket packet=(RtpiDataPacket)it.next();
  extractInfoFromPacket(packet);

  byte[] tmpData = packet.getPacketData();
  int curSize = packet.getPayloadLength();

  System.arraycopy(tmpData,packet.getPayloadStart(), payload, 0, curSize);
  int position=curSize;

  while(it.hasNext()) {
      packet=(RtpiDataPacket)it.next();
      tmpData = packet.getPacketData();
      curSize = packet.getPayloadLength();
      System.arraycopy(tmpData, packet.getPayloadStart(), payload, position, curSize);     
      position += curSize;
  }

  payloadLength=position;
  payloadStart=0;
View Full Code Here

    }

    LinkedList packetize(int transportPayloadSize) {
  LinkedList packets=new LinkedList();
  int bytesWritten=0;
  RtpiDataPacket packet=null;

  if (payloadLength+payloadStart<transportPayloadSize) {
      packet=new RtpiDataPacket(payload, payloadStart, payloadLength);
      setPacketFields(packet, 0, 1);
      packets.add(packet);
      return packets;
  }     

  int bytesInThisPacket=0;
  byte[] packetData=null;
  int fragmentCount=0;

  while (bytesWritten<payloadLength) {
      if (payloadLength-bytesWritten+payloadStart<transportPayloadSize) {
    bytesInThisPacket=payloadLength-bytesWritten+payloadStart;
      } else {
    bytesInThisPacket=transportPayloadSize;
      }

      packetData=new byte[bytesInThisPacket];
      System.arraycopy(payload, bytesWritten+payloadStart, packetData, payloadStart, bytesInThisPacket-payloadStart);
      packet = new RtpiDataPacket(packetData,payloadStart, bytesInThisPacket-payloadStart);
      setPacketFields(packet, fragmentCount, 0);
      fragmentCount++;
      packets.add(packet);
      bytesWritten+=bytesInThisPacket-payloadStart;
  }
  packet.setEnd(1);
  return packets;
    }
View Full Code Here

TOP

Related Classes of rtpi.packets.RtpiDataPacket

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.