Revert erroneous changes
This commit is contained in:
parent
eefb37a0ba
commit
b90f00c774
@ -237,10 +237,16 @@ import java.util.ArrayList;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderOutputBuffer(
|
protected void renderOutputBuffer(MediaCodecAdapter codec, int index, long presentationTimeUs) {
|
||||||
|
skipToPositionBeforeRenderingFirstFrame = false;
|
||||||
|
super.renderOutputBuffer(codec, index, presentationTimeUs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderOutputBufferV21(
|
||||||
MediaCodecAdapter codec, int index, long presentationTimeUs, long releaseTimeNs) {
|
MediaCodecAdapter codec, int index, long presentationTimeUs, long releaseTimeNs) {
|
||||||
skipToPositionBeforeRenderingFirstFrame = false;
|
skipToPositionBeforeRenderingFirstFrame = false;
|
||||||
super.renderOutputBuffer(codec, index, presentationTimeUs, releaseTimeNs);
|
super.renderOutputBufferV21(codec, index, presentationTimeUs, releaseTimeNs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +35,7 @@ import androidx.media3.common.Format;
|
|||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.util.MediaFormatUtil;
|
import androidx.media3.common.util.MediaFormatUtil;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
import androidx.media3.common.util.Util;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
@ -208,7 +209,7 @@ public final class DecodeOneFrameUtil {
|
|||||||
// Format must not include KEY_FRAME_RATE on API21.
|
// Format must not include KEY_FRAME_RATE on API21.
|
||||||
// https://developer.android.com/reference/android/media/MediaCodecList#findDecoderForFormat(android.media.MediaFormat)
|
// https://developer.android.com/reference/android/media/MediaCodecList#findDecoderForFormat(android.media.MediaFormat)
|
||||||
float frameRate = Format.NO_VALUE;
|
float frameRate = Format.NO_VALUE;
|
||||||
if (format.containsKey(MediaFormat.KEY_FRAME_RATE)) {
|
if (Util.SDK_INT == 21 && format.containsKey(MediaFormat.KEY_FRAME_RATE)) {
|
||||||
try {
|
try {
|
||||||
frameRate = format.getFloat(MediaFormat.KEY_FRAME_RATE);
|
frameRate = format.getFloat(MediaFormat.KEY_FRAME_RATE);
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
@ -220,7 +221,9 @@ public final class DecodeOneFrameUtil {
|
|||||||
|
|
||||||
@Nullable String mediaCodecName = mediaCodecList.findDecoderForFormat(format);
|
@Nullable String mediaCodecName = mediaCodecList.findDecoderForFormat(format);
|
||||||
|
|
||||||
MediaFormatUtil.maybeSetInteger(format, MediaFormat.KEY_FRAME_RATE, round(frameRate));
|
if (Util.SDK_INT == 21) {
|
||||||
|
MediaFormatUtil.maybeSetInteger(format, MediaFormat.KEY_FRAME_RATE, round(frameRate));
|
||||||
|
}
|
||||||
return mediaCodecName;
|
return mediaCodecName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,15 +102,16 @@ public final class ExoplayerEffectPlaybackSeekTest {
|
|||||||
new MediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT) {
|
new MediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT) {
|
||||||
private int numberOfFramesRendered;
|
private int numberOfFramesRendered;
|
||||||
|
|
||||||
|
// Overriding V21 is sufficient as we don't have test running below API26.
|
||||||
@Override
|
@Override
|
||||||
protected void renderOutputBuffer(
|
protected void renderOutputBufferV21(
|
||||||
MediaCodecAdapter codec, int index, long presentationTimeUs, long releaseTimeNs) {
|
MediaCodecAdapter codec, int index, long presentationTimeUs, long releaseTimeNs) {
|
||||||
numberOfFramesRendered++;
|
numberOfFramesRendered++;
|
||||||
if (numberOfFramesRendered == frameIndexToSkip) {
|
if (numberOfFramesRendered == frameIndexToSkip) {
|
||||||
frameSkippedCondition.open();
|
frameSkippedCondition.open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.renderOutputBuffer(codec, index, presentationTimeUs, releaseTimeNs);
|
super.renderOutputBufferV21(codec, index, presentationTimeUs, releaseTimeNs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public final class EncoderUtil {
|
|||||||
// Format must not include KEY_FRAME_RATE on API21.
|
// Format must not include KEY_FRAME_RATE on API21.
|
||||||
// https://developer.android.com/reference/android/media/MediaCodecList#findDecoderForFormat(android.media.MediaFormat)
|
// https://developer.android.com/reference/android/media/MediaCodecList#findDecoderForFormat(android.media.MediaFormat)
|
||||||
float frameRate = Format.NO_VALUE;
|
float frameRate = Format.NO_VALUE;
|
||||||
if (format.containsKey(MediaFormat.KEY_FRAME_RATE)) {
|
if (Util.SDK_INT == 21 && format.containsKey(MediaFormat.KEY_FRAME_RATE)) {
|
||||||
try {
|
try {
|
||||||
frameRate = format.getFloat(MediaFormat.KEY_FRAME_RATE);
|
frameRate = format.getFloat(MediaFormat.KEY_FRAME_RATE);
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
@ -328,7 +328,9 @@ public final class EncoderUtil {
|
|||||||
? mediaCodecList.findDecoderForFormat(format)
|
? mediaCodecList.findDecoderForFormat(format)
|
||||||
: mediaCodecList.findEncoderForFormat(format);
|
: mediaCodecList.findEncoderForFormat(format);
|
||||||
|
|
||||||
MediaFormatUtil.maybeSetInteger(format, MediaFormat.KEY_FRAME_RATE, round(frameRate));
|
if (Util.SDK_INT == 21) {
|
||||||
|
MediaFormatUtil.maybeSetInteger(format, MediaFormat.KEY_FRAME_RATE, round(frameRate));
|
||||||
|
}
|
||||||
return mediaCodecName;
|
return mediaCodecName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user