public boolean getAudioFrame(short[] out) { boolean res = false; BufferEntry be = jb.getPlayBuffer(); if (be == null) { /* no packet available. * * if the decoder supports "packet loss concealing" (PLC) it will * give us some interpolated sound data or silence, if not, the * player will substitute "false" with "silence" (comfort noise) */ if (dec.hasPLC()) { // Log.d(TAG, "Packet loss PLC"); res = dec.decode(null, 0, 0, out, false); } } else if (be.fec) { /* next packet (seqNo) is not available, but the next-next (seqNo+1) * * Since this packet *may* contain some redundant information about * the previous packet thru "forward error correction" (FEC) the * JitterBuffer has given it to as as a "preview" (peek) - therefore * we don't have to return the buffer. It stays in the queue and we'll * get it again as a "normal" sequence packet next */ if (dec.hasFEC()) { // Log.d(TAG, "Doing FEC with " + be.seqNo); res = dec.decode(be.data, be.offset, be.len, out, true); } else if (dec.hasPLC()) { Log.d(TAG, "PLC instead of FEC"); res = dec.decode(null, 0, 0, out, false); } } else { /* "normal" packet with the correct next sequence number */ // Log.d(TAG, "Normal decode of " + be.seqNo); res = dec.decode(be.data, be.offset, be.len, out, false); jb.returnPlayBuffer(be); } return res; }
public void stop() { dec.stop(); player.stop(); jb.reset(); }
public void start() { dec.start(); player.start(); Log.d(TAG, "Started"); }