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 Ian Baker
parent 4bf7ffd9a7
commit 66adeabb1b
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 com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.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

@ -38,7 +38,6 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -113,7 +112,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() {};
@ -130,7 +129,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;