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
c74b16e9
authored
Mar 17, 2022
by
hschlueter
Committed by
Ian Baker
Mar 17, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add missing exception checks after EGL14 calls in GlUtil.
PiperOrigin-RevId: 435308470
parent
b2b27dc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
libraries/common/src/main/java/androidx/media3/common/util/GlUtil.java
libraries/common/src/main/java/androidx/media3/common/util/GlUtil.java
View file @
c74b16e9
...
...
@@ -414,6 +414,11 @@ public final class GlUtil {
}
}
private
static
void
checkEglException
(
String
errorMessage
)
{
int
error
=
EGL14
.
eglGetError
();
checkEglException
(
error
==
EGL14
.
EGL_SUCCESS
,
errorMessage
+
", error code: "
+
error
);
}
@RequiresApi
(
17
)
private
static
final
class
Api17
{
private
Api17
()
{}
...
...
@@ -462,12 +467,15 @@ public final class GlUtil {
Object
surface
,
int
[]
configAttributes
,
int
[]
windowSurfaceAttributes
)
{
return
EGL14
.
eglCreateWindowSurface
(
eglDisplay
,
getEglConfig
(
eglDisplay
,
configAttributes
),
surface
,
windowSurfaceAttributes
,
/* offset= */
0
);
EGLSurface
eglSurface
=
EGL14
.
eglCreateWindowSurface
(
eglDisplay
,
getEglConfig
(
eglDisplay
,
configAttributes
),
surface
,
windowSurfaceAttributes
,
/* offset= */
0
);
checkEglException
(
"Error creating surface"
);
return
eglSurface
;
}
@DoNotInline
...
...
@@ -483,8 +491,11 @@ public final class GlUtil {
if
(
boundFramebuffer
[
0
]
!=
framebuffer
)
{
GLES20
.
glBindFramebuffer
(
GLES20
.
GL_FRAMEBUFFER
,
framebuffer
);
}
checkGlError
();
EGL14
.
eglMakeCurrent
(
eglDisplay
,
eglSurface
,
eglSurface
,
eglContext
);
checkEglException
(
"Error making context current"
);
GLES20
.
glViewport
(
/* x= */
0
,
/* y= */
0
,
width
,
height
);
checkGlError
();
}
@DoNotInline
...
...
@@ -495,19 +506,15 @@ public final class GlUtil {
}
EGL14
.
eglMakeCurrent
(
eglDisplay
,
EGL14
.
EGL_NO_SURFACE
,
EGL14
.
EGL_NO_SURFACE
,
EGL14
.
EGL_NO_CONTEXT
);
int
error
=
EGL14
.
eglGetError
();
checkEglException
(
error
==
EGL14
.
EGL_SUCCESS
,
"Error releasing context: "
+
error
);
checkEglException
(
"Error releasing context"
);
if
(
eglContext
!=
null
)
{
EGL14
.
eglDestroyContext
(
eglDisplay
,
eglContext
);
error
=
EGL14
.
eglGetError
();
checkEglException
(
error
==
EGL14
.
EGL_SUCCESS
,
"Error destroying context: "
+
error
);
checkEglException
(
"Error destroying context"
);
}
EGL14
.
eglReleaseThread
();
error
=
EGL14
.
eglGetError
();
checkEglException
(
error
==
EGL14
.
EGL_SUCCESS
,
"Error releasing thread: "
+
error
);
checkEglException
(
"Error releasing thread"
);
EGL14
.
eglTerminate
(
eglDisplay
);
error
=
EGL14
.
eglGetError
();
checkEglException
(
error
==
EGL14
.
EGL_SUCCESS
,
"Error terminating display: "
+
error
);
checkEglException
(
"Error terminating display"
);
}
@DoNotInline
...
...
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