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
d3931d8b
authored
Apr 01, 2022
by
hschlueter
Committed by
Ian Baker
Apr 06, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add ExternalCopyFrameProcessor to frameProcessors list.
PiperOrigin-RevId: 438847583
parent
2a66c7b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
32 deletions
libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java
libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java
View file @
d3931d8b
...
@@ -171,9 +171,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -171,9 +171,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
eglContext
,
eglContext
,
singleThreadExecutorService
,
singleThreadExecutorService
,
inputExternalTexId
,
inputExternalTexId
,
externalCopyFrameProcessor
,
framebuffers
,
framebuffers
,
ImmutableList
.
copyOf
(
frameProcessors
),
new
ImmutableList
.
Builder
<
GlFrameProcessor
>()
.
add
(
externalCopyFrameProcessor
)
.
addAll
(
frameProcessors
)
.
build
(),
enableExperimentalHdrEditing
);
enableExperimentalHdrEditing
);
}
}
...
@@ -196,14 +198,15 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -196,14 +198,15 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** Transformation matrix associated with the {@link #inputSurfaceTexture}. */
/** Transformation matrix associated with the {@link #inputSurfaceTexture}. */
private
final
float
[]
textureTransformMatrix
;
private
final
float
[]
textureTransformMatrix
;
private
final
ExternalCopyFrameProcessor
externalCopyFrameProcessor
;
/**
* Contains an {@link ExternalCopyFrameProcessor} at the 0th index and optionally other {@link
* GlFrameProcessor GlFrameProcessors} at indices >= 1.
*/
private
final
ImmutableList
<
GlFrameProcessor
>
frameProcessors
;
private
final
ImmutableList
<
GlFrameProcessor
>
frameProcessors
;
/**
/**
* Identifiers of a framebuffer object associated with the intermediate textures that receive
* Identifiers of a framebuffer object associated with the intermediate textures that receive
* output from the previous {@link GlFrameProcessor}, and provide input for the following {@link
* output from the previous {@link GlFrameProcessor}, and provide input for the following {@link
* GlFrameProcessor}.
* GlFrameProcessor}.
*
* <p>The {@link ExternalCopyFrameProcessor} writes to the first framebuffer.
*/
*/
private
final
int
[]
framebuffers
;
private
final
int
[]
framebuffers
;
...
@@ -231,15 +234,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -231,15 +234,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
EGLContext
eglContext
,
EGLContext
eglContext
,
ExecutorService
singleThreadExecutorService
,
ExecutorService
singleThreadExecutorService
,
int
inputExternalTexId
,
int
inputExternalTexId
,
ExternalCopyFrameProcessor
externalCopyFrameProcessor
,
int
[]
framebuffers
,
int
[]
framebuffers
,
ImmutableList
<
GlFrameProcessor
>
frameProcessors
,
ImmutableList
<
GlFrameProcessor
>
frameProcessors
,
boolean
enableExperimentalHdrEditing
)
{
boolean
enableExperimentalHdrEditing
)
{
checkState
(!
frameProcessors
.
isEmpty
());
this
.
eglDisplay
=
eglDisplay
;
this
.
eglDisplay
=
eglDisplay
;
this
.
eglContext
=
eglContext
;
this
.
eglContext
=
eglContext
;
this
.
singleThreadExecutorService
=
singleThreadExecutorService
;
this
.
singleThreadExecutorService
=
singleThreadExecutorService
;
this
.
externalCopyFrameProcessor
=
externalCopyFrameProcessor
;
this
.
framebuffers
=
framebuffers
;
this
.
framebuffers
=
framebuffers
;
this
.
frameProcessors
=
frameProcessors
;
this
.
frameProcessors
=
frameProcessors
;
this
.
enableExperimentalHdrEditing
=
enableExperimentalHdrEditing
;
this
.
enableExperimentalHdrEditing
=
enableExperimentalHdrEditing
;
...
@@ -249,10 +251,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -249,10 +251,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
inputSurfaceTexture
=
new
SurfaceTexture
(
inputExternalTexId
);
inputSurfaceTexture
=
new
SurfaceTexture
(
inputExternalTexId
);
inputSurface
=
new
Surface
(
inputSurfaceTexture
);
inputSurface
=
new
Surface
(
inputSurfaceTexture
);
textureTransformMatrix
=
new
float
[
16
];
textureTransformMatrix
=
new
float
[
16
];
outputSize
=
outputSize
=
getLast
(
frameProcessors
).
getOutputSize
();
frameProcessors
.
isEmpty
()
?
externalCopyFrameProcessor
.
getOutputSize
()
:
getLast
(
frameProcessors
).
getOutputSize
();
debugPreviewWidth
=
C
.
LENGTH_UNSET
;
debugPreviewWidth
=
C
.
LENGTH_UNSET
;
debugPreviewHeight
=
C
.
LENGTH_UNSET
;
debugPreviewHeight
=
C
.
LENGTH_UNSET
;
}
}
...
@@ -379,7 +378,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -379,7 +378,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
futures
.
add
(
futures
.
add
(
singleThreadExecutorService
.
submit
(
singleThreadExecutorService
.
submit
(
()
->
{
()
->
{
externalCopyFrameProcessor
.
release
();
for
(
int
i
=
0
;
i
<
frameProcessors
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
frameProcessors
.
size
();
i
++)
{
frameProcessors
.
get
(
i
).
release
();
frameProcessors
.
get
(
i
).
release
();
}
}
...
@@ -429,26 +427,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -429,26 +427,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
checkState
(
Thread
.
currentThread
().
getName
().
equals
(
THREAD_NAME
));
checkState
(
Thread
.
currentThread
().
getName
().
equals
(
THREAD_NAME
));
checkStateNotNull
(
eglSurface
,
"No output surface set."
);
checkStateNotNull
(
eglSurface
,
"No output surface set."
);
if
(
frameProcessors
.
isEmpty
())
{
GlUtil
.
focusEglSurface
(
eglDisplay
,
eglContext
,
eglSurface
,
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
}
else
{
Size
intermediateSize
=
externalCopyFrameProcessor
.
getOutputSize
();
GlUtil
.
focusFramebuffer
(
eglDisplay
,
eglContext
,
eglSurface
,
framebuffers
[
0
],
intermediateSize
.
getWidth
(),
intermediateSize
.
getHeight
());
}
inputSurfaceTexture
.
updateTexImage
();
inputSurfaceTexture
.
updateTexImage
();
inputSurfaceTexture
.
getTransformMatrix
(
textureTransformMatrix
);
externalCopyFrameProcessor
.
setTextureTransformMatrix
(
textureTransformMatrix
);
long
presentationTimeNs
=
inputSurfaceTexture
.
getTimestamp
();
long
presentationTimeNs
=
inputSurfaceTexture
.
getTimestamp
();
long
presentationTimeUs
=
presentationTimeNs
/
1000
;
long
presentationTimeUs
=
presentationTimeNs
/
1000
;
clearOutputFrame
();
inputSurfaceTexture
.
getTransformMatrix
(
textureTransformMatrix
);
externalCopyFrameProcessor
.
updateProgramAndDraw
(
presentationTimeUs
);
((
ExternalCopyFrameProcessor
)
frameProcessors
.
get
(
0
))
.
setTextureTransformMatrix
(
textureTransformMatrix
);
for
(
int
i
=
0
;
i
<
frameProcessors
.
size
()
-
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
frameProcessors
.
size
()
-
1
;
i
++)
{
Size
intermediateSize
=
frameProcessors
.
get
(
i
).
getOutputSize
();
Size
intermediateSize
=
frameProcessors
.
get
(
i
).
getOutputSize
();
...
@@ -456,18 +440,16 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -456,18 +440,16 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
eglDisplay
,
eglDisplay
,
eglContext
,
eglContext
,
eglSurface
,
eglSurface
,
framebuffers
[
i
+
1
],
framebuffers
[
i
],
intermediateSize
.
getWidth
(),
intermediateSize
.
getWidth
(),
intermediateSize
.
getHeight
());
intermediateSize
.
getHeight
());
clearOutputFrame
();
clearOutputFrame
();
frameProcessors
.
get
(
i
).
updateProgramAndDraw
(
presentationTimeUs
);
frameProcessors
.
get
(
i
).
updateProgramAndDraw
(
presentationTimeUs
);
}
}
if
(!
frameProcessors
.
isEmpty
())
{
GlUtil
.
focusEglSurface
(
GlUtil
.
focusEglSurface
(
eglDisplay
,
eglContext
,
eglSurface
,
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
eglDisplay
,
eglContext
,
eglSurface
,
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
clearOutputFrame
();
clearOutputFrame
();
getLast
(
frameProcessors
).
updateProgramAndDraw
(
presentationTimeUs
);
getLast
(
frameProcessors
).
updateProgramAndDraw
(
presentationTimeUs
);
}
EGLExt
.
eglPresentationTimeANDROID
(
eglDisplay
,
eglSurface
,
presentationTimeNs
);
EGLExt
.
eglPresentationTimeANDROID
(
eglDisplay
,
eglSurface
,
presentationTimeNs
);
EGL14
.
eglSwapBuffers
(
eglDisplay
,
eglSurface
);
EGL14
.
eglSwapBuffers
(
eglDisplay
,
eglSurface
);
...
...
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