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
ce7c04fa
authored
Aug 02, 2021
by
olly
Committed by
Oliver Woodman
Aug 02, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Move setFrameRate calls into wrapper class
PiperOrigin-RevId: 388187294
parent
18183816
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseHelper.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseHelper.java
View file @
ce7c04fa
...
@@ -27,6 +27,7 @@ import android.view.Choreographer.FrameCallback;
...
@@ -27,6 +27,7 @@ import android.view.Choreographer.FrameCallback;
import
android.view.Display
;
import
android.view.Display
;
import
android.view.Surface
;
import
android.view.Surface
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
androidx.annotation.DoNotInline
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
...
@@ -346,7 +347,7 @@ public final class VideoFrameReleaseHelper {
...
@@ -346,7 +347,7 @@ public final class VideoFrameReleaseHelper {
return
;
return
;
}
}
this
.
surfacePlaybackFrameRate
=
surfacePlaybackFrameRate
;
this
.
surfacePlaybackFrameRate
=
surfacePlaybackFrameRate
;
setSurfaceFrameRateV30
(
surface
,
surfacePlaybackFrameRate
);
SurfaceApi30
.
setFrameRate
(
surface
,
surfacePlaybackFrameRate
);
}
}
/** Clears the frame-rate of the current {@link #surface}. */
/** Clears the frame-rate of the current {@link #surface}. */
...
@@ -355,20 +356,7 @@ public final class VideoFrameReleaseHelper {
...
@@ -355,20 +356,7 @@ public final class VideoFrameReleaseHelper {
return
;
return
;
}
}
surfacePlaybackFrameRate
=
0
;
surfacePlaybackFrameRate
=
0
;
setSurfaceFrameRateV30
(
surface
,
/* frameRate= */
0
);
SurfaceApi30
.
setFrameRate
(
surface
,
/* frameRate= */
0
);
}
@RequiresApi
(
30
)
private
static
void
setSurfaceFrameRateV30
(
Surface
surface
,
float
frameRate
)
{
int
compatibility
=
frameRate
==
0
?
Surface
.
FRAME_RATE_COMPATIBILITY_DEFAULT
:
Surface
.
FRAME_RATE_COMPATIBILITY_FIXED_SOURCE
;
try
{
surface
.
setFrameRate
(
frameRate
,
compatibility
);
}
catch
(
IllegalStateException
e
)
{
Log
.
e
(
TAG
,
"Failed to call Surface.setFrameRate"
,
e
);
}
}
}
// Display refresh rate and vsync logic.
// Display refresh rate and vsync logic.
...
@@ -417,6 +405,24 @@ public final class VideoFrameReleaseHelper {
...
@@ -417,6 +405,24 @@ public final class VideoFrameReleaseHelper {
return
displayHelper
;
return
displayHelper
;
}
}
// Nested classes.
@RequiresApi
(
30
)
private
static
final
class
SurfaceApi30
{
@DoNotInline
public
static
void
setFrameRate
(
Surface
surface
,
float
frameRate
)
{
int
compatibility
=
frameRate
==
0
?
Surface
.
FRAME_RATE_COMPATIBILITY_DEFAULT
:
Surface
.
FRAME_RATE_COMPATIBILITY_FIXED_SOURCE
;
try
{
surface
.
setFrameRate
(
frameRate
,
compatibility
);
}
catch
(
IllegalStateException
e
)
{
Log
.
e
(
TAG
,
"Failed to call Surface.setFrameRate"
,
e
);
}
}
}
/** Helper for listening to changes to the default display. */
/** Helper for listening to changes to the default display. */
private
interface
DisplayHelper
{
private
interface
DisplayHelper
{
...
...
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