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
6af74e7f
authored
Jan 24, 2022
by
olly
Committed by
Ian Baker
Jan 25, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add missing AudioFormat encoding conversions
PiperOrigin-RevId: 423786422
parent
5e583d34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/MediaFormatUtil.java
library/common/src/test/java/com/google/android/exoplayer2/util/MediaFormatUtilTest.java
library/common/src/main/java/com/google/android/exoplayer2/util/MediaFormatUtil.java
View file @
6af74e7f
...
...
@@ -220,6 +220,17 @@ public final class MediaFormatUtil {
case
C
.
ENCODING_PCM_FLOAT
:
mediaFormatPcmEncoding
=
AudioFormat
.
ENCODING_PCM_FLOAT
;
break
;
case
C
.
ENCODING_PCM_24BIT
:
mediaFormatPcmEncoding
=
AudioFormat
.
ENCODING_PCM_24BIT_PACKED
;
break
;
case
C
.
ENCODING_PCM_32BIT
:
mediaFormatPcmEncoding
=
AudioFormat
.
ENCODING_PCM_32BIT
;
break
;
case
C
.
ENCODING_INVALID
:
mediaFormatPcmEncoding
=
AudioFormat
.
ENCODING_INVALID
;
break
;
case
Format
.
NO_VALUE
:
case
C
.
ENCODING_PCM_16BIT_BIG_ENDIAN
:
default
:
// No matching value. Do nothing.
return
;
...
...
library/common/src/test/java/com/google/android/exoplayer2/util/MediaFormatUtilTest.java
View file @
6af74e7f
...
...
@@ -146,10 +146,10 @@ public class MediaFormatUtilTest {
@Test
public
void
createMediaFormatFromFormat_withPcmEncoding_setsCustomPcmEncodingEntry
()
{
Format
format
=
new
Format
.
Builder
().
setPcmEncoding
(
C
.
ENCODING_PCM_
32BIT
).
build
();
Format
format
=
new
Format
.
Builder
().
setPcmEncoding
(
C
.
ENCODING_PCM_
16BIT_BIG_ENDIAN
).
build
();
MediaFormat
mediaFormat
=
MediaFormatUtil
.
createMediaFormatFromFormat
(
format
);
assertThat
(
mediaFormat
.
getInteger
(
MediaFormatUtil
.
KEY_PCM_ENCODING_EXTENDED
))
.
isEqualTo
(
C
.
ENCODING_PCM_
32BIT
);
.
isEqualTo
(
C
.
ENCODING_PCM_
16BIT_BIG_ENDIAN
);
assertThat
(
mediaFormat
.
containsKey
(
MediaFormat
.
KEY_PCM_ENCODING
)).
isFalse
();
}
}
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