Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3e5ae92b
authored
Feb 15, 2023
by
andrewlewis
Committed by
christosts
Feb 17, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix some minor nits
PiperOrigin-RevId: 509879029
parent
482871fe
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
83 additions
and
83 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/FrameProcessor.java
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/CropPixelTest.java
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/GlEffectsFrameProcessorPixelTest.java
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/MatrixShaderProgramPixelTest.java
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/PresentationPixelTest.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/ExternalTextureManager.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/FrameCache.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/FrameCacheShaderProgram.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/InternalTextureManager.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/OverlaySettings.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/mh/ToneMapHdrToSdrUsingOpenGlTest.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/ExoPlayerAssetLoader.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoSamplePipeline.java
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/EncoderUtilTest.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/DecodeOneFrameUtil.java
library/common/src/main/java/com/google/android/exoplayer2/util/FrameProcessor.java
View file @
3e5ae92b
...
@@ -136,6 +136,7 @@ public interface FrameProcessor {
...
@@ -136,6 +136,7 @@ public interface FrameProcessor {
* @param inputBitmap The {@link Bitmap} queued to the {@link FrameProcessor}.
* @param inputBitmap The {@link Bitmap} queued to the {@link FrameProcessor}.
* @param durationUs The duration for which to display the {@code inputBitmap}, in microseconds.
* @param durationUs The duration for which to display the {@code inputBitmap}, in microseconds.
* @param frameRate The frame rate at which to display the {@code inputBitmap}, in frames per
* @param frameRate The frame rate at which to display the {@code inputBitmap}, in frames per
* second.
*/
*/
// TODO(b/262693274): Remove duration and frameRate parameters when EditedMediaItem can be
// TODO(b/262693274): Remove duration and frameRate parameters when EditedMediaItem can be
// signalled down to the processors.
// signalled down to the processors.
...
...
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/CropPixelTest.java
View file @
3e5ae92b
...
@@ -106,7 +106,7 @@ public final class CropPixelTest {
...
@@ -106,7 +106,7 @@ public final class CropPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -127,7 +127,7 @@ public final class CropPixelTest {
...
@@ -127,7 +127,7 @@ public final class CropPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -148,7 +148,7 @@ public final class CropPixelTest {
...
@@ -148,7 +148,7 @@ public final class CropPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
...
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/GlEffectsFrameProcessorPixelTest.java
View file @
3e5ae92b
This diff is collapsed.
Click to expand it.
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/MatrixShaderProgramPixelTest.java
View file @
3e5ae92b
...
@@ -109,7 +109,7 @@ public final class MatrixShaderProgramPixelTest {
...
@@ -109,7 +109,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -131,7 +131,7 @@ public final class MatrixShaderProgramPixelTest {
...
@@ -131,7 +131,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -151,7 +151,7 @@ public final class MatrixShaderProgramPixelTest {
...
@@ -151,7 +151,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -171,7 +171,7 @@ public final class MatrixShaderProgramPixelTest {
...
@@ -171,7 +171,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
Bitmap
actualBitmap
=
createArgb8888BitmapFromCurrentGlFramebuffer
(
inputWidth
,
inputHeight
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
...
library/effect/src/androidTest/java/com/google/android/exoplayer2/effect/PresentationPixelTest.java
View file @
3e5ae92b
...
@@ -115,7 +115,7 @@ public final class PresentationPixelTest {
...
@@ -115,7 +115,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -136,7 +136,7 @@ public final class PresentationPixelTest {
...
@@ -136,7 +136,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -157,7 +157,7 @@ public final class PresentationPixelTest {
...
@@ -157,7 +157,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -180,7 +180,7 @@ public final class PresentationPixelTest {
...
@@ -180,7 +180,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -203,7 +203,7 @@ public final class PresentationPixelTest {
...
@@ -203,7 +203,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -224,7 +224,7 @@ public final class PresentationPixelTest {
...
@@ -224,7 +224,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
@@ -245,7 +245,7 @@ public final class PresentationPixelTest {
...
@@ -245,7 +245,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
maybeSaveTestBitmapToCacheDirectory
(
testId
,
/* bitmapLabel= */
"actual"
,
actualBitmap
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
assertThat
(
averagePixelAbsoluteDifference
).
isAtMost
(
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE
);
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/ExternalTextureManager.java
View file @
3e5ae92b
...
@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* Forwards externally produced frames that become available via a {@link SurfaceTexture} to an
* Forwards externally produced frames that become available via a {@link SurfaceTexture} to an
* {@link ExternalShaderProgram} for consumption.
* {@link ExternalShaderProgram} for consumption.
*/
*/
/* package */
class
ExternalTextureManager
implements
InputListener
{
/* package */
final
class
ExternalTextureManager
implements
InputListener
{
private
final
FrameProcessingTaskExecutor
frameProcessingTaskExecutor
;
private
final
FrameProcessingTaskExecutor
frameProcessingTaskExecutor
;
private
final
ExternalShaderProgram
externalShaderProgram
;
private
final
ExternalShaderProgram
externalShaderProgram
;
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/FrameCache.java
View file @
3e5ae92b
...
@@ -27,7 +27,7 @@ import com.google.android.exoplayer2.util.FrameProcessingException;
...
@@ -27,7 +27,7 @@ import com.google.android.exoplayer2.util.FrameProcessingException;
* <p>Example usage: cache the processed frames when presenting them on screen, to accommodate for
* <p>Example usage: cache the processed frames when presenting them on screen, to accommodate for
* the possible fluctuation in frame processing time between frames.
* the possible fluctuation in frame processing time between frames.
*/
*/
public
class
FrameCache
implements
GlEffect
{
public
final
class
FrameCache
implements
GlEffect
{
/** The capacity of the frame cache. */
/** The capacity of the frame cache. */
public
final
int
capacity
;
public
final
int
capacity
;
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/FrameCacheShaderProgram.java
View file @
3e5ae92b
...
@@ -35,7 +35,7 @@ import java.util.concurrent.Executor;
...
@@ -35,7 +35,7 @@ import java.util.concurrent.Executor;
*
*
* <p>Implements {@link FrameCache}.
* <p>Implements {@link FrameCache}.
*/
*/
/* package */
class
FrameCacheShaderProgram
implements
GlShaderProgram
{
/* package */
final
class
FrameCacheShaderProgram
implements
GlShaderProgram
{
private
static
final
String
VERTEX_SHADER_TRANSFORMATION_ES2_PATH
=
private
static
final
String
VERTEX_SHADER_TRANSFORMATION_ES2_PATH
=
"shaders/vertex_shader_transformation_es2.glsl"
;
"shaders/vertex_shader_transformation_es2.glsl"
;
private
static
final
String
FRAGMENT_SHADER_TRANSFORMATION_ES2_PATH
=
private
static
final
String
FRAGMENT_SHADER_TRANSFORMATION_ES2_PATH
=
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/InternalTextureManager.java
View file @
3e5ae92b
...
@@ -30,11 +30,11 @@ import java.util.Queue;
...
@@ -30,11 +30,11 @@ import java.util.Queue;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
/**
/**
* Forwards a frame produced from a {@link Bitmap} to a {@link GlShaderProgram} for consumption
* Forwards a frame produced from a {@link Bitmap} to a {@link GlShaderProgram} for consumption
.
*
*
* <p>Methods in this class can be called from any thread.
* <p>Methods in this class can be called from any thread.
*/
*/
/* package */
class
InternalTextureManager
implements
GlShaderProgram
.
InputListener
{
/* package */
final
class
InternalTextureManager
implements
GlShaderProgram
.
InputListener
{
private
final
GlShaderProgram
shaderProgram
;
private
final
GlShaderProgram
shaderProgram
;
private
final
FrameProcessingTaskExecutor
frameProcessingTaskExecutor
;
private
final
FrameProcessingTaskExecutor
frameProcessingTaskExecutor
;
// The queue holds all bitmaps with one or more frames pending to be sent downstream.
// The queue holds all bitmaps with one or more frames pending to be sent downstream.
...
@@ -94,7 +94,7 @@ import java.util.concurrent.LinkedBlockingQueue;
...
@@ -94,7 +94,7 @@ import java.util.concurrent.LinkedBlockingQueue;
frameProcessingTaskExecutor
.
submit
(
frameProcessingTaskExecutor
.
submit
(
()
->
{
()
->
{
inputEnded
=
true
;
inputEnded
=
true
;
s
ignalEndOfOutput
();
maybeS
ignalEndOfOutput
();
});
});
}
}
...
@@ -145,12 +145,12 @@ import java.util.concurrent.LinkedBlockingQueue;
...
@@ -145,12 +145,12 @@ import java.util.concurrent.LinkedBlockingQueue;
currentPresentationTimeUs
+=
currentBitmap
.
frameDurationUs
;
currentPresentationTimeUs
+=
currentBitmap
.
frameDurationUs
;
if
(
framesToQueueForCurrentBitmap
==
0
)
{
if
(
framesToQueueForCurrentBitmap
==
0
)
{
pendingBitmaps
.
remove
();
pendingBitmaps
.
remove
();
s
ignalEndOfOutput
();
maybeS
ignalEndOfOutput
();
}
}
}
}
@WorkerThread
@WorkerThread
private
void
s
ignalEndOfOutput
()
{
private
void
maybeS
ignalEndOfOutput
()
{
if
(
framesToQueueForCurrentBitmap
==
0
if
(
framesToQueueForCurrentBitmap
==
0
&&
pendingBitmaps
.
isEmpty
()
&&
pendingBitmaps
.
isEmpty
()
&&
inputEnded
&&
inputEnded
...
@@ -160,10 +160,7 @@ import java.util.concurrent.LinkedBlockingQueue;
...
@@ -160,10 +160,7 @@ import java.util.concurrent.LinkedBlockingQueue;
}
}
}
}
/**
/** Information to generate all the frames associated with a specific {@link Bitmap}. */
* Value class specifying information to generate all the frames associated with a specific {@link
* Bitmap}.
*/
private
static
final
class
BitmapFrameSequenceInfo
{
private
static
final
class
BitmapFrameSequenceInfo
{
public
final
TextureInfo
textureInfo
;
public
final
TextureInfo
textureInfo
;
public
final
long
frameDurationUs
;
public
final
long
frameDurationUs
;
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/OverlaySettings.java
View file @
3e5ae92b
...
@@ -38,12 +38,13 @@ public final class OverlaySettings {
...
@@ -38,12 +38,13 @@ public final class OverlaySettings {
/** A builder for {@link OverlaySettings} instances. */
/** A builder for {@link OverlaySettings} instances. */
public
static
final
class
Builder
{
public
static
final
class
Builder
{
private
boolean
useHdr
;
private
boolean
useHdr
;
private
float
alpha
=
1
;
private
float
alpha
;
private
float
[]
matrix
;
private
float
[]
matrix
;
private
Pair
<
Float
,
Float
>
anchor
;
private
Pair
<
Float
,
Float
>
anchor
;
/** Creates a new {@link Builder}. */
/** Creates a new {@link Builder}. */
public
Builder
()
{
public
Builder
()
{
alpha
=
1
f
;
matrix
=
GlUtil
.
create4x4IdentityMatrix
();
matrix
=
GlUtil
.
create4x4IdentityMatrix
();
anchor
=
Pair
.
create
(
0
f
,
0
f
);
anchor
=
Pair
.
create
(
0
f
,
0
f
);
}
}
...
@@ -94,18 +95,14 @@ public final class OverlaySettings {
...
@@ -94,18 +95,14 @@ public final class OverlaySettings {
* <p>The coordinates are specified in Normalised Device Coordinates (NDCs). Set to always
* <p>The coordinates are specified in Normalised Device Coordinates (NDCs). Set to always
* return {@code (0,0)} (the center) by default.
* return {@code (0,0)} (the center) by default.
*
*
* @param x
the NDC x-coordinate
.
* @param x
The NDC x-coordinate in the range [-1, 1]
.
* @param y
the NDC y-coordinate
.
* @param y
The NDC y-coordinate in the range [-1, 1]
.
*/
*/
@CanIgnoreReturnValue
@CanIgnoreReturnValue
public
Builder
setAnchor
(
public
Builder
setAnchor
(
@FloatRange
(
from
=
-
1
,
to
=
1
)
float
x
,
@FloatRange
(
from
=
-
1
,
to
=
1
)
float
y
)
{
@FloatRange
(
from
=
-
1
,
to
=
1
)
float
x
,
@FloatRange
(
from
=
-
1
,
to
=
1
)
float
y
)
{
checkArgument
(
checkArgument
(-
1
<=
x
&&
x
<=
1
);
-
1
<=
x
&&
x
<=
1
,
checkArgument
(-
1
<=
y
&&
y
<=
1
);
"x needs to be specified in terms of NDCs which lie in the interval [-1, 1]."
);
checkArgument
(
-
1
<=
y
&&
y
<=
1
,
"y needs to be specified in terms of NDCs which lie in the interval [-1, 1]."
);
this
.
anchor
=
Pair
.
create
(
x
,
y
);
this
.
anchor
=
Pair
.
create
(
x
,
y
);
return
this
;
return
this
;
}
}
...
...
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java
View file @
3e5ae92b
...
@@ -139,7 +139,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
...
@@ -139,7 +139,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
}
}
Log
.
i
(
TAG
,
"Successfully tone mapped."
);
Log
.
i
(
TAG
,
"Successfully tone mapped."
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
)
assertThat
(
averagePixelAbsoluteDifference
)
...
@@ -202,7 +202,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
...
@@ -202,7 +202,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
}
}
Log
.
i
(
TAG
,
"Successfully tone mapped."
);
Log
.
i
(
TAG
,
"Successfully tone mapped."
);
// TODO(b/207848601):
s
witch to using proper tooling for testing against golden data.
// TODO(b/207848601):
S
witch to using proper tooling for testing against golden data.
float
averagePixelAbsoluteDifference
=
float
averagePixelAbsoluteDifference
=
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
getBitmapAveragePixelAbsoluteDifferenceArgb8888
(
expectedBitmap
,
actualBitmap
,
testId
);
assertThat
(
averagePixelAbsoluteDifference
)
assertThat
(
averagePixelAbsoluteDifference
)
...
...
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/mh/ToneMapHdrToSdrUsingOpenGlTest.java
View file @
3e5ae92b
...
@@ -22,7 +22,6 @@ import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSE
...
@@ -22,7 +22,6 @@ import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSE
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
AndroidTestUtil
.
MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
AndroidTestUtil
.
MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
AndroidTestUtil
.
recordTestSkipped
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
AndroidTestUtil
.
recordTestSkipped
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
mh
.
FileUtil
.
assertFileHasColorTransfer
;
import
static
com
.
google
.
android
.
exoplayer2
.
transformer
.
mh
.
FileUtil
.
assertFileHasColorTransfer
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkNotNull
;
import
android.content.Context
;
import
android.content.Context
;
import
android.net.Uri
;
import
android.net.Uri
;
...
@@ -91,10 +90,9 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
...
@@ -91,10 +90,9 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
.
build
()
.
build
()
.
run
(
testId
,
mediaItem
);
.
run
(
testId
,
mediaItem
);
Log
.
i
(
TAG
,
"Tone mapped."
);
assertFileHasColorTransfer
(
exportTestResult
.
filePath
,
C
.
COLOR_TRANSFER_SDR
);
assertFileHasColorTransfer
(
exportTestResult
.
filePath
,
C
.
COLOR_TRANSFER_SDR
);
}
catch
(
TransformationException
exception
)
{
}
catch
(
TransformationException
exception
)
{
Log
.
i
(
TAG
,
checkNotNull
(
exception
.
getCause
()).
toString
()
);
Log
.
e
(
TAG
,
"Error during transformation."
,
exception
);
if
(
exception
.
errorCode
!=
TransformationException
.
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
)
{
if
(
exception
.
errorCode
!=
TransformationException
.
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
)
{
throw
exception
;
throw
exception
;
}
}
...
@@ -142,10 +140,9 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
...
@@ -142,10 +140,9 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
.
build
()
.
build
()
.
run
(
testId
,
mediaItem
);
.
run
(
testId
,
mediaItem
);
Log
.
i
(
TAG
,
"Tone mapped."
);
assertFileHasColorTransfer
(
exportTestResult
.
filePath
,
C
.
COLOR_TRANSFER_SDR
);
assertFileHasColorTransfer
(
exportTestResult
.
filePath
,
C
.
COLOR_TRANSFER_SDR
);
}
catch
(
TransformationException
exception
)
{
}
catch
(
TransformationException
exception
)
{
Log
.
i
(
TAG
,
checkNotNull
(
exception
.
getCause
()).
toString
()
);
Log
.
e
(
TAG
,
"Error during transformation."
,
exception
);
if
(
exception
.
errorCode
!=
TransformationException
.
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
)
{
if
(
exception
.
errorCode
!=
TransformationException
.
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
)
{
throw
exception
;
throw
exception
;
}
}
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/ExoPlayerAssetLoader.java
View file @
3e5ae92b
...
@@ -299,18 +299,18 @@ public final class ExoPlayerAssetLoader implements AssetLoader {
...
@@ -299,18 +299,18 @@ public final class ExoPlayerAssetLoader implements AssetLoader {
if
(
tracks
.
isTypeSelected
(
C
.
TRACK_TYPE_VIDEO
))
{
if
(
tracks
.
isTypeSelected
(
C
.
TRACK_TYPE_VIDEO
))
{
trackCount
++;
trackCount
++;
}
}
if
(
trackCount
==
0
)
{
if
(
trackCount
>
0
)
{
assetLoaderListener
.
onTrackCount
(
trackCount
);
// Start the renderers after having registered all the tracks to make sure the AssetLoader
// listener callbacks are called in the right order.
player
.
play
();
}
else
{
assetLoaderListener
.
onError
(
assetLoaderListener
.
onError
(
TransformationException
.
createForAssetLoader
(
TransformationException
.
createForAssetLoader
(
new
IllegalStateException
(
"The asset loader has no track to output."
),
new
IllegalStateException
(
"The asset loader has no track to output."
),
ERROR_CODE_FAILED_RUNTIME_CHECK
));
ERROR_CODE_FAILED_RUNTIME_CHECK
));
return
;
}
else
{
assetLoaderListener
.
onTrackCount
(
trackCount
);
}
}
// Start the renderers after having registered all the tracks to make sure the AssetLoader
// listener callbacks are called in the right order.
player
.
play
();
}
}
@Override
@Override
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java
View file @
3e5ae92b
...
@@ -399,7 +399,7 @@ public final class Transformer {
...
@@ -399,7 +399,7 @@ public final class Transformer {
* <li>Duration will match duration of the input media.
* <li>Duration will match duration of the input media.
* <li>Sample mime type will match {@link TransformationRequest#audioMimeType}, or {@link
* <li>Sample mime type will match {@link TransformationRequest#audioMimeType}, or {@link
* MimeTypes#AUDIO_AAC} if {@code null}.
* MimeTypes#AUDIO_AAC} if {@code null}.
* <li>Sample rate will be {@code 44100}
h
z. This can be modified by creating a {@link
* <li>Sample rate will be {@code 44100}
H
z. This can be modified by creating a {@link
* SonicAudioProcessor}, setting its {@linkplain
* SonicAudioProcessor}, setting its {@linkplain
* SonicAudioProcessor#setOutputSampleRateHz(int) sample rate}, and passing it to the
* SonicAudioProcessor#setOutputSampleRateHz(int) sample rate}, and passing it to the
* {@link EditedMediaItem} used to start the export.
* {@link EditedMediaItem} used to start the export.
...
@@ -422,8 +422,8 @@ public final class Transformer {
...
@@ -422,8 +422,8 @@ public final class Transformer {
*
*
* @throws IllegalStateException If both audio and video have been removed (otherwise the output
* @throws IllegalStateException If both audio and video have been removed (otherwise the output
* would not contain any samples).
* would not contain any samples).
* @throws IllegalStateException If the muxer doesn't support the requested audio
MIME type.
* @throws IllegalStateException If the muxer doesn't support the requested audio
/video MIME
*
@throws IllegalStateException If the muxer doesn't support the requested video MIME
type.
*
type.
*/
*/
public
Transformer
build
()
{
public
Transformer
build
()
{
if
(
transformationRequest
.
audioMimeType
!=
null
)
{
if
(
transformationRequest
.
audioMimeType
!=
null
)
{
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoSamplePipeline.java
View file @
3e5ae92b
...
@@ -55,6 +55,9 @@ import org.checkerframework.dataflow.qual.Pure;
...
@@ -55,6 +55,9 @@ import org.checkerframework.dataflow.qual.Pure;
/** Pipeline to process, re-encode and mux raw video frames. */
/** Pipeline to process, re-encode and mux raw video frames. */
/* package */
final
class
VideoSamplePipeline
extends
SamplePipeline
{
/* package */
final
class
VideoSamplePipeline
extends
SamplePipeline
{
/** MIME type to use for output video if the input type is not a video. */
private
static
final
String
DEFAULT_OUTPUT_MIME_TYPE
=
MimeTypes
.
VIDEO_H265
;
private
final
FrameProcessor
frameProcessor
;
private
final
FrameProcessor
frameProcessor
;
private
final
ColorInfo
frameProcessorInputColor
;
private
final
ColorInfo
frameProcessorInputColor
;
private
final
FrameInfo
firstFrameInfo
;
private
final
FrameInfo
firstFrameInfo
;
...
@@ -364,7 +367,7 @@ import org.checkerframework.dataflow.qual.Pure;
...
@@ -364,7 +367,7 @@ import org.checkerframework.dataflow.qual.Pure;
if
(
transformationRequest
.
videoMimeType
!=
null
)
{
if
(
transformationRequest
.
videoMimeType
!=
null
)
{
requestedOutputMimeType
=
transformationRequest
.
videoMimeType
;
requestedOutputMimeType
=
transformationRequest
.
videoMimeType
;
}
else
if
(
MimeTypes
.
isImage
(
inputSampleMimeType
))
{
}
else
if
(
MimeTypes
.
isImage
(
inputSampleMimeType
))
{
requestedOutputMimeType
=
MimeTypes
.
VIDEO_H265
;
requestedOutputMimeType
=
DEFAULT_OUTPUT_MIME_TYPE
;
}
else
{
}
else
{
requestedOutputMimeType
=
inputSampleMimeType
;
requestedOutputMimeType
=
inputSampleMimeType
;
}
}
...
...
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/EncoderUtilTest.java
View file @
3e5ae92b
...
@@ -84,7 +84,8 @@ public class EncoderUtilTest {
...
@@ -84,7 +84,8 @@ public class EncoderUtilTest {
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
1920
,
1080
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
/* width= */
1920
,
/* height= */
1080
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
...
@@ -98,7 +99,8 @@ public class EncoderUtilTest {
...
@@ -98,7 +99,8 @@ public class EncoderUtilTest {
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
1919
,
1081
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
/* width= */
1919
,
/* height= */
1081
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
...
@@ -113,7 +115,8 @@ public class EncoderUtilTest {
...
@@ -113,7 +115,8 @@ public class EncoderUtilTest {
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
1920
,
1920
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
/* width= */
1920
,
/* height= */
1920
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1440
);
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1440
);
...
@@ -127,7 +130,8 @@ public class EncoderUtilTest {
...
@@ -127,7 +130,8 @@ public class EncoderUtilTest {
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
2880
,
1620
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
/* width= */
2880
,
/* height= */
1620
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
...
@@ -141,7 +145,8 @@ public class EncoderUtilTest {
...
@@ -141,7 +145,8 @@ public class EncoderUtilTest {
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
2160
,
3840
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
/* width= */
2160
,
/* height= */
3840
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1080
);
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1080
);
...
@@ -155,7 +160,8 @@ public class EncoderUtilTest {
...
@@ -155,7 +160,8 @@ public class EncoderUtilTest {
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
7680
,
4320
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
/* width= */
7680
,
/* height= */
4320
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
...
@@ -167,16 +173,15 @@ public class EncoderUtilTest {
...
@@ -167,16 +173,15 @@ public class EncoderUtilTest {
ImmutableList
<
MediaCodecInfo
>
supportedEncoders
=
EncoderUtil
.
getSupportedEncoders
(
VIDEO_H264
);
ImmutableList
<
MediaCodecInfo
>
supportedEncoders
=
EncoderUtil
.
getSupportedEncoders
(
VIDEO_H264
);
MediaCodecInfo
encoderInfo
=
supportedEncoders
.
get
(
0
);
MediaCodecInfo
encoderInfo
=
supportedEncoders
.
get
(
0
);
double
aspectRatio
=
1.5
;
@Nullable
@Nullable
Size
closestSupportedResolution
=
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
VIDEO_H264
,
(
int
)
(
aspectRatio
*
5000
),
5000
);
encoderInfo
,
VIDEO_H264
,
/* width= */
7500
,
/* height= */
5000
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
assertThat
(
(
double
)
closestSupportedResolution
.
getWidth
()
/
closestSupportedResolution
.
getHeight
())
(
double
)
closestSupportedResolution
.
getWidth
()
/
closestSupportedResolution
.
getHeight
())
.
isEqualTo
(
aspectRatio
);
.
isEqualTo
(
7500.0
/
5000
);
}
}
/**
/**
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/DecodeOneFrameUtil.java
View file @
3e5ae92b
...
@@ -38,7 +38,7 @@ import java.nio.ByteBuffer;
...
@@ -38,7 +38,7 @@ import java.nio.ByteBuffer;
import
org.checkerframework.checker.nullness.qual.Nullable
;
import
org.checkerframework.checker.nullness.qual.Nullable
;
/** Utilities for decoding a frame for tests. */
/** Utilities for decoding a frame for tests. */
public
class
DecodeOneFrameUtil
{
public
final
class
DecodeOneFrameUtil
{
public
static
final
String
NO_DECODER_SUPPORT_ERROR_STRING
=
public
static
final
String
NO_DECODER_SUPPORT_ERROR_STRING
=
"No MediaCodec decoders on this device support this value."
;
"No MediaCodec decoders on this device support this value."
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment