Package org.red5.server.api.stream

Examples of org.red5.server.api.stream.IBroadcastStream


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

    private void createPlayStream( IPendingServiceCallback callback ) {

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


      if (conn instanceof IStreamCapableConnection) {
        IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
        int streamId = conn.getStreamId();
        IClientStream stream = streamConn.getStreamById(streamId);
        if (stream instanceof IBroadcastStream) {
          IBroadcastStream bs = (IBroadcastStream) stream;
          if (bs.getPublishedName() != null) {
            IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
            if (bsScope != null) {
              bsScope.unsubscribe(bs.getProvider());
              if (conn instanceof BaseConnection) {
                ((BaseConnection) conn).unregisterBasicScope(bsScope);
              }
            }
            bs.close();
            streamConn.deleteStreamById(streamId);
          }
        }
      }
    }
View Full Code Here

          throw new StreamNotFoundException(itemName);
        } else {
          //drop all frames up to the next keyframe
          videoFrameDropper.reset(IFrameDropper.SEND_KEYFRAMES_CHECK);
          if (msgIn instanceof IBroadcastScope) {
            IBroadcastStream stream = (IBroadcastStream) ((IBroadcastScope) msgIn).getClientBroadcastStream();
            if (stream != null && stream.getCodecInfo() != null) {
              IVideoStreamCodec videoCodec = stream.getCodecInfo().getVideoCodec();
              if (videoCodec != null) {
                if (withReset) {
                  sendReset();
                  sendResetStatus(item);
                  sendStartStatus(item);
View Full Code Here

    subscriberStream.setState(StreamState.PLAYING);
    streamOffset = 0;
    streamStartTS = -1;
    if (msgIn != null && msgOut != null) {
      // get the stream so that we can grab any metadata and decoder configs
      IBroadcastStream stream = (IBroadcastStream) ((IBroadcastScope) msgIn).getClientBroadcastStream();
      // prevent an NPE when a play list is created and then immediately flushed
      if (stream != null) {
        Notify metaData = stream.getMetaData();
        //check for metadata to send
        if (metaData != null) {
          log.debug("Metadata is available");
          RTMPMessage metaMsg = RTMPMessage.build(metaData, 0);
          try {
            msgOut.pushMessage(metaMsg);
          } catch (IOException e) {
            log.warn("Error sending metadata", e);
          }
        } else {
          log.debug("No metadata available");
        }

        IStreamCodecInfo codecInfo = stream.getCodecInfo();
        log.debug("Codec info: {}", codecInfo);
        if (codecInfo instanceof StreamCodecInfo) {
          StreamCodecInfo info = (StreamCodecInfo) codecInfo;
          IVideoStreamCodec videoCodec = info.getVideoCodec();
          log.debug("Video codec: {}", videoCodec);
View Full Code Here

          videoFrameDropper.dropPacket(rtmpMessage);
          return;
        }
        if (body instanceof VideoData) {
          if (msgIn instanceof IBroadcastScope) {
            IBroadcastStream stream = (IBroadcastStream) ((IBroadcastScope) msgIn).getClientBroadcastStream();
            if (stream != null && stream.getCodecInfo() != null) {
              IVideoStreamCodec videoCodec = stream.getCodecInfo().getVideoCodec();
              //dont try to drop frames if video codec is null - related to SN-77
              if (videoCodec != null && videoCodec.canDropFrames()) {
                if (!receiveVideo) {
                  // The client disabled video or the app doesn't have enough bandwidth
                  // allowed for this stream.
View Full Code Here

      int streamId = getCurrentStreamId();
      IClientStream stream = streamConn.getStreamById(streamId);
      if (!(stream instanceof IBroadcastStream)) {
        return;
      }
      IBroadcastStream bs = (IBroadcastStream) stream;
      if (bs.getPublishedName() == null) {
        return;
      }
      IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs
          .getPublishedName());
      if (bsScope != null) {
        bsScope.unsubscribe(bs.getProvider());
        if (conn instanceof BaseConnection) {
          ((BaseConnection) conn).unregisterBasicScope(bsScope);
        }
      }
      bs.close();
      streamConn.deleteStreamById(streamId);
    }
  }
View Full Code Here

    RoomClient rc = clientListManager.getClientByStreamId(conn.getClient().getId());
    String publishName = rc.getStreamPublishName();
   
    if (rc.getIsScreenClient() && rc.isStartStreaming()) {
          IScope scope = conn.getScope();
          IBroadcastStream stream = getBroadcastStream(scope, publishName);
          IBroadcastScope bsScope = getBroadcastScope(scope, publishName);
          final StreamingProxy proxy = new StreamingProxy();
          proxy.setHost(host);
          proxy.setApp(app);
          proxy.setPort(1935);
          proxy.init();
          proxy.setExceptionHandler(new ClientExceptionHandler() {
        public void handleException(Throwable throwable) {
          result[0] = false;
          HashMap<String, Object> params = new HashMap<String, Object>();
          params.put("stopPublishing", true);
          params.put("error", throwable.getMessage());
          ((IServiceCapableConnection)conn).invoke(
            "screenSharerAction"
            , new Object[] { params }
            , ScopeApplicationAdapter.this);
        }
      });
          bsScope.subscribe(proxy, null);
          proxy.start(id, "live", null);
          streamingProxyMap.put(publishName, proxy);
          stream.addStreamListener(new IStreamListener() {
        public void packetReceived(IBroadcastStream stream, IStreamPacket packet) {
          try {
            RTMPMessage m = RTMPMessage.build((IRTMPEvent)packet, packet.getTimestamp());
                proxy.pushMessage(null, m);
          } catch (Exception e) {
View Full Code Here

    RoomClient rc = clientListManager.getClientByStreamId(current.getClient().getId());
    String publishName = rc.getStreamPublishName();
   
    if (rc.getIsScreenClient() && publishName != null) {
          IScope scope = current.getScope();
          IBroadcastStream stream = getBroadcastStream(scope, publishName);
      StreamingProxy proxy = streamingProxyMap.remove(publishName);
      if (proxy != null) {
        proxy.stop();
        IBroadcastScope bsScope = getBroadcastScope(scope, stream.getPublishedName());
        if (bsScope != null) {
          bsScope.unsubscribe(proxy);
        }
      }
    }
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

            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.api.stream.IBroadcastStream

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.