mirror of
https://github.com/androidx/media.git
synced 2025-05-09 00:20:45 +08:00
MediaCodecRenderer: Remove unused code path
SampleStreams should always provide samples starting from a keyframe. We do not have equivalent logic in any of our extension decoder renderers. PiperOrigin-RevId: 319012365
This commit is contained in:
parent
5be6eaa88c
commit
0a2bacb7b7
@ -401,7 +401,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
private long lastBufferInStreamPresentationTimeUs;
|
private long lastBufferInStreamPresentationTimeUs;
|
||||||
private boolean inputStreamEnded;
|
private boolean inputStreamEnded;
|
||||||
private boolean outputStreamEnded;
|
private boolean outputStreamEnded;
|
||||||
private boolean waitingForFirstSyncSample;
|
|
||||||
private boolean waitingForFirstSampleInFormat;
|
private boolean waitingForFirstSampleInFormat;
|
||||||
private boolean pendingOutputEndOfStream;
|
private boolean pendingOutputEndOfStream;
|
||||||
@MediaCodecOperationMode private int mediaCodecOperationMode;
|
@MediaCodecOperationMode private int mediaCodecOperationMode;
|
||||||
@ -893,7 +892,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
codecHotswapDeadlineMs = C.TIME_UNSET;
|
codecHotswapDeadlineMs = C.TIME_UNSET;
|
||||||
codecReceivedEos = false;
|
codecReceivedEos = false;
|
||||||
codecReceivedBuffers = false;
|
codecReceivedBuffers = false;
|
||||||
waitingForFirstSyncSample = true;
|
|
||||||
codecNeedsAdaptationWorkaroundBuffer = false;
|
codecNeedsAdaptationWorkaroundBuffer = false;
|
||||||
shouldSkipAdaptationWorkaroundOutputBuffer = false;
|
shouldSkipAdaptationWorkaroundOutputBuffer = false;
|
||||||
isDecodeOnlyOutputBuffer = false;
|
isDecodeOnlyOutputBuffer = false;
|
||||||
@ -1320,19 +1318,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This code block may be unnecessary, because it's probably the case that the buffer will
|
|
||||||
// always be a keyframe if waitingForFirstSyncSample is true. Check this, and remove if so.
|
|
||||||
if (waitingForFirstSyncSample && !buffer.isKeyFrame()) {
|
|
||||||
buffer.clear();
|
|
||||||
if (codecReconfigurationState == RECONFIGURATION_STATE_QUEUE_PENDING) {
|
|
||||||
// The buffer we just cleared contained reconfiguration data. We need to re-write this
|
|
||||||
// data into a subsequent buffer (if there is one).
|
|
||||||
codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
waitingForFirstSyncSample = false;
|
|
||||||
|
|
||||||
boolean bufferEncrypted = buffer.isEncrypted();
|
boolean bufferEncrypted = buffer.isEncrypted();
|
||||||
if (bufferEncrypted) {
|
if (bufferEncrypted) {
|
||||||
buffer.cryptoInfo.increaseClearDataFirstSubSampleBy(adaptiveReconfigurationBytes);
|
buffer.cryptoInfo.increaseClearDataFirstSubSampleBy(adaptiveReconfigurationBytes);
|
||||||
|
@ -503,13 +503,23 @@ public class SampleQueue implements TrackOutput {
|
|||||||
if (upstreamFormatAdjustmentRequired) {
|
if (upstreamFormatAdjustmentRequired) {
|
||||||
format(Assertions.checkStateNotNull(unadjustedUpstreamFormat));
|
format(Assertions.checkStateNotNull(unadjustedUpstreamFormat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isKeyframe = (flags & C.BUFFER_FLAG_KEY_FRAME) != 0;
|
||||||
|
if (upstreamKeyframeRequired) {
|
||||||
|
if (!isKeyframe) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
upstreamKeyframeRequired = false;
|
||||||
|
}
|
||||||
|
|
||||||
timeUs += sampleOffsetUs;
|
timeUs += sampleOffsetUs;
|
||||||
if (pendingSplice) {
|
if (pendingSplice) {
|
||||||
if ((flags & C.BUFFER_FLAG_KEY_FRAME) == 0 || !attemptSplice(timeUs)) {
|
if (!isKeyframe || !attemptSplice(timeUs)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pendingSplice = false;
|
pendingSplice = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long absoluteOffset = sampleDataQueue.getTotalBytesWritten() - size - offset;
|
long absoluteOffset = sampleDataQueue.getTotalBytesWritten() - size - offset;
|
||||||
commitSample(timeUs, flags, absoluteOffset, size, cryptoData);
|
commitSample(timeUs, flags, absoluteOffset, size, cryptoData);
|
||||||
}
|
}
|
||||||
@ -676,14 +686,6 @@ public class SampleQueue implements TrackOutput {
|
|||||||
long offset,
|
long offset,
|
||||||
int size,
|
int size,
|
||||||
@Nullable CryptoData cryptoData) {
|
@Nullable CryptoData cryptoData) {
|
||||||
if (upstreamKeyframeRequired) {
|
|
||||||
if ((sampleFlags & C.BUFFER_FLAG_KEY_FRAME) == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
upstreamKeyframeRequired = false;
|
|
||||||
}
|
|
||||||
Assertions.checkState(!upstreamFormatRequired);
|
|
||||||
|
|
||||||
isLastSampleQueued = (sampleFlags & C.BUFFER_FLAG_LAST_SAMPLE) != 0;
|
isLastSampleQueued = (sampleFlags & C.BUFFER_FLAG_LAST_SAMPLE) != 0;
|
||||||
largestQueuedTimestampUs = Math.max(largestQueuedTimestampUs, timeUs);
|
largestQueuedTimestampUs = Math.max(largestQueuedTimestampUs, timeUs);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user