Use C.LENGTH_UNSET for resolution parameter instead of Format.NO_VALUE.

Format.NO_VALUE should only be used for Format fields.

PiperOrigin-RevId: 416646415
This commit is contained in:
hschlueter 2021-12-15 22:21:58 +00:00 committed by tonihei
parent 7b5dcb3786
commit e094ceb079
4 changed files with 7 additions and 8 deletions

View file

@ -29,7 +29,7 @@ import android.opengl.GLES20;
import android.view.Surface;
import android.view.SurfaceView;
import androidx.annotation.Nullable;
import androidx.media3.common.Format;
import androidx.media3.common.C;
import androidx.media3.common.util.GlUtil;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
@ -109,8 +109,8 @@ import java.util.concurrent.atomic.AtomicInteger;
debugPreviewHeight = debugSurfaceView.getHeight();
} else {
debugPreviewEglSurface = null;
debugPreviewWidth = Format.NO_VALUE;
debugPreviewHeight = Format.NO_VALUE;
debugPreviewWidth = C.LENGTH_UNSET;
debugPreviewHeight = C.LENGTH_UNSET;
}
return new FrameEditor(
eglDisplay,

View file

@ -35,7 +35,6 @@ import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.media3.common.C;
import androidx.media3.common.Format;
import androidx.media3.common.MediaItem;
import androidx.media3.common.MediaLibraryInfo;
import androidx.media3.common.MimeTypes;
@ -115,7 +114,7 @@ public final class Transformer {
@Deprecated
public Builder() {
muxerFactory = new FrameworkMuxer.Factory();
outputHeight = Format.NO_VALUE;
outputHeight = C.LENGTH_UNSET;
transformationMatrix = new Matrix();
containerMimeType = MimeTypes.VIDEO_MP4;
listener = new Listener() {};
@ -132,7 +131,7 @@ public final class Transformer {
public Builder(Context context) {
this.context = context.getApplicationContext();
muxerFactory = new FrameworkMuxer.Factory();
outputHeight = Format.NO_VALUE;
outputHeight = C.LENGTH_UNSET;
transformationMatrix = new Matrix();
containerMimeType = MimeTypes.VIDEO_MP4;
listener = new Listener() {};

View file

@ -89,7 +89,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
&& !transformation.videoMimeType.equals(inputFormat.sampleMimeType)) {
return true;
}
if (transformation.outputHeight != Format.NO_VALUE
if (transformation.outputHeight != C.LENGTH_UNSET
&& transformation.outputHeight != inputFormat.height) {
return true;
}

View file

@ -66,7 +66,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// TODO(internal b/209781577): Think about which edge length should be set for portrait videos.
int outputWidth = inputFormat.width;
int outputHeight = inputFormat.height;
if (transformation.outputHeight != Format.NO_VALUE
if (transformation.outputHeight != C.LENGTH_UNSET
&& transformation.outputHeight != inputFormat.height) {
outputWidth = inputFormat.width * transformation.outputHeight / inputFormat.height;
outputHeight = transformation.outputHeight;