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
1fc32d56
authored
Nov 25, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
check maximum consecutively dropped frames in video tests
parent
ddaa9092
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
0 deletions
library/src/main/java/com/google/android/exoplayer/CodecCounters.java
library/src/main/java/com/google/android/exoplayer/MediaCodecVideoTrackRenderer.java
playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/gts/DashTest.java
playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/util/CodecCountersUtil.java
library/src/main/java/com/google/android/exoplayer/CodecCounters.java
View file @
1fc32d56
...
@@ -31,6 +31,7 @@ public final class CodecCounters {
...
@@ -31,6 +31,7 @@ public final class CodecCounters {
public
int
renderedOutputBufferCount
;
public
int
renderedOutputBufferCount
;
public
int
skippedOutputBufferCount
;
public
int
skippedOutputBufferCount
;
public
int
droppedOutputBufferCount
;
public
int
droppedOutputBufferCount
;
public
int
maxConsecutiveDroppedOutputBufferCount
;
/**
/**
* Should be invoked from the playback thread after the counters have been updated. Should also
* Should be invoked from the playback thread after the counters have been updated. Should also
...
@@ -52,6 +53,7 @@ public final class CodecCounters {
...
@@ -52,6 +53,7 @@ public final class CodecCounters {
builder
.
append
(
" ren:"
).
append
(
renderedOutputBufferCount
);
builder
.
append
(
" ren:"
).
append
(
renderedOutputBufferCount
);
builder
.
append
(
" sob:"
).
append
(
skippedOutputBufferCount
);
builder
.
append
(
" sob:"
).
append
(
skippedOutputBufferCount
);
builder
.
append
(
" dob:"
).
append
(
droppedOutputBufferCount
);
builder
.
append
(
" dob:"
).
append
(
droppedOutputBufferCount
);
builder
.
append
(
" mcdob:"
).
append
(
maxConsecutiveDroppedOutputBufferCount
);
return
builder
.
toString
();
return
builder
.
toString
();
}
}
...
...
library/src/main/java/com/google/android/exoplayer/MediaCodecVideoTrackRenderer.java
View file @
1fc32d56
...
@@ -112,6 +112,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -112,6 +112,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
private
long
joiningDeadlineUs
;
private
long
joiningDeadlineUs
;
private
long
droppedFrameAccumulationStartTimeMs
;
private
long
droppedFrameAccumulationStartTimeMs
;
private
int
droppedFrameCount
;
private
int
droppedFrameCount
;
private
int
consecutiveDroppedFrameCount
;
private
int
pendingRotationDegrees
;
private
int
pendingRotationDegrees
;
private
float
pendingPixelWidthHeightRatio
;
private
float
pendingPixelWidthHeightRatio
;
...
@@ -220,6 +221,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -220,6 +221,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
throws
ExoPlaybackException
{
throws
ExoPlaybackException
{
super
.
onEnabled
(
track
,
positionUs
,
joining
);
super
.
onEnabled
(
track
,
positionUs
,
joining
);
renderedFirstFrame
=
false
;
renderedFirstFrame
=
false
;
consecutiveDroppedFrameCount
=
0
;
if
(
joining
&&
allowedJoiningTimeUs
>
0
)
{
if
(
joining
&&
allowedJoiningTimeUs
>
0
)
{
joiningDeadlineUs
=
SystemClock
.
elapsedRealtime
()
*
1000L
+
allowedJoiningTimeUs
;
joiningDeadlineUs
=
SystemClock
.
elapsedRealtime
()
*
1000L
+
allowedJoiningTimeUs
;
}
}
...
@@ -230,6 +232,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -230,6 +232,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
protected
void
seekTo
(
long
positionUs
)
throws
ExoPlaybackException
{
protected
void
seekTo
(
long
positionUs
)
throws
ExoPlaybackException
{
super
.
seekTo
(
positionUs
);
super
.
seekTo
(
positionUs
);
renderedFirstFrame
=
false
;
renderedFirstFrame
=
false
;
consecutiveDroppedFrameCount
=
0
;
joiningDeadlineUs
=
-
1
;
joiningDeadlineUs
=
-
1
;
}
}
...
@@ -377,6 +380,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -377,6 +380,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
ByteBuffer
buffer
,
MediaCodec
.
BufferInfo
bufferInfo
,
int
bufferIndex
,
boolean
shouldSkip
)
{
ByteBuffer
buffer
,
MediaCodec
.
BufferInfo
bufferInfo
,
int
bufferIndex
,
boolean
shouldSkip
)
{
if
(
shouldSkip
)
{
if
(
shouldSkip
)
{
skipOutputBuffer
(
codec
,
bufferIndex
);
skipOutputBuffer
(
codec
,
bufferIndex
);
consecutiveDroppedFrameCount
=
0
;
return
true
;
return
true
;
}
}
...
@@ -386,6 +390,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -386,6 +390,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
}
else
{
}
else
{
renderOutputBuffer
(
codec
,
bufferIndex
);
renderOutputBuffer
(
codec
,
bufferIndex
);
}
}
consecutiveDroppedFrameCount
=
0
;
return
true
;
return
true
;
}
}
...
@@ -416,6 +421,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -416,6 +421,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
// Let the underlying framework time the release.
// Let the underlying framework time the release.
if
(
earlyUs
<
50000
)
{
if
(
earlyUs
<
50000
)
{
renderOutputBufferV21
(
codec
,
bufferIndex
,
adjustedReleaseTimeNs
);
renderOutputBufferV21
(
codec
,
bufferIndex
,
adjustedReleaseTimeNs
);
consecutiveDroppedFrameCount
=
0
;
return
true
;
return
true
;
}
}
}
else
{
}
else
{
...
@@ -432,6 +438,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -432,6 +438,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
}
}
}
}
renderOutputBuffer
(
codec
,
bufferIndex
);
renderOutputBuffer
(
codec
,
bufferIndex
);
consecutiveDroppedFrameCount
=
0
;
return
true
;
return
true
;
}
}
}
}
...
@@ -453,6 +460,9 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
...
@@ -453,6 +460,9 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
TraceUtil
.
endSection
();
TraceUtil
.
endSection
();
codecCounters
.
droppedOutputBufferCount
++;
codecCounters
.
droppedOutputBufferCount
++;
droppedFrameCount
++;
droppedFrameCount
++;
consecutiveDroppedFrameCount
++;
codecCounters
.
maxConsecutiveDroppedOutputBufferCount
=
Math
.
max
(
consecutiveDroppedFrameCount
,
codecCounters
.
maxConsecutiveDroppedOutputBufferCount
);
if
(
droppedFrameCount
==
maxDroppedFrameCountToNotify
)
{
if
(
droppedFrameCount
==
maxDroppedFrameCountToNotify
)
{
maybeNotifyDroppedFrameCount
();
maybeNotifyDroppedFrameCount
();
}
}
...
...
playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/gts/DashTest.java
View file @
1fc32d56
...
@@ -65,6 +65,7 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
...
@@ -65,6 +65,7 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
private
static
final
long
MAX_PLAYING_TIME_DISCREPANCY_MS
=
2000
;
private
static
final
long
MAX_PLAYING_TIME_DISCREPANCY_MS
=
2000
;
private
static
final
float
MAX_DROPPED_VIDEO_FRAME_FRACTION
=
0.01f
;
private
static
final
float
MAX_DROPPED_VIDEO_FRAME_FRACTION
=
0.01f
;
private
static
final
int
MAX_CONSECUTIVE_DROPPED_VIDEO_FRAMES
=
10
;
private
static
final
long
MAX_ADDITIONAL_TIME_MS
=
180000
;
private
static
final
long
MAX_ADDITIONAL_TIME_MS
=
180000
;
private
static
final
int
MIN_LOADABLE_RETRY_COUNT
=
10
;
private
static
final
int
MIN_LOADABLE_RETRY_COUNT
=
10
;
...
@@ -383,9 +384,13 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
...
@@ -383,9 +384,13 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
}
}
// Assert that the level of performance was acceptable.
// Assert that the level of performance was acceptable.
// Assert that total dropped frames were within limit.
int
droppedFrameLimit
=
(
int
)
Math
.
ceil
(
MAX_DROPPED_VIDEO_FRAME_FRACTION
int
droppedFrameLimit
=
(
int
)
Math
.
ceil
(
MAX_DROPPED_VIDEO_FRAME_FRACTION
*
CodecCountersUtil
.
getTotalOutputBuffers
(
videoCounters
));
*
CodecCountersUtil
.
getTotalOutputBuffers
(
videoCounters
));
CodecCountersUtil
.
assertDroppedOutputBufferLimit
(
VIDEO_TAG
,
videoCounters
,
droppedFrameLimit
);
CodecCountersUtil
.
assertDroppedOutputBufferLimit
(
VIDEO_TAG
,
videoCounters
,
droppedFrameLimit
);
// Assert that consecutive dropped frames were within limit.
CodecCountersUtil
.
assertConsecutiveDroppedOutputBufferLimit
(
VIDEO_TAG
,
videoCounters
,
MAX_CONSECUTIVE_DROPPED_VIDEO_FRAMES
);
}
}
private
static
final
class
TrackSelector
implements
DashTrackSelector
{
private
static
final
class
TrackSelector
implements
DashTrackSelector
{
...
...
playbacktests/src/main/java/com/google/android/exoplayer/playbacktests/util/CodecCountersUtil.java
View file @
1fc32d56
...
@@ -77,4 +77,12 @@ public final class CodecCountersUtil {
...
@@ -77,4 +77,12 @@ public final class CodecCountersUtil {
+
"Limit: "
+
limit
+
"."
,
actual
<=
limit
);
+
"Limit: "
+
limit
+
"."
,
actual
<=
limit
);
}
}
public
static
void
assertConsecutiveDroppedOutputBufferLimit
(
String
name
,
CodecCounters
counters
,
int
limit
)
{
counters
.
ensureUpdated
();
int
actual
=
counters
.
maxConsecutiveDroppedOutputBufferCount
;
TestCase
.
assertTrue
(
"Codec("
+
name
+
") was late decoding: "
+
actual
+
" buffers consecutively. "
+
"Limit: "
+
limit
+
"."
,
actual
<=
limit
);
}
}
}
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