Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
ExoPlayer
提交
e696a7c6
E
ExoPlayer
项目概览
NotesChapter
/
ExoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
6
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
ExoPlayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e696a7c6
编写于
1月 25, 2021
作者:
A
andrewlewis
提交者:
Ian Baker
1月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use maximum supported channel count for Atmos from API 29
#minor-release PiperOrigin-RevId: 353649545
上级
3fcc14b3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
13 deletion
+56
-13
RELEASENOTES.md
RELEASENOTES.md
+2
-0
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
...com/google/android/exoplayer2/audio/DefaultAudioSink.java
+54
-13
未找到文件。
RELEASENOTES.md
浏览文件 @
e696a7c6
...
...
@@ -226,6 +226,8 @@
`onAudioSessionId`
was called, due to the improved handling of audio
session IDs as described above.
*
Retry playback after some types of
`AudioTrack`
error.
*
Create E-AC3 JOC passthrough
`AudioTrack`
s using the maximum supported
channel count (instead of assuming 6 channels) from API 29.
*
Text:
*
Gracefully handle null-terminated subtitle content in Matroska
containers.
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
浏览文件 @
e696a7c6
...
...
@@ -1457,28 +1457,69 @@ public final class DefaultAudioSink implements AudioSink {
if
(!
supportedEncoding
)
{
return
null
;
}
// E-AC3 JOC is object based, so any channel count specified in the format is arbitrary. Use 6,
// since the E-AC3 compatible part of the stream is 5.1.
int
channelCount
=
encoding
==
C
.
ENCODING_E_AC3_JOC
?
6
:
format
.
channelCount
;
if
(
channelCount
>
audioCapabilities
.
getMaxChannelCount
())
{
if
(
encoding
==
C
.
ENCODING_E_AC3_JOC
&&
!
audioCapabilities
.
supportsEncoding
(
C
.
ENCODING_E_AC3_JOC
))
{
// E-AC3 receivers support E-AC3 JOC streams (but decode only the base layer).
encoding
=
C
.
ENCODING_E_AC3
;
}
if
(!
audioCapabilities
.
supportsEncoding
(
encoding
))
{
return
null
;
}
int
channelCount
;
if
(
encoding
==
C
.
ENCODING_E_AC3_JOC
)
{
// E-AC3 JOC is object based so the format channel count is arbitrary. From API 29 we can get
// the channel count for this encoding, but before then there is no way to query it so we
// assume 6 channel audio is supported.
if
(
Util
.
SDK_INT
>=
29
)
{
channelCount
=
getMaxSupportedChannelCountForPassthroughV29
(
C
.
ENCODING_E_AC3_JOC
,
format
.
sampleRate
);
if
(
channelCount
==
0
)
{
Log
.
w
(
TAG
,
"E-AC3 JOC encoding supported but no channel count supported"
);
return
null
;
}
}
else
{
channelCount
=
6
;
}
}
else
{
channelCount
=
format
.
channelCount
;
if
(
channelCount
>
audioCapabilities
.
getMaxChannelCount
())
{
return
null
;
}
}
int
channelConfig
=
getChannelConfigForPassthrough
(
channelCount
);
if
(
channelConfig
==
AudioFormat
.
CHANNEL_INVALID
)
{
return
null
;
}
if
(
audioCapabilities
.
supportsEncoding
(
encoding
))
{
return
Pair
.
create
(
encoding
,
channelConfig
);
}
else
if
(
encoding
==
C
.
ENCODING_E_AC3_JOC
&&
audioCapabilities
.
supportsEncoding
(
C
.
ENCODING_E_AC3
))
{
// E-AC3 receivers support E-AC3 JOC streams (but decode in 2-D rather than 3-D).
return
Pair
.
create
(
C
.
ENCODING_E_AC3
,
channelConfig
);
}
return
Pair
.
create
(
encoding
,
channelConfig
);
}
return
null
;
/**
* Returns the maximum number of channels supported for passthrough playback of audio in the given
* format, or 0 if the format is unsupported.
*/
@RequiresApi
(
29
)
private
static
int
getMaxSupportedChannelCountForPassthroughV29
(
@C
.
Encoding
int
encoding
,
int
sampleRate
)
{
android
.
media
.
AudioAttributes
audioAttributes
=
new
android
.
media
.
AudioAttributes
.
Builder
()
.
setUsage
(
android
.
media
.
AudioAttributes
.
USAGE_MEDIA
)
.
setContentType
(
android
.
media
.
AudioAttributes
.
CONTENT_TYPE_MOVIE
)
.
build
();
// TODO(internal b/25994457): Query supported channel masks directly once it's supported.
for
(
int
channelCount
=
8
;
channelCount
>
0
;
channelCount
--)
{
AudioFormat
audioFormat
=
new
AudioFormat
.
Builder
()
.
setEncoding
(
encoding
)
.
setSampleRate
(
sampleRate
)
.
setChannelMask
(
Util
.
getAudioTrackChannelConfig
(
channelCount
))
.
build
();
if
(
AudioTrack
.
isDirectPlaybackSupported
(
audioFormat
,
audioAttributes
))
{
return
channelCount
;
}
}
return
0
;
}
private
static
int
getChannelConfigForPassthrough
(
int
channelCount
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录