Commit f67569d2 by tofunmi Committed by microkatz

Update `FrameProcessor.create()` to accept an input track type.

Based on [this conversation thread](https://chat.google.com/room/AAAA--f88ao/76Rem_cRCK8), I've opted to update the existing FrameProcessor.create() rather than deprecate it, as it is unlikely to be in use by apps outside google3.

PiperOrigin-RevId: 506920930
parent c4faae6b
......@@ -50,6 +50,8 @@ public interface FrameProcessor {
* @param debugViewProvider A {@link DebugViewProvider}.
* @param inputColorInfo The {@link ColorInfo} for input frames.
* @param outputColorInfo The {@link ColorInfo} for output frames.
* @param inputTrackType The {@link C.TrackType} of the input. Supported track types are {@link
* C#TRACK_TYPE_VIDEO} and {@link C#TRACK_TYPE_IMAGE}.
* @param releaseFramesAutomatically If {@code true}, the {@link FrameProcessor} will render
* output frames to the {@linkplain #setOutputSurfaceInfo(SurfaceInfo) output surface}
* automatically as {@link FrameProcessor} is done processing them. If {@code false}, the
......@@ -67,6 +69,7 @@ public interface FrameProcessor {
DebugViewProvider debugViewProvider,
ColorInfo inputColorInfo,
ColorInfo outputColorInfo,
@C.TrackType int inputTrackType,
boolean releaseFramesAutomatically,
Executor executor,
Listener listener)
......
......@@ -24,6 +24,7 @@ import android.graphics.PixelFormat;
import android.media.Image;
import android.media.ImageReader;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.FrameInfo;
......@@ -295,6 +296,7 @@ public final class GlEffectsFrameProcessorFrameReleaseTest {
DebugViewProvider.NONE,
/* inputColorInfo= */ ColorInfo.SDR_BT709_LIMITED,
/* outputColorInfo= */ ColorInfo.SDR_BT709_LIMITED,
C.TRACK_TYPE_VIDEO,
releaseFramesAutomatically,
MoreExecutors.directExecutor(),
new FrameProcessor.Listener() {
......
......@@ -96,6 +96,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
DebugViewProvider debugViewProvider,
ColorInfo inputColorInfo,
ColorInfo outputColorInfo,
@C.TrackType int inputTrackType,
boolean releaseFramesAutomatically,
Executor listenerExecutor,
Listener listener)
......
......@@ -1986,6 +1986,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
DebugViewProvider.NONE,
inputColorInfo,
outputColorInfo,
C.TRACK_TYPE_VIDEO,
/* releaseFramesAutomatically= */ false,
/* executor= */ handler::post,
new FrameProcessor.Listener() {
......
......@@ -28,6 +28,7 @@ import android.media.Image;
import android.media.ImageReader;
import android.media.MediaFormat;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect;
......@@ -225,6 +226,7 @@ public final class FrameProcessorTestRunner {
DebugViewProvider.NONE,
inputColorInfo,
outputColorInfo,
C.TRACK_TYPE_VIDEO,
/* releaseFramesAutomatically= */ true,
MoreExecutors.directExecutor(),
new FrameProcessor.Listener() {
......
......@@ -154,6 +154,7 @@ import org.checkerframework.dataflow.qual.Pure;
debugViewProvider,
frameProcessorInputColor,
frameProcessorOutputColor,
MimeTypes.getTrackType(firstInputFormat.sampleMimeType),
/* releaseFramesAutomatically= */ true,
MoreExecutors.directExecutor(),
new FrameProcessor.Listener() {
......
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