title: Problems with MediaExtractor
body: <p>I am trying to get specific frames at specific times as images from a movie using <code>MediaExtractor</code> and <code>MediaCodec</code>. I can do it successfully if:</p>
  
  <ul>
  <li>I use <code>extractor.seekTo(time, MediaExtractor.SEEK_TO_PREVIOUS_SYNC);</code> , however, this only gives the nearest sync frame not the target frame.</li>
  <li>I sequentially extract all frames using <code>extractor.advance();</code> , but I need to get the target frame not all.</li>
  </ul>
  
  <p>So, I try the following:</p>
  
  <pre><code>extractor.seekTo(time, MediaExtractor.SEEK_TO_PREVIOUS_SYNC);
  while(extractor.getSampleTime()&lt;time /*target time*/) extractor.advance();
  </code></pre>
  
  <p>This provides the correct frame, but for some reason the image is corrupted. It looks like the correct image (the one I get from the successful cases), but with some pixelation and a strange haze.</p>
  
  <p>The <code>while-loop</code> is the only thing that is different between the successful cases and the corrupted ones. What to do to advance <code>MediaExtractor</code> to a specific time (not just sync time) without getting a corrupted image?</p>