Package org.red5.server.net.rtmp

Examples of org.red5.server.net.rtmp.RTMPOriginConnection


  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

      log.debug(packet.toString());
    }
    int clientId = header.getClientId();
    int sessionId = getSessionId(session);
    MRTMPOriginConnection mrtmpConn = (MRTMPOriginConnection) session.getAttachment();
    RTMPOriginConnection conn = null;
    switch (packet.getHeader().getType()) {
      case MRTMPPacket.CONNECT:
        lock.writeLock().lock();
        try {
          if (header.isDynamic()) {
            if (!dynConnMap.containsKey(clientId)) {
              conn = new RTMPOriginConnection(
                  IConnection.POLLING,
                  header.getClientId()
                  );
              conn.setMrtmpManager(mrtmpManager);
              conn.setHandler(this);
              dynConnMap.put(clientId, conn);
            } else {
              log.warn("Open an already existing RTMPT origin connection!");
            }
          } else {
            StaticConnId connId = new StaticConnId();
            connId.clientId = header.getClientId();
            connId.sessionId = sessionId;
            if (!statConnMap.containsKey(connId)) {
              conn = new RTMPOriginConnection(
                  IConnection.PERSISTENT,
                  header.getClientId(),
                  sessionId
                  );
              conn.setMrtmpManager(mrtmpManager);
              conn.setHandler(this);
              statConnMap.put(connId, conn);
            } else {
              log.warn("Open an already existing RTMP origin connection!");
            }
          }
        } finally {
          lock.writeLock().unlock();
        }
        break;
      case MRTMPPacket.CLOSE:
      case MRTMPPacket.RTMP:
        lock.readLock().lock();
        try {
          if (header.isDynamic()) {
            conn = dynConnMap.get(clientId);
          } else {
            StaticConnId connId = new StaticConnId();
            connId.clientId = header.getClientId();
            connId.sessionId = sessionId;
            conn = statConnMap.get(connId);
          }
        } finally {
          lock.readLock().unlock();
        }
        if (conn != null) {
          if (packet.getHeader().getType() == MRTMPPacket.CLOSE) {
            closeConnection(conn);
            conn = null;
          } else {
            MRTMPPacket.RTMPBody rtmpBody = (MRTMPPacket.RTMPBody) body;
            handler.messageReceived(conn, conn.getState(), rtmpBody.getRtmpPacket());
          }
        } else {
          log.warn("Handle on a non-existent origin connection!");
        }
        break;
View Full Code Here

    }
    MRTMPPacket.Header header = packet.getHeader();
    MRTMPPacket.Body body = packet.getBody();
    int clientId = header.getClientId();
    int sessionId = getSessionId(session);
    RTMPOriginConnection conn = null;
    lock.readLock().lock();
    try {
      if (header.isDynamic()) {
        conn = dynConnMap.get(clientId);
      } else {
        StaticConnId connId = new StaticConnId();
        connId.clientId = header.getClientId();
        connId.sessionId = sessionId;
        conn = statConnMap.get(connId);
      }
    } finally {
      lock.readLock().unlock();
    }
    if (conn != null) {
      MRTMPPacket.RTMPBody rtmpBody = (MRTMPPacket.RTMPBody) body;
      final int channelId = rtmpBody.getRtmpPacket().getHeader().getChannelId();
      final IClientStream stream = conn.getStreamByChannelId(channelId);
      // XXX we'd better use new event model for notification
      if (stream != null && (stream instanceof PlaylistSubscriberStream)) {
        ((PlaylistSubscriberStream) stream).written(rtmpBody.getRtmpPacket().getMessage());
      }
    } else {
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.RTMPOriginConnection

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.