Commit fb1d2d9e by olly Committed by Oliver Woodman

Add hooks for timestamp checking in MediaCodecTrackRenderer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224468
parent 26ad4424
...@@ -647,6 +647,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer ...@@ -647,6 +647,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
inputIndex = -1; inputIndex = -1;
codecHasQueuedBuffers = true; codecHasQueuedBuffers = true;
codecReconfigurationState = RECONFIGURATION_STATE_NONE; codecReconfigurationState = RECONFIGURATION_STATE_NONE;
onQueuedInputBuffer(presentationTimeUs);
} catch (CryptoException e) { } catch (CryptoException e) {
notifyCryptoError(e); notifyCryptoError(e);
throw ExoPlaybackException.createForRenderer(e, getIndex()); throw ExoPlaybackException.createForRenderer(e, getIndex());
...@@ -734,6 +735,28 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer ...@@ -734,6 +735,28 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
} }
/** /**
* 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 * 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 * sending codec specific initialization data at the start of the next input buffer. If true is
* returned then the {@link MediaCodec} instance will be reconfigured in this way. If false is * returned then the {@link MediaCodec} instance will be reconfigured in this way. If false is
...@@ -827,6 +850,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer ...@@ -827,6 +850,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
int decodeOnlyIndex = getDecodeOnlyIndex(outputBufferInfo.presentationTimeUs); int decodeOnlyIndex = getDecodeOnlyIndex(outputBufferInfo.presentationTimeUs);
if (processOutputBuffer(positionUs, elapsedRealtimeUs, codec, outputBuffers[outputIndex], if (processOutputBuffer(positionUs, elapsedRealtimeUs, codec, outputBuffers[outputIndex],
outputBufferInfo, outputIndex, decodeOnlyIndex != -1)) { outputBufferInfo, outputIndex, decodeOnlyIndex != -1)) {
onProcessedOutputBuffer(outputBufferInfo.presentationTimeUs);
if (decodeOnlyIndex != -1) { if (decodeOnlyIndex != -1) {
decodeOnlyPresentationTimestamps.remove(decodeOnlyIndex); decodeOnlyPresentationTimestamps.remove(decodeOnlyIndex);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment