Examples of IAudioStreamCodec


Examples of org.red5.codec.IAudioStreamCodec

              }
            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null.");
          }
          IAudioStreamCodec audioCodec = info.getAudioCodec();
          log.debug("Audio codec: {}", audioCodec);
          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 {
View Full Code Here

Examples of org.red5.codec.IAudioStreamCodec

     * Create and return new audio codec applicable for byte buffer data
     * @param data                 Byte buffer data
     * @return                     audio codec
     */
  public static IAudioStreamCodec getAudioCodec(IoBuffer data) {
    IAudioStreamCodec result = null;
    try {
      //get the codec identifying byte
      int codecId = (data.get() & 0xf0) >> 4;   
        switch (codecId) {
          case 10: //aac
            result = (IAudioStreamCodec) Class.forName("org.red5.codec.AACAudio").newInstance();
            break;
          // TODO add SPEEX support?
        }
        data.rewind();
    } catch (Exception ex) {
      log.error("Error creating codec instance", ex);     
    }
    //if codec is not found do the old-style loop
    if (result == null) {
        for (IAudioStreamCodec storedCodec: codecs) {
          IAudioStreamCodec codec;
          // XXX: this is a bit of a hack to create new instances of the
          // configured audio codec for each stream
          try {
            codec = storedCodec.getClass().newInstance();
          } catch (Exception e) {
            log.error("Could not create audio codec instance", e);
            continue;
          }
          if (codec.canHandleData(data)) {
            result = codec;
            break;
          }
        }
    }
View Full Code Here

Examples of org.red5.codec.IAudioStreamCodec

            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null");
          }
          // SplitmediaLabs - begin AAC fix
          IAudioStreamCodec audioCodec = info.getAudioCodec();
          log.debug("Audio codec: {}", audioCodec);
          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());
              //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 {
View Full Code Here

Examples of org.red5.codec.IAudioStreamCodec

          if (codecInfo instanceof StreamCodecInfo) {
            info = (StreamCodecInfo) codecInfo;
          }
          //log.trace("Stream codec info: {}", info);
          if (rtmpEvent instanceof AudioData) {
            IAudioStreamCodec audioStreamCodec = null;
            if (checkAudioCodec) {
              // dont try to read codec info from 0 length audio packets
              if (buf.limit() > 0) {
                  audioStreamCodec = AudioCodecFactory.getAudioCodec(buf);
                  if (info != null) {
                    info.setAudioCodec(audioStreamCodec);
                  }
                  checkAudioCodec = false;
              }
            } else if (codecInfo != null) {
              audioStreamCodec = codecInfo.getAudioCodec();
            }
            if (audioStreamCodec != null) {
              audioStreamCodec.addData(buf.asReadOnlyBuffer());
            }
            if (info != null) {
              info.setHasAudio(true);
            }
            eventTime = rtmpEvent.getTimestamp();
View Full Code Here

Examples of org.red5.codec.IAudioStreamCodec

              }
            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null.");
          }
          IAudioStreamCodec audioCodec = info.getAudioCodec();
          log.debug("Audio codec: {}", audioCodec);
          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 {
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.