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

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


  public boolean canSendPacket(RTMPMessage message, long pending) {
    IRTMPEvent packet = message.getBody();
    boolean result = true;
    // We currently only drop video packets.
    if (packet instanceof VideoData) {
      VideoData video = (VideoData) packet;
      FrameType type = video.getFrameType();
      switch (state) {
        case SEND_ALL:
          // All packets will be sent
          break;
        case SEND_INTERFRAMES:
View Full Code Here


  /** {@inheritDoc} */
  public void dropPacket(RTMPMessage message) {
    IRTMPEvent packet = message.getBody();
    // Only check video packets.
    if (packet instanceof VideoData) {
      VideoData video = (VideoData) packet;
      FrameType type = video.getFrameType();
      switch (state) {
        case SEND_ALL:
          if (type == FrameType.DISPOSABLE_INTERFRAME) {
            // Remain in state, packet is safe to drop.
            return;
View Full Code Here

            //check for decoder configuration to send
            IoBuffer config = videoCodec.getDecoderConfiguration();
            if (config != null) {
              log.debug("Decoder configuration is available for {}", videoCodec.getName());
              //log.debug("Dump:\n{}", Hex.encodeHex(config.array()));
              VideoData conf = new VideoData(config.asReadOnlyBuffer());
              log.trace("Configuration ts: {}", conf.getTimestamp());
              RTMPMessage confMsg = RTMPMessage.build(conf);
              try {
                log.debug("Pushing decoder configuration");
                msgOut.pushMessage(confMsg);
              } finally {
                conf.release();
              }
            }
            //check for a keyframe to send
            IoBuffer keyFrame = videoCodec.getKeyframe();
            if (keyFrame != null) {
              log.debug("Keyframe is available");
              VideoData video = new VideoData(keyFrame.asReadOnlyBuffer());
              log.trace("Keyframe ts: {}", video.getTimestamp());
              //log.debug("Dump:\n{}", Hex.encodeHex(keyFrame.array()));
              RTMPMessage videoMsg = RTMPMessage.build(video);
              try {
                log.debug("Pushing keyframe");
                msgOut.pushMessage(videoMsg);
              } finally {
                video.release();
              }
            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null");
          }
View Full Code Here

    return new AudioData(in.asReadOnlyBuffer());
  }

  /** {@inheritDoc} */
  public VideoData decodeVideoData(IoBuffer in) {
    return new VideoData(in.asReadOnlyBuffer());
  }
View Full Code Here

      switch (tag.getDataType()) {
        case TYPE_AUDIO_DATA:
          msg = new AudioData(tag.getBody());
          break;
        case TYPE_VIDEO_DATA:
          msg = new VideoData(tag.getBody());
          break;
        case TYPE_INVOKE:
          msg = new Invoke(tag.getBody());
          break;
        case TYPE_NOTIFY:
View Full Code Here

              IVideoStreamCodec videoCodec = stream
                  .getCodecInfo().getVideoCodec();
              if (videoCodec != null) {
                ByteBuffer keyFrame = videoCodec.getKeyframe();
                if (keyFrame != null) {
                  VideoData video = new VideoData(keyFrame);
                  try {
                    if (withReset) {
                      sendReset();
                      //sendBlankAudio(0);
                      //sendBlankVideo(0);
                      sendResetStatus(item);
                      sendStartStatus(item);
                    }

                    video.setTimestamp(0);

                    RTMPMessage videoMsg = new RTMPMessage();
                    videoMsg.setBody(video);
                    msgOut.pushMessage(videoMsg);
                    sendNotifications = false;
                    // Don't wait for keyframe
                    videoFrameDropper.reset();
                  } finally {
                    video.release();
                  }
                }
              }
            }
          }
View Full Code Here

    if (!(packet instanceof VideoData)) {
      // We currently only drop video packets.
      return true;
    }

    VideoData video = (VideoData) packet;
    FrameType type = video.getFrameType();
    boolean result = false;
    switch (state) {
      case SEND_ALL:
        // All packets will be sent.
        result = true;
View Full Code Here

    if (!(packet instanceof VideoData)) {
      // Only check video packets.
      return;
    }

    VideoData video = (VideoData) packet;
    FrameType type = video.getFrameType();

    switch (state) {
      case SEND_ALL:
        if (type == FrameType.DISPOSABLE_INTERFRAME) {
          // Remain in state, packet is safe to drop.
View Full Code Here

    switch (tag.getDataType()) {
      case TYPE_AUDIO_DATA:
        msg = new AudioData(tag.getBody());
        break;
      case TYPE_VIDEO_DATA:
        msg = new VideoData(tag.getBody());
        break;
      case TYPE_INVOKE:
        msg = new Invoke(tag.getBody());
        break;
      case TYPE_NOTIFY:
View Full Code Here

          send.setHeader(header);
          send.setTimestamp(header.getTimer());
          data.write(send);
          break;
        case Constants.TYPE_VIDEO_DATA:
          VideoData videoData = new VideoData(((VideoData) msg)
              .getData().asReadOnlyBuffer());
          videoData.setHeader(header);
          videoData.setTimestamp(header.getTimer());
          video.write(videoData);
          break;
        case Constants.TYPE_AUDIO_DATA:
          AudioData audioData = new AudioData(((AudioData) msg)
              .getData().asReadOnlyBuffer());
View Full Code Here

TOP

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

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.