title: Android AudioTrack write blocks for the whole period of playback
body: <p>I am using <code>AudioTrack</code> class to play a stream of raw sound data:</p>
  
  <pre><code>AudioTrack audioTrack;
  int sampleRate = 11025;
  int channelConfigIn = AudioFormat.CHANNEL_IN_MONO;
  int channelConfigOut = AudioFormat.CHANNEL_OUT_STEREO;
  int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
  .....
  int bufferSize = AudioTrack.getMinBufferSize(sampleRate,channelConfigOut,audioFormat);
  audioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL,sampleRate,channelConfigOut,audioFormat,bufferSize,AudioTrack.MODE_STREAM);
      audioTrack.play();
  </code></pre>
  
  <p>Then on a separate thread:</p>
  
  <pre><code>while(true)
  {
      short [] buffer = new short[14500];
      //fill buffer with sound data
      long time = System.currentTimeMillis();
      audioTrack.write(buffer,0,14500);
      Log.i("time",(System.currentTimeMillis() - time) + "");
  }
  </code></pre>
  
  <p>My problem is that the log always shows that the <code>write</code> method blocks for about 0.6 second, that is the same as the played sound length (14500 samples), moreover the phone is not responding during the playback, the main tread almost can not do anything anyone can help...</p>