Package javax.media.rtp

Examples of javax.media.rtp.Participant


    {
        System.out.println("### " + event);

        if ( event instanceof NewParticipantEvent )
        {
            Participant participant = ((NewParticipantEvent)event).getParticipant();
            System.out.println("### " + participant.getCNAME() + " joined the session");
        }
    }
View Full Code Here


    /**
     * SessionListener.
     */
    public synchronized void update(SessionEvent evt) {
  if (evt instanceof NewParticipantEvent) {
      Participant p = ((NewParticipantEvent)evt).getParticipant();
      System.err.println("  - A new participant had just joined: " + p.getCNAME());
  }
    }
View Full Code Here

     * ReceiveStreamListener
     */
    public synchronized void update( ReceiveStreamEvent evt) {

  RTPManager mgr = (RTPManager)evt.getSource();
  Participant participant = evt.getParticipant()// could be null.
  ReceiveStream stream = evt.getReceiveStream()// could be null.

  if (evt instanceof RemotePayloadChangeEvent) {
    
      System.err.println("  - Received an RTP PayloadChangeEvent.");
      System.err.println("Sorry, cannot handle payload change.");
      System.exit(0);

  }
   
  else if (evt instanceof NewReceiveStreamEvent) {

      try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    DataSource ds = stream.getDataSource();

    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
        System.err.println("  - Recevied new RTP stream: " + ctl.getFormat());
    } else
        System.err.println("  - Recevied new RTP stream");

    if (participant == null)
        System.err.println("      The sender of this stream had yet to be identified.");
    else {
        System.err.println("      The stream comes from: " + participant.getCNAME());
    }

    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
        return;

    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);

    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
        dataReceived = true;
        dataSync.notifyAll();
    }

      } catch (Exception e) {
    System.err.println("NewReceiveStreamEvent exception " + e.getMessage());
    return;
      }
       
  }

  else if (evt instanceof StreamMappedEvent) {

       if (stream != null && stream.getDataSource() != null) {
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println("  - The previously unidentified stream ");
    if (ctl != null)
        System.err.println("      " + ctl.getFormat());
    System.err.println("      had now been identified as sent by: " + participant.getCNAME());
       }
  }

  else if (evt instanceof ByeEvent) {

       System.err.println("  - Got \"bye\" from: " + participant.getCNAME());
       PlayerWindow pw = find(stream);
       if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
       }
View Full Code Here

     * ReceiveStreamListener
     */
    public synchronized void update( ReceiveStreamEvent evt) {

  RTPManager mgr = (RTPManager)evt.getSource();
  Participant participant = evt.getParticipant()// could be null.
  ReceiveStream stream = evt.getReceiveStream()// could be null.

  if (evt instanceof RemotePayloadChangeEvent) {
    
      System.err.println("  - Received an RTP PayloadChangeEvent.");
      System.err.println("Sorry, cannot handle payload change.");
      System.exit(0);

  }
   
  else if (evt instanceof NewReceiveStreamEvent) {

      try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    DataSource ds = stream.getDataSource();

    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
        System.err.println("  - Recevied new RTP stream: " + ctl.getFormat());
    } else
        System.err.println("  - Recevied new RTP stream");

    if (participant == null)
        System.err.println("      The sender of this stream had yet to be identified.");
    else {
        System.err.println("      The stream comes from: " + participant.getCNAME());
    }

    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
        return;

    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);

    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
        dataReceived = true;
        dataSync.notifyAll();
    }

      } catch (Exception e) {
    System.err.println("NewReceiveStreamEvent exception " + e.getMessage());
    return;
      }
       
  }

  else if (evt instanceof StreamMappedEvent) {

       if (stream != null && stream.getDataSource() != null) {
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println("  - The previously unidentified stream ");
    if (ctl != null)
        System.err.println("      " + ctl.getFormat());
    System.err.println("      had now been identified as sent by: " + participant.getCNAME());
       }
  }

  else if (evt instanceof ByeEvent) {

       System.err.println("  - Got \"bye\" from: " + participant.getCNAME());
       PlayerWindow pw = find(stream);
       if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
       }
View Full Code Here

      StringBuffer sb= new StringBuffer();

      sb.append( timestamp + " RR");

      if( rr != null) {
    Participant participant= rr.getParticipant();

    if( participant != null) {
        sb.append( " from " + participant.getCNAME());
        sb.append( " ssrc=" + rr.getSSRC());
    } else {
        sb.append( " ssrc=" + rr.getSSRC());
    }
View Full Code Here

   * @see javax.media.rtp.ReceiveStreamListener#update(javax.media.rtp.event.ReceiveStreamEvent)
   */
  public void update(ReceiveStreamEvent evt) {
    log.debug("RTPStreamReceiver.update");
   
    Participant participant = evt.getParticipant()// could be null.
    stream = evt.getReceiveStream()// could be null.

    if (evt instanceof RemotePayloadChangeEvent) {
      
        System.err.println("  - Received an RTP PayloadChangeEvent.");
        System.err.println("Sorry, cannot handle payload change.");
        System.exit(0);
    }
     
    else if (evt instanceof NewReceiveStreamEvent) {

        try {
          stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
         
          synchronized (dataSync) {
            dataReceived = true;
            dataSync.notifyAll();
        }
 
        } catch (Exception e) {
      System.err.println("NewReceiveStreamEvent exception " + e.getMessage());
      return;
        }
         
    }

    else if (evt instanceof ByeEvent) {

         System.err.println("  - Got \"bye\" from: " + participant.getCNAME());
      
    }
  }
View Full Code Here

    {
    }

  public void update(ReceiveStreamEvent evt)
    {
    Participant participant = evt.getParticipant()// could be null.
    ReceiveStream stream = evt.getReceiveStream()// could be null.
   
    if (evt instanceof RemotePayloadChangeEvent)
      {
      throw new RuntimeException("Change of RTP stream payload is not supported");
      }
    else if (evt instanceof NewReceiveStreamEvent)
      {
      }
    else if (evt instanceof StreamMappedEvent)
      {
      Player player = null;
      try
        {
        player = Manager.createPlayer(stream.getDataSource());
        }
      catch (IOException e)
        {
        throw new RuntimeException(e);
        }
      catch (NoPlayerException e)
        {
        throw new RuntimeException(e);
        }
      player.start();
      try
        {
        if (participant != null)
        in.put(participant.getCNAME(),player);
        }
      catch (Exception e)
        {
        throw new RuntimeException(e);
        }
      }
    else if (evt instanceof ByeEvent)
      {
      try
        {
        ((Player)in.get(participant.getCNAME())).close();
        in.remove(participant.getCNAME());
        }
      catch (Exception e)
        {
        throw new RuntimeException(e);
        }
View Full Code Here

    /**
     * ReceiveStreamListener
     */
    public synchronized void update(ReceiveStreamEvent evt) {

        Participant participant = evt.getParticipant();    // could be null.
        ReceiveStream stream = evt.getReceiveStream()// could be null.

        if (evt instanceof RemotePayloadChangeEvent) {
            LOGGER.error("  - Received an RTP PayloadChangeEvent.");
            LOGGER.error("Sorry, cannot handle payload change.");

        }
        else if (evt instanceof NewReceiveStreamEvent) {

            try {
                stream = evt.getReceiveStream();
                DataSource ds = stream.getDataSource();

                // Find out the formats.
                RTPControl ctl = (RTPControl) ds.getControl("javax.jmf.rtp.RTPControl");
                if (ctl != null) {
                    LOGGER.error("  - Recevied new RTP stream: " + ctl.getFormat());
                }
                else
                    LOGGER.error("  - Recevied new RTP stream");

                if (participant == null)
                    LOGGER.error("      The sender of this stream had yet to be identified.");
                else {
                    LOGGER.error("      The stream comes from: " + participant.getCNAME());
                }

                // create a player by passing datasource to the Media Manager
                Player p = javax.media.Manager.createPlayer(ds);
                if (p == null)
                    return;

                p.addControllerListener(this);
                p.realize();
                jingleMediaSession.mediaReceived(participant != null ? participant.getCNAME() : "");

                // Notify intialize() that a new stream had arrived.
                synchronized (dataSync) {
                    dataReceived = true;
                    dataSync.notifyAll();
                }

            }
            catch (Exception e) {
                LOGGER.error("NewReceiveStreamEvent exception " + e.getMessage());
                return;
            }

        }
        else if (evt instanceof StreamMappedEvent) {

            if (stream != null && stream.getDataSource() != null) {
                DataSource ds = stream.getDataSource();
                // Find out the formats.
                RTPControl ctl = (RTPControl) ds.getControl("javax.jmf.rtp.RTPControl");
                LOGGER.error("  - The previously unidentified stream ");
                if (ctl != null)
                    LOGGER.error("      " + ctl.getFormat());
                LOGGER.error("      had now been identified as sent by: " + participant.getCNAME());
            }
        }
        else if (evt instanceof ByeEvent) {

            LOGGER.error("  - Got \"bye\" from: " + participant.getCNAME());

        }

    }
View Full Code Here

TOP

Related Classes of javax.media.rtp.Participant

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.