title: MediaExtractor throws IllegalArgumentException when used with wav file
body: <p>I am using the Android MediaExtractor like this:</p>
  
  <pre><code>MediaExtractor extractor = new MediaExtractor();
  extractor.setDataSource("path/to/my/wav/file.wav");
  extractor.selectTrack(0);
  
  ByteBuffer inputBuffer = codec.getInputBuffer(inputBufferIndex);
  int sampleSize =  extractor.readSampleData(inputBuffer, 0);
  </code></pre>
  
  <p>The inputBuffer is provided by MediaCodec which is configured as AAC Encoder. The goal is to convert the wave file to aac. The above code is abbreviated, of course, but I tracked the error down to the last line.</p>
  
  <p>It also only occurs when using the MediaExtractor with a wav file. For example, I used a .m4a instead and everything worked fine.</p>
  
  <p>The documentation of MediaExtractor says:</p>
  
  <blockquote>
    <p>MediaExtractor facilitates extraction of demuxed, typically encoded, media data from a data source.</p>
  </blockquote>
  
  <p>"typically encdoded" does not exclude un-encodec PCM audio....right? Anyone tried this before or knows another stable(!) way to:</p>
  
  <ul>
  <li>extract the audio samples from a wav (excluding 44byte or 46byte header)?</li>
  <li>convert an wav file to aac on Android?</li>
  </ul>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is the logcat:</p>
  
  <pre><code>W/System.err: java.lang.IllegalArgumentException
  W/System.err:     at android.media.MediaExtractor.readSampleData(Native Method)
  W/System.err:     at com.myproject.android.audiosandbox.convert.MediaEncoder2.encodeLollipopStyle(MediaEncoder2.java:247)
  W/System.err:     at com.myproject.android.audiosandbox.convert.MediaEncoder2.encodeSong(MediaEncoder2.java:119)
  W/System.err:     at com.myproject.android.audiosandbox.convert.MediaEncoder2.encode(MediaEncoder2.java:70)
  W/System.err:     at com.myproject.android.audiosandbox.fragments.AudioConvertFragment$1.onClick(AudioConvertFragment.java:40)
  W/System.err:     at android.view.View.performClick(View.java:4763)
  W/System.err:     at android.view.View$PerformClick.run(View.java:19821)
  W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
  W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
  W/System.err:     at android.os.Looper.loop(Looper.java:135)
  W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5272)
  W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
  W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
  W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
  W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
  </code></pre>
  
  <p>I am using API 16, so MediaMuxer is not an option (was added in API 18).</p>