Beispiel #1
0
  /**
   * Resolve an SSRC conflict.
   *
   * <p>Also increments the SSRC conflict counter, after 5 conflicts it is assumed there is a loop
   * somewhere and the session will terminate.
   */
  protected void resolveSsrcConflict() {
    System.out.println("!!!!!!! Beginning SSRC conflict resolution !!!!!!!!!");
    this.conflictCount++;

    if (this.conflictCount < 5) {
      // Don't send any more regular packets out until we have this sorted out.
      this.conflict = true;

      // Send byes
      rtcpSession.sendByes();

      // Calculate the next delay
      rtcpSession.calculateDelay();

      // Generate a new Ssrc for ourselves
      generateSsrc();

      // Get the SDES packets out faster
      rtcpSession.initial = true;

      this.conflict = false;
      System.out.println("SSRC conflict resolution complete");

    } else {
      System.out.println("Too many conflicts. There is probably a loop in the network.");
      this.endSession();
    }
  }
Beispiel #2
0
  /**
   * Registers an application (RTPAppIntf) with the RTP session. The session will call receiveData()
   * on the supplied instance whenever data has been received.
   *
   * <p>Following this you should set the payload type and add participants to the session.
   *
   * @param rtpApp an object that implements the RTPAppIntf-interface
   * @param rtcpApp an object that implements the RTCPAppIntf-interface (optional)
   * @return -1 if this RTPSession-instance already has an application registered.
   */
  public int RTPSessionRegister(RTPAppIntf rtpApp, RTCPAppIntf rtcpApp, DebugAppIntf debugApp) {
    if (registered) {
      logger.error("Can\'t register another application!");
      return -1;
    } else {
      registered = true;
      generateSeqNum();

      this.appIntf = rtpApp;
      this.rtcpAppIntf = rtcpApp;
      this.debugAppIntf = debugApp;

      recvThrd = new RTPReceiverThread(this);
      appCallerThrd = new AppCallerThread(this, rtpApp);
      recvThrd.start();
      appCallerThrd.start();
      rtcpSession.start();
      return 0;
    }
  }