Change the signature of onQueuedInputBuffer

Expose the input buffer for Exoplayer V2. This allows subclasses to
parse the input buffer before it is decoded. One particular usage
of this is to allow parsing user data stored in the tracks
(e.g. SEI in H264), and incorporate the user data into the rendering.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117865971
This commit is contained in:
ccwu 2016-03-22 14:40:16 -07:00 committed by Oliver Woodman
parent 8353463bf5
commit 0d1ae1dd67

View file

@ -651,6 +651,9 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
if (sampleHolder.isDecodeOnly()) {
decodeOnlyPresentationTimestamps.add(presentationTimeUs);
}
onQueuedInputBuffer(presentationTimeUs, sampleHolder.data, bufferSize, sampleEncrypted);
if (sampleEncrypted) {
MediaCodec.CryptoInfo cryptoInfo = getFrameworkCryptoInfo(sampleHolder,
adaptiveReconfigurationBytes);
@ -662,7 +665,6 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
codecReceivedBuffers = true;
codecReconfigurationState = RECONFIGURATION_STATE_NONE;
codecCounters.inputBufferCount++;
onQueuedInputBuffer(presentationTimeUs);
} catch (CryptoException e) {
notifyCryptoError(e);
throw ExoPlaybackException.createForRenderer(e, getIndex());
@ -750,13 +752,17 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
}
/**
* Invoked when an input buffer is queued into the codec.
* Invoked immediately before 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.
* @param buffer The buffer to be queued.
* @param bufferSize the size of the sample data stored in the buffer.
* @param sampleEncrypted Whether the sample data is encrypted.
*/
protected void onQueuedInputBuffer(long presentationTimeUs) {
protected void onQueuedInputBuffer(
long presentationTimeUs, ByteBuffer buffer, int bufferSize, boolean sampleEncrypted) {
// Do nothing.
}