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
c40d1c66
authored
Jan 19, 2021
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #8462 from zeninsta:advertise-vp9-profile
PiperOrigin-RevId: 352611965
parents
b2a42ea1
2bb93be1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
4 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java
RELEASENOTES.md
View file @
c40d1c66
...
...
@@ -195,6 +195,11 @@
`DecoderReuseEvaluation`
indicates whether it was possible to re-use an
existing decoder instance for the new format, and if not then the
reasons why.
*
Video:
*
Fix VP9 format capability checks on API level 23 and earlier. The
platform does not correctly report the VP9 level supported by the
decoder in this case, so we estimate it based on the decoder's maximum
supported bitrate.
*
Audio:
*
Fix handling of audio session IDs
(
[
#8190
](
https://github.com/google/ExoPlayer/issues/8190
)
).
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java
View file @
c40d1c66
...
...
@@ -298,8 +298,16 @@ public final class MediaCodecInfo {
// which may not be widely supported. See https://github.com/google/ExoPlayer/issues/5145.
return
true
;
}
for
(
CodecProfileLevel
capabilities
:
getProfileLevels
())
{
if
(
capabilities
.
profile
==
profile
&&
capabilities
.
level
>=
level
)
{
CodecProfileLevel
[]
profileLevels
=
getProfileLevels
();
if
(
Util
.
SDK_INT
<=
23
&&
MimeTypes
.
VIDEO_VP9
.
equals
(
mimeType
)
&&
profileLevels
.
length
==
0
)
{
// Some older devices don't report profile levels for VP9. Estimate them using other data in
// the codec capabilities.
profileLevels
=
estimateLegacyVp9ProfileLevels
(
capabilities
);
}
for
(
CodecProfileLevel
profileLevel
:
profileLevels
)
{
if
(
profileLevel
.
profile
==
profile
&&
profileLevel
.
level
>=
level
)
{
return
true
;
}
}
...
...
@@ -334,8 +342,8 @@ public final class MediaCodecInfo {
if
(
isVideo
)
{
return
adaptive
;
}
else
{
Pair
<
Integer
,
Integer
>
codecP
rofileLevel
=
MediaCodecUtil
.
getCodecProfileAndLevel
(
format
);
return
codecProfileLevel
!=
null
&&
codecP
rofileLevel
.
first
==
CodecProfileLevel
.
AACObjectXHE
;
Pair
<
Integer
,
Integer
>
p
rofileLevel
=
MediaCodecUtil
.
getCodecProfileAndLevel
(
format
);
return
profileLevel
!=
null
&&
p
rofileLevel
.
first
==
CodecProfileLevel
.
AACObjectXHE
;
}
}
...
...
@@ -679,6 +687,60 @@ public final class MediaCodecInfo {
}
/**
* Called on devices with {@link Util#SDK_INT} 23 and below, for VP9 decoders whose {@link
* CodecCapabilities} do not correctly report profile levels. The returned {@link
* CodecProfileLevel CodecProfileLevels} are estimated based on other data in the {@link
* CodecCapabilities}.
*
* @param capabilities The {@link CodecCapabilities} for a VP9 decoder, or {@code null} if not
* known.
* @return The estimated {@link CodecProfileLevel CodecProfileLevels} for the decoder.
*/
private
static
CodecProfileLevel
[]
estimateLegacyVp9ProfileLevels
(
@Nullable
CodecCapabilities
capabilities
)
{
int
maxBitrate
=
0
;
if
(
capabilities
!=
null
)
{
@Nullable
VideoCapabilities
videoCapabilities
=
capabilities
.
getVideoCapabilities
();
if
(
videoCapabilities
!=
null
)
{
maxBitrate
=
videoCapabilities
.
getBitrateRange
().
getUpper
();
}
}
// Values taken from https://www.webmproject.org/vp9/levels.
int
level
;
if
(
maxBitrate
>=
180_000_000
)
{
level
=
CodecProfileLevel
.
VP9Level52
;
}
else
if
(
maxBitrate
>=
120_000_000
)
{
level
=
CodecProfileLevel
.
VP9Level51
;
}
else
if
(
maxBitrate
>=
60_000_000
)
{
level
=
CodecProfileLevel
.
VP9Level5
;
}
else
if
(
maxBitrate
>=
30_000_000
)
{
level
=
CodecProfileLevel
.
VP9Level41
;
}
else
if
(
maxBitrate
>=
18_000_000
)
{
level
=
CodecProfileLevel
.
VP9Level4
;
}
else
if
(
maxBitrate
>=
12_000_000
)
{
level
=
CodecProfileLevel
.
VP9Level31
;
}
else
if
(
maxBitrate
>=
7_200_000
)
{
level
=
CodecProfileLevel
.
VP9Level3
;
}
else
if
(
maxBitrate
>=
3_600_000
)
{
level
=
CodecProfileLevel
.
VP9Level21
;
}
else
if
(
maxBitrate
>=
1_800_000
)
{
level
=
CodecProfileLevel
.
VP9Level2
;
}
else
if
(
maxBitrate
>=
800_000
)
{
level
=
CodecProfileLevel
.
VP9Level11
;
}
else
{
// Assume level 1 is always supported.
level
=
CodecProfileLevel
.
VP9Level1
;
}
CodecProfileLevel
profileLevel
=
new
CodecProfileLevel
();
// Since this method is for legacy devices only, assume that only profile 0 is supported.
profileLevel
.
profile
=
CodecProfileLevel
.
VP9Profile0
;
profileLevel
.
level
=
level
;
return
new
CodecProfileLevel
[]
{
profileLevel
};
}
/**
* Returns whether the decoder is known to fail when adapting, despite advertising itself as an
* adaptive decoder.
*
...
...
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