protected FrameInfo seekTo(MediaPlayer.SeekMode seekMode, long seekTargetTimeUs,
                               MediaExtractor extractor, MediaCodec codec) throws IOException {
        if(mPassive) {
            // Even when not actively seeking, the codec must be flushed to get rid of left over
            // audio frames from the previous playback position and the EOS flags need to be reset too.
            mInputEos = false;
            mOutputEos = false;
            codec.flush();
            return null;
        }

        Log.d(TAG, "seeking to:                 " + seekTargetTimeUs);
        Log.d(TAG, "extractor current position: " + extractor.getSampleTime());

        extractor.seekTo(seekTargetTimeUs, seekMode.getBaseSeekMode());

        Log.d(TAG, "extractor new position:     " + extractor.getSampleTime());

        // TODO add seek cancellation possibility
        // e.g. by returning an object with a cancel method and checking the flag at fitting places within this method

        mInputEos = false;
        mOutputEos = false;
        codec.flush();

        if(extractor.hasTrackFormatChanged()) {
            reinitCodec();
            mRepresentationChanged = true;
        }

        return decodeFrame(true, true);
    }
This method implements the actual seeking and can be overwritten by subclasses to implement
custom seeking methods.

@see #seekTo(MediaPlayer.SeekMode, long)
MediaPlayer/src/main/java/net/protyposis/android/mediaplayer/MediaCodecDecoder.java