Examples of IClientBroadcastStream


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

    if (conn instanceof IStreamCapableConnection) {
      ((IStreamCapableConnection) conn).reserveStreamId(streamId);
      IClientStream stream = ((IStreamCapableConnection) conn).getStreamById(streamId);
      if (stream != null) {
        if (stream instanceof IClientBroadcastStream) {
          IClientBroadcastStream bs = (IClientBroadcastStream) stream;
          IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
          if (bsScope != null && conn instanceof BaseConnection) {
            ((BaseConnection) conn).unregisterBasicScope(bsScope);
          }
        }
        stream.close();
View Full Code Here

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

      IStreamCapableConnection scConn = (IStreamCapableConnection) conn;
      IClientStream stream = scConn.getStreamById(streamId);
      if (stream != null) {
        if (stream instanceof IClientBroadcastStream) {
          // this is a broadcasting stream (from Flash Player to Red5)
          IClientBroadcastStream bs = (IClientBroadcastStream) stream;
          IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
          if (bsScope != null && conn instanceof BaseConnection) {
            ((BaseConnection) conn).unregisterBasicScope(bsScope);
          }
        }
        stream.close();
View Full Code Here

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

  /** {@inheritDoc} */
  public void deleteStream(IStreamCapableConnection conn, int streamId) {
    IClientStream stream = conn.getStreamById(streamId);
    if (stream != null) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
        if (bsScope != null && conn instanceof BaseConnection) {
          ((BaseConnection) conn).unregisterBasicScope(bsScope);
        }
      }
      stream.close();
View Full Code Here

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

      boolean created = false;
      if (stream == null) {
        stream = streamConn.newBroadcastStream(streamId);
        created = true;
      }
      IClientBroadcastStream bs = (IClientBroadcastStream) stream;
      try {
        // set publish name
        bs.setPublishedName(name);
        // set stream parameters if they exist
        if (params != null) {
          bs.setParameters(params);
        }
        IContext context = conn.getScope().getContext();
        IProviderService providerService = (IProviderService) context.getBean(IProviderService.BEAN_NAME);
        // TODO handle registration failure
        if (providerService.registerBroadcastStream(conn.getScope(), name, bs)) {
          bsScope = getBroadcastScope(conn.getScope(), name);
          bsScope.setClientBroadcastStream(bs);
          if (conn instanceof BaseConnection) {
            ((BaseConnection) conn).registerBasicScope(bsScope);
          }
        }
        log.debug("Mode: {}", mode);
        if (IClientStream.MODE_RECORD.equals(mode)) {
          bs.start();
          bs.saveAs(name, false);
        } else if (IClientStream.MODE_APPEND.equals(mode)) {
          bs.start();
          bs.saveAs(name, true);
        } else {
          bs.start();
        }
        bs.startPublishing();
      } catch (IOException e) {
        log.warn("Stream I/O exception", e);
        sendNSFailed(streamConn, StatusCodes.NS_RECORD_NOACCESS, "The file could not be created/written to.", name, streamId);
        bs.close();
        if (created) {
          streamConn.deleteStreamById(streamId);
        }
      } catch (Exception e) {
        log.warn("Exception on publish", e);
View Full Code Here

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

    state.setReadChunkSize(requestedChunkSize);
    //state.setWriteChunkSize(requestedChunkSize);
    // set on each of the streams
    for (IClientStream stream : conn.getStreams()) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope scope = bs.getScope().getBroadcastScope(bs.getPublishedName());
        if (scope == null) {
          continue;
        }
        OOBControlMessage setChunkSize = new OOBControlMessage();
        setChunkSize.setTarget("ClientBroadcastStream");
        setChunkSize.setServiceName("chunkSize");
        if (setChunkSize.getServiceParamMap() == null) {
          setChunkSize.setServiceParamMap(new HashMap<String, Object>());
        }
        setChunkSize.getServiceParamMap().put("chunkSize", requestedChunkSize);
        scope.sendOOBControlMessage((IConsumer) null, setChunkSize);
        log.debug("Sending chunksize {} to {}", chunkSize, bs.getProvider());
      }
    }
  }
View Full Code Here

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

          msgIn = liveInput;
          // Drop all frames up to the next keyframe
          videoFrameDropper.reset(IFrameDropper.SEND_KEYFRAMES_CHECK);
          if (msgIn instanceof IBroadcastScope) {
            // Send initial keyframe
            IClientBroadcastStream stream = (IClientBroadcastStream) ((IBroadcastScope) msgIn)
                .getAttribute(IBroadcastScope.STREAM_ATTRIBUTE);
            if (stream != null && stream.getCodecInfo() != null) {
              IVideoStreamCodec videoCodec = stream
                  .getCodecInfo().getVideoCodec();
              if (videoCodec != null) {
                ByteBuffer keyFrame = videoCodec.getKeyframe();
                if (keyFrame != null) {
                  VideoData video = new VideoData(keyFrame);
View Full Code Here

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

        int size = ((IStreamData) body).getData().limit();
        if (body instanceof VideoData) {
          IVideoStreamCodec videoCodec = null;
          if (msgIn instanceof IBroadcastScope) {
            IClientBroadcastStream stream = (IClientBroadcastStream) ((IBroadcastScope) msgIn)
                .getAttribute(IBroadcastScope.STREAM_ATTRIBUTE);
            if (stream != null && stream.getCodecInfo() != null) {
              videoCodec = stream.getCodecInfo().getVideoCodec();
            }
          }

          if (videoCodec == null || videoCodec.canDropFrames()) {
            if (state == State.PAUSED) {
View Full Code Here

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

    }
    IClientStream stream = ((IStreamCapableConnection) conn)
        .getStreamById(getCurrentStreamId());
    if (stream != null) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs
            .getPublishedName());
        if (bsScope != null && conn instanceof BaseConnection) {
          ((BaseConnection) conn).unregisterBasicScope(bsScope);
        }
      }
View Full Code Here

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

  /** {@inheritDoc} */
    public void deleteStream(IStreamCapableConnection conn, int streamId) {
    IClientStream stream = conn.getStreamById(streamId);
    if (stream != null) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs
            .getPublishedName());
        if (bsScope != null && conn instanceof BaseConnection) {
          ((BaseConnection) conn).unregisterBasicScope(bsScope);
        }
      }
View Full Code Here

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

    if (stream == null) {
      stream = streamConn.newBroadcastStream(streamId);
      created = true;
    }

    IClientBroadcastStream bs = (IClientBroadcastStream) stream;
    try {
      bs.setPublishedName(name);
      IContext context = conn.getScope().getContext();
      IProviderService providerService = (IProviderService) context
          .getBean(IProviderService.BEAN_NAME);
      // TODO handle registration failure
      if (providerService.registerBroadcastStream(conn.getScope(),
          name, bs)) {
        bsScope = getBroadcastScope(conn.getScope(), name);
        bsScope.setAttribute(IBroadcastScope.STREAM_ATTRIBUTE, bs);
        if (conn instanceof BaseConnection) {
          ((BaseConnection) conn).registerBasicScope(bsScope);
        }
      }
      if (IClientStream.MODE_RECORD.equals(mode)) {
        bs.start();
        bs.saveAs(name, false);
      } else if (IClientStream.MODE_APPEND.equals(mode)) {
        bs.start();
        bs.saveAs(name, true);
      } else if (IClientStream.MODE_LIVE.equals(mode)) {
        bs.start();
      }
      bs.startPublishing();
    } catch (IOException e) {
      Status accessDenied = new Status(StatusCodes.NS_RECORD_NOACCESS);
      accessDenied.setClientid(streamId);
      accessDenied.setDesciption("The file could not be created/written to.");
      accessDenied.setDetails(name);
      accessDenied.setLevel("error");

      // FIXME: there should be a direct way to send the status
      Channel channel = ((RTMPConnection) streamConn).getChannel((byte) (4 + ((streamId-1) * 5)));
      channel.sendStatus(accessDenied);
      bs.close();
      if (created)
        streamConn.deleteStreamById(streamId);
      return;
    } catch (Exception e) {
      logger.warn("publish caught Exception");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.