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
f5a4f3e6
authored
Mar 31, 2021
by
olly
Committed by
Oliver Woodman
Apr 01, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Switch tests to use SimpleExoPlayer
PiperOrigin-RevId: 366033200
parent
c0228845
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
19 deletions
extensions/flac/src/androidTest/java/com/google/android/exoplayer2/ext/flac/FlacPlaybackTest.java
extensions/opus/src/androidTest/java/com/google/android/exoplayer2/ext/opus/OpusPlaybackTest.java
extensions/vp9/src/androidTest/java/com/google/android/exoplayer2/ext/vp9/VpxPlaybackTest.java
library/core/build.gradle
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
extensions/flac/src/androidTest/java/com/google/android/exoplayer2/ext/flac/FlacPlaybackTest.java
View file @
f5a4f3e6
...
@@ -24,9 +24,11 @@ import androidx.annotation.Nullable;
...
@@ -24,9 +24,11 @@ import androidx.annotation.Nullable;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Renderer
;
import
com.google.android.exoplayer2.RenderersFactory
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.audio.AudioProcessor
;
import
com.google.android.exoplayer2.audio.AudioProcessor
;
import
com.google.android.exoplayer2.audio.AudioSink
;
import
com.google.android.exoplayer2.audio.AudioSink
;
import
com.google.android.exoplayer2.audio.DefaultAudioSink
;
import
com.google.android.exoplayer2.audio.DefaultAudioSink
;
...
@@ -93,7 +95,7 @@ public class FlacPlaybackTest {
...
@@ -93,7 +95,7 @@ public class FlacPlaybackTest {
private
final
Uri
uri
;
private
final
Uri
uri
;
private
final
AudioSink
audioSink
;
private
final
AudioSink
audioSink
;
@Nullable
private
ExoPlayer
player
;
@Nullable
private
Simple
ExoPlayer
player
;
@Nullable
private
ExoPlaybackException
playbackException
;
@Nullable
private
ExoPlaybackException
playbackException
;
public
TestPlaybackRunnable
(
Uri
uri
,
Context
context
,
AudioSink
audioSink
)
{
public
TestPlaybackRunnable
(
Uri
uri
,
Context
context
,
AudioSink
audioSink
)
{
...
@@ -105,9 +107,16 @@ public class FlacPlaybackTest {
...
@@ -105,9 +107,16 @@ public class FlacPlaybackTest {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
Looper
.
prepare
();
Looper
.
prepare
();
LibflacAudioRenderer
audioRenderer
=
RenderersFactory
renderersFactory
=
new
LibflacAudioRenderer
(
/* eventHandler= */
null
,
/* eventListener= */
null
,
audioSink
);
(
eventHandler
,
player
=
new
ExoPlayer
.
Builder
(
context
,
audioRenderer
).
build
();
videoRendererEventListener
,
audioRendererEventListener
,
textRendererOutput
,
metadataRendererOutput
)
->
new
Renderer
[]
{
new
LibflacAudioRenderer
(
eventHandler
,
audioRendererEventListener
,
audioSink
)
};
player
=
new
SimpleExoPlayer
.
Builder
(
context
,
renderersFactory
).
build
();
player
.
addListener
(
this
);
player
.
addListener
(
this
);
MediaSource
mediaSource
=
MediaSource
mediaSource
=
new
ProgressiveMediaSource
.
Factory
(
new
ProgressiveMediaSource
.
Factory
(
...
...
extensions/opus/src/androidTest/java/com/google/android/exoplayer2/ext/opus/OpusPlaybackTest.java
View file @
f5a4f3e6
...
@@ -24,9 +24,11 @@ import androidx.annotation.Nullable;
...
@@ -24,9 +24,11 @@ import androidx.annotation.Nullable;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Renderer
;
import
com.google.android.exoplayer2.RenderersFactory
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor
;
import
com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
...
@@ -76,7 +78,7 @@ public class OpusPlaybackTest {
...
@@ -76,7 +78,7 @@ public class OpusPlaybackTest {
private
final
Context
context
;
private
final
Context
context
;
private
final
Uri
uri
;
private
final
Uri
uri
;
@Nullable
private
ExoPlayer
player
;
@Nullable
private
Simple
ExoPlayer
player
;
@Nullable
private
ExoPlaybackException
playbackException
;
@Nullable
private
ExoPlaybackException
playbackException
;
public
TestPlaybackRunnable
(
Uri
uri
,
Context
context
)
{
public
TestPlaybackRunnable
(
Uri
uri
,
Context
context
)
{
...
@@ -87,8 +89,14 @@ public class OpusPlaybackTest {
...
@@ -87,8 +89,14 @@ public class OpusPlaybackTest {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
Looper
.
prepare
();
Looper
.
prepare
();
LibopusAudioRenderer
audioRenderer
=
new
LibopusAudioRenderer
();
RenderersFactory
renderersFactory
=
player
=
new
ExoPlayer
.
Builder
(
context
,
audioRenderer
).
build
();
(
eventHandler
,
videoRendererEventListener
,
audioRendererEventListener
,
textRendererOutput
,
metadataRendererOutput
)
->
new
Renderer
[]
{
new
LibopusAudioRenderer
(
eventHandler
,
audioRendererEventListener
)};
player
=
new
SimpleExoPlayer
.
Builder
(
context
,
renderersFactory
).
build
();
player
.
addListener
(
this
);
player
.
addListener
(
this
);
MediaSource
mediaSource
=
MediaSource
mediaSource
=
new
ProgressiveMediaSource
.
Factory
(
new
ProgressiveMediaSource
.
Factory
(
...
...
extensions/vp9/src/androidTest/java/com/google/android/exoplayer2/ext/vp9/VpxPlaybackTest.java
View file @
f5a4f3e6
...
@@ -25,10 +25,11 @@ import androidx.annotation.Nullable;
...
@@ -25,10 +25,11 @@ import androidx.annotation.Nullable;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Renderer
;
import
com.google.android.exoplayer2.Renderer
;
import
com.google.android.exoplayer2.RenderersFactory
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor
;
import
com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
...
@@ -105,7 +106,7 @@ public class VpxPlaybackTest {
...
@@ -105,7 +106,7 @@ public class VpxPlaybackTest {
private
final
Context
context
;
private
final
Context
context
;
private
final
Uri
uri
;
private
final
Uri
uri
;
@Nullable
private
ExoPlayer
player
;
@Nullable
private
Simple
ExoPlayer
player
;
@Nullable
private
ExoPlaybackException
playbackException
;
@Nullable
private
ExoPlaybackException
playbackException
;
public
TestPlaybackRunnable
(
Uri
uri
,
Context
context
)
{
public
TestPlaybackRunnable
(
Uri
uri
,
Context
context
)
{
...
@@ -116,18 +117,26 @@ public class VpxPlaybackTest {
...
@@ -116,18 +117,26 @@ public class VpxPlaybackTest {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
Looper
.
prepare
();
Looper
.
prepare
();
LibvpxVideoRenderer
videoRenderer
=
new
LibvpxVideoRenderer
(
0
);
RenderersFactory
renderersFactory
=
player
=
new
ExoPlayer
.
Builder
(
context
,
videoRenderer
).
build
();
(
eventHandler
,
videoRendererEventListener
,
audioRendererEventListener
,
textRendererOutput
,
metadataRendererOutput
)
->
new
Renderer
[]
{
new
LibvpxVideoRenderer
(
/* allowedJoiningTimeMs= */
0
,
eventHandler
,
videoRendererEventListener
,
/* maxDroppedFramesToNotify= */
-
1
)
};
player
=
new
SimpleExoPlayer
.
Builder
(
context
,
renderersFactory
).
build
();
player
.
addListener
(
this
);
player
.
addListener
(
this
);
MediaSource
mediaSource
=
MediaSource
mediaSource
=
new
ProgressiveMediaSource
.
Factory
(
new
ProgressiveMediaSource
.
Factory
(
new
DefaultDataSourceFactory
(
context
),
MatroskaExtractor
.
FACTORY
)
new
DefaultDataSourceFactory
(
context
),
MatroskaExtractor
.
FACTORY
)
.
createMediaSource
(
MediaItem
.
fromUri
(
uri
));
.
createMediaSource
(
MediaItem
.
fromUri
(
uri
));
player
player
.
setVideoSurfaceView
(
new
VideoDecoderGLSurfaceView
(
context
));
.
createMessage
(
videoRenderer
)
.
setType
(
Renderer
.
MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER
)
.
setPayload
(
new
VideoDecoderGLSurfaceView
(
context
).
getVideoDecoderOutputBufferRenderer
())
.
send
();
player
.
setMediaSource
(
mediaSource
);
player
.
setMediaSource
(
mediaSource
);
player
.
prepare
();
player
.
prepare
();
player
.
play
();
player
.
play
();
...
...
library/core/build.gradle
View file @
f5a4f3e6
...
@@ -19,6 +19,7 @@ android {
...
@@ -19,6 +19,7 @@ android {
// "pm clear" command after each test invocation. This command ensures
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments
clearPackageData:
'true'
testInstrumentationRunnerArguments
clearPackageData:
'true'
multiDexEnabled
true
}
}
buildTypes
{
buildTypes
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
View file @
f5a4f3e6
...
@@ -176,7 +176,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -176,7 +176,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
allowedJoiningTimeMs
,
allowedJoiningTimeMs
,
/* eventHandler= */
null
,
/* eventHandler= */
null
,
/* eventListener= */
null
,
/* eventListener= */
null
,
/* maxDroppedFramesToNotify= */
-
1
);
/* maxDroppedFramesToNotify= */
0
);
}
}
/**
/**
...
...
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