Ejemplo n.º 1
0
  @Override
  public int getCodecBlankPacket(byte[] buffer, int offset) {

    Arrays.fill(buffer, offset, offset + getOutgoingEncodedFrameSize(), (byte) G711.linear2ulaw(0));

    return getOutgoingEncodedFrameSize();
  }
Ejemplo n.º 2
0
  @Override
  public int pcmToCodec(float[] bufferIn, byte[] bufferOut) {

    if (bufferIn.length > 0) {
      for (int i = 0; i < bufferIn.length; i++) {
        bufferOut[i] = (byte) G711.linear2ulaw((int) bufferIn[i]);
      }

      return bufferOut.length;
    } else {
      return 0;
    }
  }
Ejemplo n.º 3
0
  @Override
  public int codecToPcm(byte[] bufferIn, float[] bufferOut) {

    if (bufferIn.length > 0) {
      for (int i = 0; i < bufferIn.length; i++) {
        bufferOut[i] = (float) G711.ulaw2linear((int) bufferIn[i]);
      }

      return bufferOut.length;
    } else {
      return 0;
    }
  }