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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
36 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;
eglContext
,
singleThreadExecutorService
,
inputExternalTexId
,
externalCopyFrameProcessor
,
framebuffers
,
ImmutableList
.
copyOf
(
frameProcessors
),
new
ImmutableList
.
Builder
<
GlFrameProcessor
>()
.
add
(
externalCopyFrameProcessor
)
.
addAll
(
frameProcessors
)
.
build
(),
enableExperimentalHdrEditing
);
}
...
...
@@ -196,14 +198,15 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** Transformation matrix associated with the {@link #inputSurfaceTexture}. */
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
;
/**
* 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
* GlFrameProcessor}.
*
* <p>The {@link ExternalCopyFrameProcessor} writes to the first framebuffer.
*/
private
final
int
[]
framebuffers
;
...
...
@@ -231,15 +234,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
EGLContext
eglContext
,
ExecutorService
singleThreadExecutorService
,
int
inputExternalTexId
,
ExternalCopyFrameProcessor
externalCopyFrameProcessor
,
int
[]
framebuffers
,
ImmutableList
<
GlFrameProcessor
>
frameProcessors
,
boolean
enableExperimentalHdrEditing
)
{
checkState
(!
frameProcessors
.
isEmpty
());
this
.
eglDisplay
=
eglDisplay
;
this
.
eglContext
=
eglContext
;
this
.
singleThreadExecutorService
=
singleThreadExecutorService
;
this
.
externalCopyFrameProcessor
=
externalCopyFrameProcessor
;
this
.
framebuffers
=
framebuffers
;
this
.
frameProcessors
=
frameProcessors
;
this
.
enableExperimentalHdrEditing
=
enableExperimentalHdrEditing
;
...
...
@@ -249,10 +251,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
inputSurfaceTexture
=
new
SurfaceTexture
(
inputExternalTexId
);
inputSurface
=
new
Surface
(
inputSurfaceTexture
);
textureTransformMatrix
=
new
float
[
16
];
outputSize
=
frameProcessors
.
isEmpty
()
?
externalCopyFrameProcessor
.
getOutputSize
()
:
getLast
(
frameProcessors
).
getOutputSize
();
outputSize
=
getLast
(
frameProcessors
).
getOutputSize
();
debugPreviewWidth
=
C
.
LENGTH_UNSET
;
debugPreviewHeight
=
C
.
LENGTH_UNSET
;
}
...
...
@@ -379,7 +378,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
futures
.
add
(
singleThreadExecutorService
.
submit
(
()
->
{
externalCopyFrameProcessor
.
release
();
for
(
int
i
=
0
;
i
<
frameProcessors
.
size
();
i
++)
{
frameProcessors
.
get
(
i
).
release
();
}
...
...
@@ -429,26 +427,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
checkState
(
Thread
.
currentThread
().
getName
().
equals
(
THREAD_NAME
));
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
.
getTransformMatrix
(
textureTransformMatrix
);
externalCopyFrameProcessor
.
setTextureTransformMatrix
(
textureTransformMatrix
);
long
presentationTimeNs
=
inputSurfaceTexture
.
getTimestamp
();
long
presentationTimeUs
=
presentationTimeNs
/
1000
;
clearOutputFrame
();
externalCopyFrameProcessor
.
updateProgramAndDraw
(
presentationTimeUs
);
inputSurfaceTexture
.
getTransformMatrix
(
textureTransformMatrix
);
((
ExternalCopyFrameProcessor
)
frameProcessors
.
get
(
0
))
.
setTextureTransformMatrix
(
textureTransformMatrix
);
for
(
int
i
=
0
;
i
<
frameProcessors
.
size
()
-
1
;
i
++)
{
Size
intermediateSize
=
frameProcessors
.
get
(
i
).
getOutputSize
();
...
...
@@ -456,18 +440,16 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
eglDisplay
,
eglContext
,
eglSurface
,
framebuffers
[
i
+
1
],
framebuffers
[
i
],
intermediateSize
.
getWidth
(),
intermediateSize
.
getHeight
());
clearOutputFrame
();
frameProcessors
.
get
(
i
).
updateProgramAndDraw
(
presentationTimeUs
);
}
if
(!
frameProcessors
.
isEmpty
())
{
GlUtil
.
focusEglSurface
(
eglDisplay
,
eglContext
,
eglSurface
,
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
clearOutputFrame
();
getLast
(
frameProcessors
).
updateProgramAndDraw
(
presentationTimeUs
);
}
GlUtil
.
focusEglSurface
(
eglDisplay
,
eglContext
,
eglSurface
,
outputSize
.
getWidth
(),
outputSize
.
getHeight
());
clearOutputFrame
();
getLast
(
frameProcessors
).
updateProgramAndDraw
(
presentationTimeUs
);
EGLExt
.
eglPresentationTimeANDROID
(
eglDisplay
,
eglSurface
,
presentationTimeNs
);
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