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

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


        ITag tag = reader.readTag();
        if (tag != null) {
          int timestamp = tag.getTimestamp();
          switch (tag.getDataType()) {
            case Constants.TYPE_AUDIO_DATA:
              msg = new AudioData(tag.getBody());
              break;
            case Constants.TYPE_VIDEO_DATA:
              msg = new VideoData(tag.getBody());
              break;
            case Constants.TYPE_INVOKE:
View Full Code Here


          if (audioCodec != null) {
            //check for decoder configuration to send
            IoBuffer config = audioCodec.getDecoderConfiguration();
            if (config != null) {
              log.debug("Decoder configuration is available for {}", audioCodec.getName());
              AudioData audioConf = new AudioData(config.asReadOnlyBuffer());
              try {
                log.debug("Setting decoder configuration for recording");
                listener.getFileConsumer().setAudioDecoderConfiguration(audioConf);
              } finally {
                audioConf.release();
              }
            }
          } else {
            log.debug("No decoder configuration available, audioCodec is null.");
          }
View Full Code Here

      }
      // if no message has been sent by this point send an audio packet
      if (!messageSent) {
        // Send blank audio packet to notify client about new position
        log.debug("Sending blank audio packet");
        AudioData audio = new AudioData();
        audio.setTimestamp(seekPos);
        audio.setHeader(new Header());
        audio.getHeader().setTimer(seekPos);
        RTMPMessage audioMessage = RTMPMessage.build(audio);
        lastMessageTs = seekPos;
        doPushMessage(audioMessage);
        audioMessage.getBody().release();
      }
View Full Code Here

          break;
        case Constants.TYPE_AUDIO_DATA:
          log.trace("Audio data");
          buf = ((AudioData) msg).getData();
          if (buf != null) {
            AudioData audioData = new AudioData(buf.asReadOnlyBuffer());
            audioData.setHeader(header);
            audioData.setTimestamp(header.getTimer());
            log.trace("Source type: {}", ((AudioData) msg).getSourceType());
            audioData.setSourceType(((AudioData) msg).getSourceType());
            audio.write(audioData);
          } else {
            log.warn("Audio data was not found");
          }
          break;
View Full Code Here

              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 {
View Full Code Here

            // check for decoder configuration to send
            IoBuffer config = audioCodec.getDecoderConfiguration();
            if (config != null) {
              log.debug("Decoder configuration is available for {}", audioCodec.getName());
              //log.debug("Dump:\n{}", Hex.encodeHex(config.array()));
              AudioData conf = new AudioData(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();
              }
            }
          } else {
            log.debug("No decoder configuration available, audioCodec is null");
          }
View Full Code Here

        event = new Aggregate(dataReference);
        event.setTimestamp(messageIn.getBody().getTimestamp());
        break;
      case Constants.TYPE_AUDIO_DATA:
        dataReference = ((AudioData) messageIn.getBody()).getData();
        event = new AudioData(dataReference);
        event.setTimestamp(messageIn.getBody().getTimestamp());
        break;
      case Constants.TYPE_VIDEO_DATA:
        dataReference = ((VideoData) messageIn.getBody()).getData();
        event = new VideoData(dataReference);
View Full Code Here

          }
        } else if (body instanceof AudioData) {
          if (!receiveAudio && sendBlankAudio) {
            // Send blank audio packet to reset player
            sendBlankAudio = false;
            body = new AudioData();
            if (lastMessageTs > 0) {
              body.setTimestamp(lastMessageTs);
            } else {
              body.setTimestamp(0);
            }
View Full Code Here

      // The user doesn't want to get audio packets
      ((IStreamData<?>) body).getData().free();
      if (sendBlankAudio) {
        // Send reset audio packet
        sendBlankAudio = false;
        body = new AudioData();
        // We need a zero timestamp
        if (lastMessageTs >= 0) {
          body.setTimestamp(lastMessageTs - timestampOffset);
        } else {
          body.setTimestamp(-timestampOffset);
View Full Code Here

    return new BytesRead(in.getInt());
  }

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

TOP

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

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.