示例#1
0
  public void onIncomingEncodedFrame(byte[] frame) {

    Logger.hysteria("AudioProcessor.onIncomingEncodedFrame");
    if (sender != null) sender.onReceivedFrame(frame);
    else {
      onIncomingReceivedFrame(frame, payloadType);
      Logger.debug("sender == null. Redirecting to receiver");
    }
  }
示例#2
0
  public AudioProcessor(
      int pt, AudioSource src, AudioSender snd, AudioDestination dst, AudioReceiver rcv, int fs) {
    Logger.debug("in AudioProcessor constructor");
    if (disableOutgoing) {
      src = null;
      // snd = null;
    }

    init(pt, src, snd, dst, rcv, fs);
  }
示例#3
0
 public boolean resumeSuspendedSource() {
   Logger.debug("audioprosessor.resumesuspendedsource starts");
   if (suspendedSource == null) return false;
   Logger.debug("close source");
   source.close();
   Logger.debug("source closed");
   source = null;
   Logger.debug("vanha source");
   source = suspendedSource;
   Logger.debug("unhalt vanha source");
   boolean ok = source.unhalt();
   Logger.debug("vanha source unhalted");
   Logger.debug("audioprosessor.resumesuspendedsource ends");
   return ok;
 }
示例#4
0
  private void init(
      int payloadType,
      AudioSource src,
      AudioSender snd,
      AudioDestination dst,
      AudioReceiver rcv,
      int fs) {

    Logger.debug("AudioProcessor.init:");
    Logger.debug("		destination=" + dst.getClass());
    if (src != null) Logger.debug("		source=" + src.getClass());
    else Logger.debug("		source=null");
    if (snd != null) Logger.debug("		sender=" + snd.getClass());
    else Logger.debug("		sender=null");
    if (rcv != null) Logger.debug("		receiver=" + rcv.getClass());
    else Logger.debug("		receiver=null");
    this.payloadType = payloadType;
    frameSize = fs;
    {
      Logger.debug("");
      switch (this.payloadType) {
        case 0:
          encoder = new PCMUCodec4(this);
          decoder = new PCMUCodec4(this);
          break;
        case 8:
          encoder = new PCMACodec(this);
          decoder = new PCMACodec(this);
          break;
        default:
          encoder = null;
          decoder = null;
          break;
      }
      if (encoder != null) Logger.debug("encoder=" + encoder.getClass());
      if (decoder != null) Logger.debug("decoder=" + decoder.getClass());
      if (encoder != null) encoder.init();
      if (decoder != null) decoder.init();
    }
    source = src;
    sender = snd;
    destination = dst;
    // Logger.debug("AudioProcessor constructor: destination="+destination);
    receiver = rcv;
    if (sender != null) sender.init(this.payloadType);
    AudioFormat format =
        new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 8000, 16, 1, 2, 8000, bigEndian);
    //	AudioFormat format=new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,22050,8,1,1,22050,false);
    if (source != null) source.init(this, format, frameSize);
    if (destination != null) destination.init(this, format, frameSize);
    else Logger.error("AudioProcessor: destination=null");
    if (receiver != null) receiver.init(this);
  }