Commit 0d1ae1dd by ccwu Committed by Oliver Woodman

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
parent 8353463b
...@@ -651,6 +651,9 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer ...@@ -651,6 +651,9 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
if (sampleHolder.isDecodeOnly()) { if (sampleHolder.isDecodeOnly()) {
decodeOnlyPresentationTimestamps.add(presentationTimeUs); decodeOnlyPresentationTimestamps.add(presentationTimeUs);
} }
onQueuedInputBuffer(presentationTimeUs, sampleHolder.data, bufferSize, sampleEncrypted);
if (sampleEncrypted) { if (sampleEncrypted) {
MediaCodec.CryptoInfo cryptoInfo = getFrameworkCryptoInfo(sampleHolder, MediaCodec.CryptoInfo cryptoInfo = getFrameworkCryptoInfo(sampleHolder,
adaptiveReconfigurationBytes); adaptiveReconfigurationBytes);
...@@ -662,7 +665,6 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer ...@@ -662,7 +665,6 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
codecReceivedBuffers = true; codecReceivedBuffers = true;
codecReconfigurationState = RECONFIGURATION_STATE_NONE; codecReconfigurationState = RECONFIGURATION_STATE_NONE;
codecCounters.inputBufferCount++; codecCounters.inputBufferCount++;
onQueuedInputBuffer(presentationTimeUs);
} catch (CryptoException e) { } catch (CryptoException e) {
notifyCryptoError(e); notifyCryptoError(e);
throw ExoPlaybackException.createForRenderer(e, getIndex()); throw ExoPlaybackException.createForRenderer(e, getIndex());
...@@ -750,13 +752,17 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer ...@@ -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> * <p>
* The default implementation is a no-op. * The default implementation is a no-op.
* *
* @param presentationTimeUs The timestamp associated with the input buffer. * @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. // Do nothing.
} }
......
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