public void flush() {
        if(isInitialized()) {
            boolean playing = isPlaying();
            if(playing) {
                mAudioTrack.pause();
            }
            mAudioTrack.flush();
            mBufferQueue.flush();

            // Reset offset so it gets updated with the current PTS when playback continues
            mPresentationTimeOffsetUs = PTS_NOT_SET;

            if(playing) {
                mAudioTrack.play();
            }
        } else {
            throw new IllegalStateException();
        }
    }
Can be used to set an audio session ID before calling {@link #init(android.media.MediaFormat)}.
MediaPlayer/src/main/java/net/protyposis/android/mediaplayer/AudioPlayback.java