Add hooks for timestamp checking in MediaCodecTrackRenderer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224468
This commit is contained in:
olly 2016-03-15 04:05:08 -07:00 committed by Oliver Woodman
parent 26ad44248a
commit fb1d2d9ee8

View file

@ -647,6 +647,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
inputIndex = -1;
codecHasQueuedBuffers = true;
codecReconfigurationState = RECONFIGURATION_STATE_NONE;
onQueuedInputBuffer(presentationTimeUs);
} catch (CryptoException e) {
notifyCryptoError(e);
throw ExoPlaybackException.createForRenderer(e, getIndex());
@ -733,6 +734,28 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
// Do nothing.
}
/**
* Invoked when an input buffer is queued into the codec.
* <p>
* The default implementation is a no-op.
*
* @param presentationTimeUs The timestamp associated with the input buffer.
*/
protected void onQueuedInputBuffer(long presentationTimeUs) {
// Do nothing.
}
/**
* Invoked when an output buffer is successfully processed.
* <p>
* The default implementation is a no-op.
*
* @param presentationTimeUs The timestamp associated with the output buffer.
*/
protected void onProcessedOutputBuffer(long presentationTimeUs) {
// Do nothing.
}
/**
* Determines whether the existing {@link MediaCodec} should be reconfigured for a new format by
* sending codec specific initialization data at the start of the next input buffer. If true is
@ -827,6 +850,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
int decodeOnlyIndex = getDecodeOnlyIndex(outputBufferInfo.presentationTimeUs);
if (processOutputBuffer(positionUs, elapsedRealtimeUs, codec, outputBuffers[outputIndex],
outputBufferInfo, outputIndex, decodeOnlyIndex != -1)) {
onProcessedOutputBuffer(outputBufferInfo.presentationTimeUs);
if (decodeOnlyIndex != -1) {
decodeOnlyPresentationTimestamps.remove(decodeOnlyIndex);
}