private void renderVideoFrame(MediaCodecDecoder.FrameInfo videoFrameInfo) throws InterruptedException {
            if(videoFrameInfo.endOfStream) {
                // The EOS frame does not contain a video frame, so we dismiss it
                mDecoders.getVideoDecoder().dismissFrame(videoFrameInfo);
                return;
            }

            // Calculate waiting time until the next frame's PTS
            // The waiting time might be much higher that a frame's duration because timed API21
            // rendering caches multiple released output frames before actually rendering them.
            long waitingTime = mTimeBase.getOffsetFrom(videoFrameInfo.presentationTimeUs);
//            Log.d(TAG, "VPTS " + mCurrentPosition
//                    + " APTS " + mAudioPlayback.getCurrentPresentationTimeUs()
//                    + " waitingTime " + waitingTime);

            if (waitingTime < -1000) {
                // we need to catch up time by skipping rendering of this frame
                // this doesn't gain enough time if playback speed is too high and decoder at full load
                // TODO improve fast forward mode
                Log.d(TAG, "LAGGING " + waitingTime);
                mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_INFO,
                        MEDIA_INFO_VIDEO_TRACK_LAGGING, 0));
            }

            // Defer the video size changed message until the first frame of the new size is being rendered
            if (videoFrameInfo.representationChanged) {
                mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_SET_VIDEO_SIZE,
                        mDecoders.getVideoDecoder().getVideoWidth(), mDecoders.getVideoDecoder().getVideoHeight()));
            }

            // Slow down playback, if necessary, to keep frame rate
            if(!mRenderModeApi21 && waitingTime > 5000) {
                // Sleep until it's time to render the next frame
                // This is not v-synced to the display. Not required any more on API 21+.
                Thread.sleep(waitingTime / 1000);
            }
            // Release the current frame and render it to the surface
            mDecoders.getVideoDecoder().renderFrame(videoFrameInfo, waitingTime);
        }
Removes a cue added by {@link #addCue(int, Object)} from the playback timeline.

@param cue the cue to remove
@return true if removal was successful, false if the cue wasn't cued on the timeline,
i.e. it has already been removed before
MediaPlayer/src/main/java/net/protyposis/android/mediaplayer/MediaPlayer.java