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
84afad07
authored
Oct 19, 2017
by
Drew Hill
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
adjustments
parent
feff4d3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseTimeHelper.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseTimeHelper.java
View file @
84afad07
...
@@ -44,10 +44,10 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -44,10 +44,10 @@ public final class VideoFrameReleaseTimeHelper {
private
DisplayManager
.
DisplayListener
displayListener
=
null
;
private
DisplayManager
.
DisplayListener
displayListener
=
null
;
private
Context
context
=
null
;
private
Context
context
=
null
;
private
VSyncSampler
vsyncSampler
;
private
VSyncSampler
vsyncSampler
=
null
;
private
boolean
useDefaultDisplayVsync
;
private
final
boolean
useDefaultDisplayVsync
;
private
long
vsyncDurationNs
;
private
long
vsyncDurationNs
=
-
1
;
// Value unused.
private
long
vsyncOffsetNs
;
private
long
vsyncOffsetNs
=
-
1
;
// Value unused.
private
long
lastFramePresentationTimeUs
;
private
long
lastFramePresentationTimeUs
;
private
long
adjustedLastFrameTimeNs
;
private
long
adjustedLastFrameTimeNs
;
...
@@ -75,11 +75,10 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -75,11 +75,10 @@ public final class VideoFrameReleaseTimeHelper {
public
VideoFrameReleaseTimeHelper
(
Context
context
)
{
public
VideoFrameReleaseTimeHelper
(
Context
context
)
{
this
(
getDefaultDisplayRefreshRate
(
context
));
this
(
getDefaultDisplayRefreshRate
(
context
));
this
.
context
=
context
.
getApplicationContext
();
this
.
context
=
context
.
getApplicationContext
();
registerDisplayListener
();
}
}
private
VideoFrameReleaseTimeHelper
(
double
defaultDisplayRefreshRate
)
{
private
VideoFrameReleaseTimeHelper
(
double
defaultDisplayRefreshRate
)
{
setSync
(
defaultDisplayRefreshRate
)
;
useDefaultDisplayVsync
=
defaultDisplayRefreshRate
!=
DISPLAY_REFRESH_RATE_UNKNOWN
;
}
}
/**
/**
...
@@ -100,8 +99,8 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -100,8 +99,8 @@ public final class VideoFrameReleaseTimeHelper {
public
void
disable
()
{
public
void
disable
()
{
if
(
useDefaultDisplayVsync
)
{
if
(
useDefaultDisplayVsync
)
{
vsyncSampler
.
removeObserver
();
vsyncSampler
.
removeObserver
();
unregisterDisplayListener
();
}
}
unregisterDisplayListener
();
}
}
private
void
registerDisplayListener
()
{
private
void
registerDisplayListener
()
{
...
@@ -128,15 +127,10 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -128,15 +127,10 @@ public final class VideoFrameReleaseTimeHelper {
private
void
setSync
(
double
defaultDisplayRefreshRate
)
{
private
void
setSync
(
double
defaultDisplayRefreshRate
)
{
useDefaultDisplayVsync
=
defaultDisplayRefreshRate
!=
DISPLAY_REFRESH_RATE_UNKNOWN
;
if
(
useDefaultDisplayVsync
)
{
if
(
useDefaultDisplayVsync
)
{
vsyncSampler
=
VSyncSampler
.
getInstance
();
vsyncSampler
=
VSyncSampler
.
getInstance
();
vsyncDurationNs
=
(
long
)
(
C
.
NANOS_PER_SECOND
/
defaultDisplayRefreshRate
);
vsyncDurationNs
=
(
long
)
(
C
.
NANOS_PER_SECOND
/
defaultDisplayRefreshRate
);
vsyncOffsetNs
=
(
vsyncDurationNs
*
VSYNC_OFFSET_PERCENTAGE
)
/
100
;
vsyncOffsetNs
=
(
vsyncDurationNs
*
VSYNC_OFFSET_PERCENTAGE
)
/
100
;
}
else
{
vsyncSampler
=
null
;
vsyncDurationNs
=
-
1
;
// Value unused.
vsyncOffsetNs
=
-
1
;
// Value unused.
}
}
}
}
...
...
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