Allow overriding of codec buffer dequeue block time.

This commit is contained in:
Oliver Woodman 2015-04-22 16:17:36 +01:00
parent 1a9bf018a4
commit f637fde962

View File

@ -793,6 +793,15 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
return SystemClock.elapsedRealtime() < codecHotswapTimeMs + MAX_CODEC_HOTSWAP_TIME_MS;
}
/**
* Returns the maximum time to block whilst waiting for a decoded output buffer.
*
* @return The maximum time to block, in microseconds.
*/
protected long getDequeueOutputBufferTimeoutUs() {
return 0;
}
/**
* @return True if it may be possible to drain more output data. False otherwise.
* @throws ExoPlaybackException If an error occurs draining the output buffer.
@ -805,7 +814,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
}
if (outputIndex < 0) {
outputIndex = codec.dequeueOutputBuffer(outputBufferInfo, 0);
outputIndex = codec.dequeueOutputBuffer(outputBufferInfo, getDequeueOutputBufferTimeoutUs());
}
if (outputIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {