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
50c81970
authored
Jul 23, 2018
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Widen setOutputSurface workaround
parent
7d4ac516
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
35 deletions
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
View file @
50c81970
...
@@ -84,6 +84,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -84,6 +84,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
// pending output streams that have fewer frames than the codec latency.
// pending output streams that have fewer frames than the codec latency.
private
static
final
int
MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT
=
10
;
private
static
final
int
MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT
=
10
;
private
static
boolean
evaluatedDeviceNeedsSetOutputSurfaceWorkaround
;
private
static
boolean
deviceNeedsSetOutputSurfaceWorkaround
;
private
final
Context
context
;
private
final
Context
context
;
private
final
VideoFrameReleaseTimeHelper
frameReleaseTimeHelper
;
private
final
VideoFrameReleaseTimeHelper
frameReleaseTimeHelper
;
private
final
EventDispatcher
eventDispatcher
;
private
final
EventDispatcher
eventDispatcher
;
...
@@ -825,11 +828,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -825,11 +828,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
private
boolean
shouldUseDummySurface
(
MediaCodecInfo
codecInfo
)
{
private
boolean
shouldUseDummySurface
(
MediaCodecInfo
codecInfo
)
{
return
Util
.
SDK_INT
>=
23
return
Util
.
SDK_INT
>=
23
&&
!
tunneling
&&
!
tunneling
&&
!
codecNeedsDummySurfaceWorkaround
(
codecInfo
.
name
)
&&
!
codecNeedsSetOutputSurfaceWorkaround
(
codecInfo
.
name
)
&&
!
codecNeedsSetOutputSurfaceWorkaround
(
codecInfo
.
name
)
&&
(!
codecInfo
.
secure
||
DummySurface
.
isSecureSupported
(
context
));
&&
(!
codecInfo
.
secure
||
DummySurface
.
isSecureSupported
(
context
));
}
}
private
void
setJoiningDeadlineMs
()
{
private
void
setJoiningDeadlineMs
()
{
joiningDeadlineMs
=
allowedJoiningTimeMs
>
0
joiningDeadlineMs
=
allowedJoiningTimeMs
>
0
?
(
SystemClock
.
elapsedRealtime
()
+
allowedJoiningTimeMs
)
:
C
.
TIME_UNSET
;
?
(
SystemClock
.
elapsedRealtime
()
+
allowedJoiningTimeMs
)
:
C
.
TIME_UNSET
;
...
@@ -1172,20 +1174,36 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -1172,20 +1174,36 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
return
Util
.
SDK_INT
<=
22
&&
"foster"
.
equals
(
Util
.
DEVICE
)
&&
"NVIDIA"
.
equals
(
Util
.
MANUFACTURER
);
return
Util
.
SDK_INT
<=
22
&&
"foster"
.
equals
(
Util
.
DEVICE
)
&&
"NVIDIA"
.
equals
(
Util
.
MANUFACTURER
);
}
}
private
static
boolean
codecNeedsDummySurfaceWorkaround
(
String
name
)
{
/*
// Work around https://github.com/google/ExoPlayer/issues/4419.
* TODO:
return
((
"needle"
.
equals
(
Util
.
DEVICE
))
// FireTV 4K
*
&&
"OMX.amlogic.avc.decoder.awesome"
.
equals
(
name
));
* 1. Validate that Android device certification now ensures correct behavior, and add a
}
* corresponding SDK_INT upper bound for applying the workaround (probably SDK_INT < 26).
* 2. Determine a complete list of affected devices.
* 3. Some of the devices in this list only fail to support setOutputSurface when switching from
* a SurfaceView provided Surface to a Surface of another type (e.g. TextureView/DummySurface),
* and vice versa. One hypothesis is that setOutputSurface fails when the surfaces have
* different pixel formats. If we can find a way to query the Surface instances to determine
* whether this case applies, then we'll be able to provide a more targeted workaround.
*/
/**
/**
* Returns whether the
device
is known to implement {@link MediaCodec#setOutputSurface(Surface)}
* Returns whether the
codec
is known to implement {@link MediaCodec#setOutputSurface(Surface)}
* incorrectly.
* incorrectly.
* <p>
*
* If true is returned then we fall back to releasing and re-instantiating the codec instead.
* <p>If true is returned then we fall back to releasing and re-instantiating the codec instead.
*
* @param name The name of the codec.
* @return True if the device is known to implement {@link MediaCodec#setOutputSurface(Surface)}
* incorrectly.
*/
*/
private
static
boolean
codecNeedsSetOutputSurfaceWorkaround
(
String
name
)
{
protected
boolean
codecNeedsSetOutputSurfaceWorkaround
(
String
name
)
{
// Work around https://github.com/google/ExoPlayer/issues/3236,
if
(
Util
.
SDK_INT
>=
27
||
name
.
startsWith
(
"OMX.google"
))
{
// Devices running API level 27 or later should also be unaffected. Google OMX decoders are
// not known to have this issue on any API level.
return
false
;
}
// Work around:
// https://github.com/google/ExoPlayer/issues/3236,
// https://github.com/google/ExoPlayer/issues/3355,
// https://github.com/google/ExoPlayer/issues/3355,
// https://github.com/google/ExoPlayer/issues/3439,
// https://github.com/google/ExoPlayer/issues/3439,
// https://github.com/google/ExoPlayer/issues/3724,
// https://github.com/google/ExoPlayer/issues/3724,
...
@@ -1194,28 +1212,140 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -1194,28 +1212,140 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
// https://github.com/google/ExoPlayer/issues/4084,
// https://github.com/google/ExoPlayer/issues/4084,
// https://github.com/google/ExoPlayer/issues/4104,
// https://github.com/google/ExoPlayer/issues/4104,
// https://github.com/google/ExoPlayer/issues/4134,
// https://github.com/google/ExoPlayer/issues/4134,
// https://github.com/google/ExoPlayer/issues/4315.
// https://github.com/google/ExoPlayer/issues/4315,
return
((
"deb"
.
equals
(
Util
.
DEVICE
)
// Nexus 7 (2013)
// https://github.com/google/ExoPlayer/issues/4419,
||
"flo"
.
equals
(
Util
.
DEVICE
)
// Nexus 7 (2013)
// https://github.com/google/ExoPlayer/issues/4460,
||
"mido"
.
equals
(
Util
.
DEVICE
)
// Redmi Note 4
// https://github.com/google/ExoPlayer/issues/4468.
||
"santoni"
.
equals
(
Util
.
DEVICE
))
// Redmi 4X
synchronized
(
MediaCodecVideoRenderer
.
class
)
{
&&
"OMX.qcom.video.decoder.avc"
.
equals
(
name
))
if
(!
evaluatedDeviceNeedsSetOutputSurfaceWorkaround
)
{
||
((
"tcl_eu"
.
equals
(
Util
.
DEVICE
)
// TCL Percee TV
switch
(
Util
.
DEVICE
)
{
||
"SVP-DTV15"
.
equals
(
Util
.
DEVICE
)
// Sony Bravia 4K 2015
case
"1601"
:
||
"BRAVIA_ATV2"
.
equals
(
Util
.
DEVICE
)
// Sony Bravia 4K GB
case
"1713"
:
||
Util
.
DEVICE
.
startsWith
(
"panell_"
)
// Motorola Moto C Plus
case
"1714"
:
||
"F3311"
.
equals
(
Util
.
DEVICE
)
// Sony Xperia E5
case
"A10-70F"
:
||
"M5c"
.
equals
(
Util
.
DEVICE
)
// Meizu M5C
case
"A1601"
:
||
"QM16XE_U"
.
equals
(
Util
.
DEVICE
)
// Philips QM163E
case
"A2016a40"
:
||
"A7010a48"
.
equals
(
Util
.
DEVICE
)
// Lenovo K4 Note
case
"A7000-a"
:
||
"woods_f"
.
equals
(
Util
.
MODEL
)
// Moto E (4)
case
"A7000plus"
:
||
"watson"
.
equals
(
Util
.
DEVICE
))
// Moto C
case
"A7010a48"
:
&&
"OMX.MTK.VIDEO.DECODER.AVC"
.
equals
(
name
))
case
"A7020a48"
:
||
((
"ALE-L21"
.
equals
(
Util
.
MODEL
)
// Huawei P8 Lite
case
"AquaPowerM"
:
||
"CAM-L21"
.
equals
(
Util
.
MODEL
))
// Huawei Y6II
case
"Aura_Note_2"
:
&&
"OMX.k3.video.decoder.avc"
.
equals
(
name
))
case
"BLACK-1X"
:
||
((
"HUAWEI VNS-L21"
.
equals
(
Util
.
MODEL
))
// Huawei P9 Lite
case
"BRAVIA_ATV2"
:
&&
"OMX.IMG.MSVDX.Decoder.AVC"
.
equals
(
name
));
case
"C1"
:
case
"ComioS1"
:
case
"CP8676_I02"
:
case
"CPH1609"
:
case
"CPY83_I00"
:
case
"cv1"
:
case
"cv3"
:
case
"deb"
:
case
"E5643"
:
case
"ELUGA_A3_Pro"
:
case
"ELUGA_Note"
:
case
"ELUGA_Prim"
:
case
"ELUGA_Ray_X"
:
case
"EverStar_S"
:
case
"F3111"
:
case
"F3113"
:
case
"F3116"
:
case
"F3211"
:
case
"F3213"
:
case
"F3215"
:
case
"F3311"
:
case
"flo"
:
case
"GiONEE_CBL7513"
:
case
"GiONEE_GBL7319"
:
case
"GIONEE_GBL7360"
:
case
"GIONEE_SWW1609"
:
case
"GIONEE_SWW1627"
:
case
"GIONEE_SWW1631"
:
case
"GIONEE_WBL5708"
:
case
"GIONEE_WBL7365"
:
case
"GIONEE_WBL7519"
:
case
"griffin"
:
case
"htc_e56ml_dtul"
:
case
"hwALE-H"
:
case
"HWBLN-H"
:
case
"HWCAM-H"
:
case
"HWVNS-H"
:
case
"iball8735_9806"
:
case
"Infinix-X572"
:
case
"iris60"
:
case
"itel_S41"
:
case
"j2xlteins"
:
case
"JGZ"
:
case
"K50a40"
:
case
"le_x6"
:
case
"LS-5017"
:
case
"M5c"
:
case
"manning"
:
case
"marino_f"
:
case
"MEIZU_M5"
:
case
"mh"
:
case
"mido"
:
case
"MX6"
:
case
"namath"
:
case
"nicklaus_f"
:
case
"NX541J"
:
case
"NX573J"
:
case
"OnePlus5T"
:
case
"p212"
:
case
"P681"
:
case
"P85"
:
case
"panell_d"
:
case
"panell_dl"
:
case
"panell_ds"
:
case
"panell_dt"
:
case
"PB2-670M"
:
case
"PGN528"
:
case
"PGN610"
:
case
"PGN611"
:
case
"Phantom6"
:
case
"Pixi4-7_3G"
:
case
"Pixi5-10_4G"
:
case
"PLE"
:
case
"Q350"
:
case
"Q4260"
:
case
"Q427"
:
case
"Q4310"
:
case
"Q5"
:
case
"QM16XE_U"
:
case
"QX1"
:
case
"santoni"
:
case
"Slate_Pro"
:
case
"SVP-DTV15"
:
case
"s905x018"
:
case
"taido_row"
:
case
"TB3-730F"
:
case
"TB3-730X"
:
case
"TB3-850F"
:
case
"TB3-850M"
:
case
"tcl_eu"
:
case
"V1"
:
case
"V23GB"
:
case
"V5"
:
case
"vernee_M5"
:
case
"watson"
:
case
"whyred"
:
case
"woods_f"
:
case
"woods_fn"
:
case
"X3_HK"
:
case
"XE2X"
:
case
"XT1663"
:
case
"Z12_PRO"
:
case
"Z80"
:
deviceNeedsSetOutputSurfaceWorkaround
=
true
;
break
;
default
:
// Workaround not required.
break
;
}
evaluatedDeviceNeedsSetOutputSurfaceWorkaround
=
true
;
}
}
return
deviceNeedsSetOutputSurfaceWorkaround
;
}
}
protected
static
final
class
CodecMaxValues
{
protected
static
final
class
CodecMaxValues
{
...
...
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