Package org.red5.server.net.rtmp.event

Examples of org.red5.server.net.rtmp.event.CachedEvent


  public synchronized RoomClient setUsernameReconnect(String SID, Long userId,
          String username, String firstname, String lastname,
          String picture_uri){
    try {
      log.debug("#*#*#*#*#*#*# setUsername userId: "+userId+" username: "+username+" firstname: "+firstname+" lastname: "+lastname);
      IConnection current = Red5.getConnectionLocal();     
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
     
      log.debug("[setUsername] id: "+currentClient.getStreamid());
     
      currentClient.setUsername(username);
View Full Code Here


          }
          String scopeName = "hibernate";
          if (rcl.getRoom_id() != null) {
            scopeName = rcl.getRoom_id().toString();
          }
          IScope currentScope = ScopeApplicationAdapter.getInstance()
              .getRoomScope(scopeName);
          ScopeApplicationAdapter.getInstance().roomLeaveByScope(rcl,
              currentScope);

          HashMap<Integer, String> messageObj = new HashMap<Integer, String>();
View Full Code Here

        String scopeName = "hibernate";
        if (rcl.getRoom_id() != null) {
          scopeName = rcl.getRoom_id().toString();
        }
        IScope currentScope = ScopeApplicationAdapter.getInstance()
            .getRoomScope(scopeName);
        ScopeApplicationAdapter.getInstance().roomLeaveByScope(rcl,
            currentScope);

        HashMap<Integer, String> messageObj = new HashMap<Integer, String>();
View Full Code Here

         }
         String scopeName = "hibernate";
         if (rcl.getRoom_id() != null) {
           scopeName = rcl.getRoom_id().toString();
         }
         IScope currentScope = this.scopeApplicationAdapter.getRoomScope(scopeName);
         this.scopeApplicationAdapter.roomLeaveByScope(rcl, currentScope);
        
        
         HashMap<Integer,String> messageObj = new HashMap<Integer,String>();
         messageObj.put(0, "kick");
View Full Code Here

          }
          String scopeName = "hibernate";
          if (rcl.getRoom_id() != null) {
            scopeName = rcl.getRoom_id().toString();
          }
          IScope currentScope = this.scopeApplicationAdapter.getRoomScope(scopeName);
         
          HashMap<Integer,String> messageObj = new HashMap<Integer,String>();
          messageObj.put(0, "kick");
         
          this.scopeApplicationAdapter.sendMessageById(messageObj, rcl.getStreamid(), currentScope);
View Full Code Here

    // ------------------------------------------------------------------------

    private void createPlayStream( IPendingServiceCallback callback ) {

        logger.debug( "create play stream" );
        IPendingServiceCallback wrapper = new CreatePlayStreamCallBack( callback );
        invoke( "createStream", null, wrapper );
    }
View Full Code Here

      if (stream.getStreamListeners() != null) {
       
        for (Iterator<IStreamListener> iter = stream.getStreamListeners().iterator();iter.hasNext();) {
         
          IStreamListener iStreamListener = iter.next();
         
          ListenerAdapter listenerAdapter = (ListenerAdapter) iStreamListener;
         
          log.debug("Stream Closing ?? "+listenerAdapter.getFlvRecordingMetaDataId()+ " " +flvRecordingMetaDataId);
         
View Full Code Here

  /** {@inheritDoc} */
  public void packetReceived(IBroadcastStream stream, IStreamPacket packet) {
    if (recording.get()) {
      // store everything we would need to perform a write of the stream data
      CachedEvent event = new CachedEvent();
      event.setData(packet.getData().duplicate());
      event.setDataType(packet.getDataType());
      event.setReceivedTime(System.currentTimeMillis());
      event.setTimestamp(packet.getTimestamp());
      // queue the event
      if (!queue.add(event)) {
        log.debug("Event packet not added to recording queue");
      }
    } else {
View Full Code Here

  /**
   * Process the queued items.
   */
  private void processQueue() {
    CachedEvent cachedEvent;
    try {
      IRTMPEvent event = null;
      RTMPMessage message = null;
      // get first event in the queue
      cachedEvent = queue.poll();
      if (cachedEvent != null) {
        // get the data type
        final byte dataType = cachedEvent.getDataType();
        // get the data
        IoBuffer buffer = cachedEvent.getData();
        // get the current size of the buffer / data
        int bufferLimit = buffer.limit();
        if (bufferLimit > 0) {
          // create new RTMP message and push to the consumer
          switch (dataType) {
            case Constants.TYPE_AGGREGATE:
              event = new Aggregate(buffer);
              event.setTimestamp(cachedEvent.getTimestamp());
              message = RTMPMessage.build(event);
              break;
            case Constants.TYPE_AUDIO_DATA:
              event = new AudioData(buffer);
              event.setTimestamp(cachedEvent.getTimestamp());
              message = RTMPMessage.build(event);
              break;
            case Constants.TYPE_VIDEO_DATA:
              event = new VideoData(buffer);
              event.setTimestamp(cachedEvent.getTimestamp());
              message = RTMPMessage.build(event);
              break;
            default:
              event = new Notify(buffer);
              event.setTimestamp(cachedEvent.getTimestamp());
              message = RTMPMessage.build(event);
              break;
          }
          // push it down to the recorder
          recordingConsumer.pushMessage(null, message);
        } else if (bufferLimit == 0 && dataType == Constants.TYPE_AUDIO_DATA) {
          log.debug("Stream data size was 0, sending empty audio message");
          // allow for 0 byte audio packets
          event = new AudioData(IoBuffer.allocate(0));
          event.setTimestamp(cachedEvent.getTimestamp());
          message = RTMPMessage.build(event);
          // push it down to the recorder
          recordingConsumer.pushMessage(null, message);
        } else {
          log.debug("Stream data size was 0, recording pipe will not be notified");
View Full Code Here

            if ( !( event instanceof IRTMPEvent ) ) {
                logger.debug( "skipping non rtmp event: " + event );
                return;
            }

            IRTMPEvent rtmpEvent = (IRTMPEvent) event;

            if ( logger.isDebugEnabled() ) {
                // logger.debug("rtmp event: " + rtmpEvent.getHeader() + ", " +
                // rtmpEvent.getClass().getSimpleName());
            }

            if ( !( rtmpEvent instanceof IStreamData ) ) {
                logger.debug( "skipping non stream data" );
                return;
            }

            if ( rtmpEvent.getHeader().getSize() == 0 ) {
                logger.debug( "skipping event where size == 0" );
                return;
            }

            if ( rtmpEvent instanceof VideoData ) {
View Full Code Here

TOP

Related Classes of org.red5.server.net.rtmp.event.CachedEvent

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.