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
082aee69
authored
May 29, 2019
by
andrewlewis
Committed by
Oliver Woodman
May 31, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Allow passthrough of E-AC3-JOC streams
PiperOrigin-RevId: 250517338
parent
41ab7ef7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
7 deletions
library/core/src/main/java/com/google/android/exoplayer2/C.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
library/core/src/main/java/com/google/android/exoplayer2/C.java
View file @
082aee69
...
@@ -146,8 +146,8 @@ public final class C {
...
@@ -146,8 +146,8 @@ public final class C {
* {@link #ENCODING_INVALID}, {@link #ENCODING_PCM_8BIT}, {@link #ENCODING_PCM_16BIT}, {@link
* {@link #ENCODING_INVALID}, {@link #ENCODING_PCM_8BIT}, {@link #ENCODING_PCM_16BIT}, {@link
* #ENCODING_PCM_24BIT}, {@link #ENCODING_PCM_32BIT}, {@link #ENCODING_PCM_FLOAT}, {@link
* #ENCODING_PCM_24BIT}, {@link #ENCODING_PCM_32BIT}, {@link #ENCODING_PCM_FLOAT}, {@link
* #ENCODING_PCM_MU_LAW}, {@link #ENCODING_PCM_A_LAW}, {@link #ENCODING_AC3}, {@link
* #ENCODING_PCM_MU_LAW}, {@link #ENCODING_PCM_A_LAW}, {@link #ENCODING_AC3}, {@link
* #ENCODING_E_AC3}, {@link #ENCODING_
AC4}, {@link #ENCODING_DTS}, {@link #ENCODING_DTS_HD} or
* #ENCODING_E_AC3}, {@link #ENCODING_
E_AC3_JOC}, {@link #ENCODING_AC4}, {@link #ENCODING_DTS},
* {@link #ENCODING_DOLBY_TRUEHD}.
* {@link #ENCODING_D
TS_HD} or {@link #ENCODING_D
OLBY_TRUEHD}.
*/
*/
@Documented
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@Retention
(
RetentionPolicy
.
SOURCE
)
...
@@ -163,6 +163,7 @@ public final class C {
...
@@ -163,6 +163,7 @@ public final class C {
ENCODING_PCM_A_LAW
,
ENCODING_PCM_A_LAW
,
ENCODING_AC3
,
ENCODING_AC3
,
ENCODING_E_AC3
,
ENCODING_E_AC3
,
ENCODING_E_AC3_JOC
,
ENCODING_AC4
,
ENCODING_AC4
,
ENCODING_DTS
,
ENCODING_DTS
,
ENCODING_DTS_HD
,
ENCODING_DTS_HD
,
...
@@ -210,6 +211,8 @@ public final class C {
...
@@ -210,6 +211,8 @@ public final class C {
public
static
final
int
ENCODING_AC3
=
AudioFormat
.
ENCODING_AC3
;
public
static
final
int
ENCODING_AC3
=
AudioFormat
.
ENCODING_AC3
;
/** @see AudioFormat#ENCODING_E_AC3 */
/** @see AudioFormat#ENCODING_E_AC3 */
public
static
final
int
ENCODING_E_AC3
=
AudioFormat
.
ENCODING_E_AC3
;
public
static
final
int
ENCODING_E_AC3
=
AudioFormat
.
ENCODING_E_AC3
;
/** @see AudioFormat#ENCODING_E_AC3_JOC */
public
static
final
int
ENCODING_E_AC3_JOC
=
AudioFormat
.
ENCODING_E_AC3_JOC
;
/** @see AudioFormat#ENCODING_AC4 */
/** @see AudioFormat#ENCODING_AC4 */
public
static
final
int
ENCODING_AC4
=
AudioFormat
.
ENCODING_AC4
;
public
static
final
int
ENCODING_AC4
=
AudioFormat
.
ENCODING_AC4
;
/** @see AudioFormat#ENCODING_DTS */
/** @see AudioFormat#ENCODING_DTS */
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
082aee69
...
@@ -1125,6 +1125,7 @@ public final class DefaultAudioSink implements AudioSink {
...
@@ -1125,6 +1125,7 @@ public final class DefaultAudioSink implements AudioSink {
case
C
.
ENCODING_AC3
:
case
C
.
ENCODING_AC3
:
return
640
*
1000
/
8
;
return
640
*
1000
/
8
;
case
C
.
ENCODING_E_AC3
:
case
C
.
ENCODING_E_AC3
:
case
C
.
ENCODING_E_AC3_JOC
:
return
6144
*
1000
/
8
;
return
6144
*
1000
/
8
;
case
C
.
ENCODING_AC4
:
case
C
.
ENCODING_AC4
:
return
2688
*
1000
/
8
;
return
2688
*
1000
/
8
;
...
@@ -1154,7 +1155,7 @@ public final class DefaultAudioSink implements AudioSink {
...
@@ -1154,7 +1155,7 @@ public final class DefaultAudioSink implements AudioSink {
return
DtsUtil
.
parseDtsAudioSampleCount
(
buffer
);
return
DtsUtil
.
parseDtsAudioSampleCount
(
buffer
);
}
else
if
(
encoding
==
C
.
ENCODING_AC3
)
{
}
else
if
(
encoding
==
C
.
ENCODING_AC3
)
{
return
Ac3Util
.
getAc3SyncframeAudioSampleCount
();
return
Ac3Util
.
getAc3SyncframeAudioSampleCount
();
}
else
if
(
encoding
==
C
.
ENCODING_E_AC3
)
{
}
else
if
(
encoding
==
C
.
ENCODING_E_AC3
||
encoding
==
C
.
ENCODING_E_AC3_JOC
)
{
return
Ac3Util
.
parseEAc3SyncframeAudioSampleCount
(
buffer
);
return
Ac3Util
.
parseEAc3SyncframeAudioSampleCount
(
buffer
);
}
else
if
(
encoding
==
C
.
ENCODING_AC4
)
{
}
else
if
(
encoding
==
C
.
ENCODING_AC4
)
{
return
Ac4Util
.
parseAc4SyncframeAudioSampleCount
(
buffer
);
return
Ac4Util
.
parseAc4SyncframeAudioSampleCount
(
buffer
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
View file @
082aee69
...
@@ -379,7 +379,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
...
@@ -379,7 +379,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
* @return Whether passthrough playback is supported.
* @return Whether passthrough playback is supported.
*/
*/
protected
boolean
allowPassthrough
(
int
channelCount
,
String
mimeType
)
{
protected
boolean
allowPassthrough
(
int
channelCount
,
String
mimeType
)
{
return
audioSink
.
supportsOutput
(
channelCount
,
MimeTypes
.
getEncoding
(
mimeType
))
;
return
getPassthroughEncoding
(
channelCount
,
mimeType
)
!=
C
.
ENCODING_INVALID
;
}
}
@Override
@Override
...
@@ -475,11 +475,14 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
...
@@ -475,11 +475,14 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
@C
.
Encoding
int
encoding
;
@C
.
Encoding
int
encoding
;
MediaFormat
format
;
MediaFormat
format
;
if
(
passthroughMediaFormat
!=
null
)
{
if
(
passthroughMediaFormat
!=
null
)
{
encoding
=
MimeTypes
.
getEncoding
(
passthroughMediaFormat
.
getString
(
MediaFormat
.
KEY_MIME
));
format
=
passthroughMediaFormat
;
format
=
passthroughMediaFormat
;
encoding
=
getPassthroughEncoding
(
format
.
getInteger
(
MediaFormat
.
KEY_CHANNEL_COUNT
),
format
.
getString
(
MediaFormat
.
KEY_MIME
));
}
else
{
}
else
{
encoding
=
pcmEncoding
;
format
=
outputFormat
;
format
=
outputFormat
;
encoding
=
pcmEncoding
;
}
}
int
channelCount
=
format
.
getInteger
(
MediaFormat
.
KEY_CHANNEL_COUNT
);
int
channelCount
=
format
.
getInteger
(
MediaFormat
.
KEY_CHANNEL_COUNT
);
int
sampleRate
=
format
.
getInteger
(
MediaFormat
.
KEY_SAMPLE_RATE
);
int
sampleRate
=
format
.
getInteger
(
MediaFormat
.
KEY_SAMPLE_RATE
);
...
@@ -502,6 +505,28 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
...
@@ -502,6 +505,28 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
}
}
/**
/**
* Returns the {@link C.Encoding} constant to use for passthrough of the given format, or {@link
* C#ENCODING_INVALID} if passthrough is not possible.
*/
@C
.
Encoding
protected
int
getPassthroughEncoding
(
int
channelCount
,
String
mimeType
)
{
if
(
MimeTypes
.
AUDIO_E_AC3_JOC
.
equals
(
mimeType
))
{
if
(
audioSink
.
supportsOutput
(
channelCount
,
C
.
ENCODING_E_AC3_JOC
))
{
return
MimeTypes
.
getEncoding
(
MimeTypes
.
AUDIO_E_AC3_JOC
);
}
// E-AC3 receivers can decode JOC streams, but in 2-D rather than 3-D, so try to fall back.
mimeType
=
MimeTypes
.
AUDIO_E_AC3
;
}
@C
.
Encoding
int
encoding
=
MimeTypes
.
getEncoding
(
mimeType
);
if
(
audioSink
.
supportsOutput
(
channelCount
,
encoding
))
{
return
encoding
;
}
else
{
return
C
.
ENCODING_INVALID
;
}
}
/**
* Called when the audio session id becomes known. The default implementation is a no-op. One
* Called when the audio session id becomes known. The default implementation is a no-op. One
* reason for overriding this method would be to instantiate and enable a {@link Virtualizer} in
* reason for overriding this method would be to instantiate and enable a {@link Virtualizer} in
* order to spatialize the audio channels. For this use case, any {@link Virtualizer} instances
* order to spatialize the audio channels. For this use case, any {@link Virtualizer} instances
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
View file @
082aee69
...
@@ -348,8 +348,9 @@ public final class MimeTypes {
...
@@ -348,8 +348,9 @@ public final class MimeTypes {
case
MimeTypes
.
AUDIO_AC3
:
case
MimeTypes
.
AUDIO_AC3
:
return
C
.
ENCODING_AC3
;
return
C
.
ENCODING_AC3
;
case
MimeTypes
.
AUDIO_E_AC3
:
case
MimeTypes
.
AUDIO_E_AC3
:
case
MimeTypes
.
AUDIO_E_AC3_JOC
:
return
C
.
ENCODING_E_AC3
;
return
C
.
ENCODING_E_AC3
;
case
MimeTypes
.
AUDIO_E_AC3_JOC
:
return
C
.
ENCODING_E_AC3_JOC
;
case
MimeTypes
.
AUDIO_AC4
:
case
MimeTypes
.
AUDIO_AC4
:
return
C
.
ENCODING_AC4
;
return
C
.
ENCODING_AC4
;
case
MimeTypes
.
AUDIO_DTS
:
case
MimeTypes
.
AUDIO_DTS
:
...
...
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