Refactor according to reviews.

This commit is contained in:
Patrik Aradi 2024-02-26 09:34:32 +08:00 committed by Luyuan Chen
parent 52adaf8d26
commit 51a9bcca61
5 changed files with 9 additions and 6 deletions

View File

@ -75,7 +75,8 @@ public interface VideoGraph {
* *
* <p>If the method throws, the caller must call {@link #release}. * <p>If the method throws, the caller must call {@link #release}.
* *
* @param sequenceIndex The sequence index of the input which can aid ordering of the inputs. * @param sequenceIndex The sequence index of the input which can aid ordering of the inputs. The
* index must start from 0.
*/ */
void registerInput(int sequenceIndex) throws VideoFrameProcessingException; void registerInput(int sequenceIndex) throws VideoFrameProcessingException;

View File

@ -47,6 +47,8 @@ import androidx.media3.common.VideoFrameProcessor;
import androidx.media3.common.VideoGraph; import androidx.media3.common.VideoGraph;
import androidx.media3.common.util.GlUtil; import androidx.media3.common.util.GlUtil;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
@ -261,7 +263,7 @@ public abstract class MultipleInputVideoGraph implements VideoGraph {
@Override @Override
public VideoFrameProcessor getProcessor(int inputId) { public VideoFrameProcessor getProcessor(int inputId) {
checkState(preProcessors.indexOfKey(inputId) >= 0); checkState(Util.contains(preProcessors, inputId));
return preProcessors.get(inputId); return preProcessors.get(inputId);
} }

View File

@ -38,7 +38,7 @@ import java.util.concurrent.Executor;
@UnstableApi @UnstableApi
public abstract class SingleInputVideoGraph implements VideoGraph { public abstract class SingleInputVideoGraph implements VideoGraph {
/** The ID {@link #registerInput(int)} returns. */ /** The index of the only {@linkplain #registerInput(int) registered} input. */
public static final int SINGLE_INPUT_INDEX = 0; public static final int SINGLE_INPUT_INDEX = 0;
private final Context context; private final Context context;

View File

@ -49,8 +49,8 @@ public interface VideoCompositor extends GlTextureProducer {
* Registers a new input source, and returns a unique {@code inputId} corresponding to this * Registers a new input source, and returns a unique {@code inputId} corresponding to this
* source, to be used in {@link #queueInputTexture}. * source, to be used in {@link #queueInputTexture}.
* *
* @param sequenceIndex The sequence index of the input source, which is can be used to determine * @param sequenceIndex The sequence index of the input source which is used to determine the
* the order of the input sources. * order of the input sources.
*/ */
void registerInputSource(int sequenceIndex); void registerInputSource(int sequenceIndex);

View File

@ -64,7 +64,7 @@ import java.util.List;
* *
* @param editedMediaItem The initial {@link EditedMediaItem} of the input. * @param editedMediaItem The initial {@link EditedMediaItem} of the input.
* @param format The initial {@link Format} of the input. * @param format The initial {@link Format} of the input.
* @param sequenceIndex The sequence index of the input. * @param sequenceIndex The index of the input sequence.
* @throws ExportException If an error occurs getting the input. * @throws ExportException If an error occurs getting the input.
*/ */
public abstract GraphInput getInput( public abstract GraphInput getInput(