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
0f5c30d3
authored
Jun 13, 2017
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Misc cleanup
parent
c6dfccf3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseTimeHelper.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/DebugTextViewHelper.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseTimeHelper.java
View file @
0f5c30d3
...
@@ -31,6 +31,7 @@ import com.google.android.exoplayer2.C;
...
@@ -31,6 +31,7 @@ import com.google.android.exoplayer2.C;
@TargetApi
(
16
)
@TargetApi
(
16
)
public
final
class
VideoFrameReleaseTimeHelper
{
public
final
class
VideoFrameReleaseTimeHelper
{
private
static
final
double
DISPLAY_REFRESH_RATE_UNKNOWN
=
-
1
;
private
static
final
long
CHOREOGRAPHER_SAMPLE_DELAY_MILLIS
=
500
;
private
static
final
long
CHOREOGRAPHER_SAMPLE_DELAY_MILLIS
=
500
;
private
static
final
long
MAX_ALLOWED_DRIFT_NS
=
20000000
;
private
static
final
long
MAX_ALLOWED_DRIFT_NS
=
20000000
;
...
@@ -52,11 +53,11 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -52,11 +53,11 @@ public final class VideoFrameReleaseTimeHelper {
private
long
frameCount
;
private
long
frameCount
;
/**
/**
* Constructs an instance that smooth
e
s frame release timestamps but does not align them with
* Constructs an instance that smooths frame release timestamps but does not align them with
* the default display's vsync signal.
* the default display's vsync signal.
*/
*/
public
VideoFrameReleaseTimeHelper
()
{
public
VideoFrameReleaseTimeHelper
()
{
this
(
-
1
/* Value unused */
,
false
);
this
(
DISPLAY_REFRESH_RATE_UNKNOWN
);
}
}
/**
/**
...
@@ -66,13 +67,12 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -66,13 +67,12 @@ public final class VideoFrameReleaseTimeHelper {
* @param context A context from which information about the default display can be retrieved.
* @param context A context from which information about the default display can be retrieved.
*/
*/
public
VideoFrameReleaseTimeHelper
(
Context
context
)
{
public
VideoFrameReleaseTimeHelper
(
Context
context
)
{
this
(
getDefaultDisplayRefreshRate
(
context
)
,
true
);
this
(
getDefaultDisplayRefreshRate
(
context
));
}
}
private
VideoFrameReleaseTimeHelper
(
double
defaultDisplayRefreshRate
,
private
VideoFrameReleaseTimeHelper
(
double
defaultDisplayRefreshRate
)
{
boolean
useDefaultDisplayVsync
)
{
useDefaultDisplayVsync
=
defaultDisplayRefreshRate
!=
DISPLAY_REFRESH_RATE_UNKNOWN
;
this
.
useDefaultDisplayVsync
=
useDefaultDisplayVsync
;
if
(
useDefaultDisplayVsync
)
{
if
(
useDefaultDisplayVsync
&&
defaultDisplayRefreshRate
>
0
f
)
{
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
;
...
@@ -200,9 +200,10 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -200,9 +200,10 @@ public final class VideoFrameReleaseTimeHelper {
return
snappedAfterDiff
<
snappedBeforeDiff
?
snappedAfterNs
:
snappedBeforeNs
;
return
snappedAfterDiff
<
snappedBeforeDiff
?
snappedAfterNs
:
snappedBeforeNs
;
}
}
private
static
float
getDefaultDisplayRefreshRate
(
Context
context
)
{
private
static
double
getDefaultDisplayRefreshRate
(
Context
context
)
{
WindowManager
manager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
manager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
return
manager
.
getDefaultDisplay
()
!=
null
?
manager
.
getDefaultDisplay
().
getRefreshRate
()
:
0
f
;
return
manager
.
getDefaultDisplay
()
!=
null
?
manager
.
getDefaultDisplay
().
getRefreshRate
()
:
DISPLAY_REFRESH_RATE_UNKNOWN
;
}
}
/**
/**
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/DebugTextViewHelper.java
View file @
0f5c30d3
...
@@ -163,14 +163,8 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
...
@@ -163,14 +163,8 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
if
(
format
==
null
)
{
if
(
format
==
null
)
{
return
""
;
return
""
;
}
}
float
par
=
format
.
pixelWidthHeightRatio
;
String
parInfo
=
""
;
if
(
par
!=
Format
.
NO_VALUE
&&
(
int
)
par
!=
1
)
{
// Add pixel aspect ratio only when it's useful
parInfo
=
" par:"
+
format
.
pixelWidthHeightRatio
;
}
return
"\n"
+
format
.
sampleMimeType
+
"(id:"
+
format
.
id
+
" r:"
+
format
.
width
+
"x"
return
"\n"
+
format
.
sampleMimeType
+
"(id:"
+
format
.
id
+
" r:"
+
format
.
width
+
"x"
+
format
.
height
+
parInfo
+
format
.
height
+
getPixelAspectRatioString
(
format
.
pixelWidthHeightRatio
)
+
getDecoderCountersBufferCountString
(
player
.
getVideoDecoderCounters
())
+
")"
;
+
getDecoderCountersBufferCountString
(
player
.
getVideoDecoderCounters
())
+
")"
;
}
}
...
@@ -195,4 +189,9 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
...
@@ -195,4 +189,9 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
+
" mcdb:"
+
counters
.
maxConsecutiveDroppedOutputBufferCount
;
+
" mcdb:"
+
counters
.
maxConsecutiveDroppedOutputBufferCount
;
}
}
private
static
String
getPixelAspectRatioString
(
float
pixelAspectRatio
)
{
return
pixelAspectRatio
==
Format
.
NO_VALUE
||
pixelAspectRatio
==
1
f
?
""
:
(
" par:"
+
String
.
format
(
"%.02f"
,
pixelAspectRatio
));
}
}
}
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