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
1c11febf
authored
Mar 27, 2020
by
olly
Committed by
Oliver Woodman
Mar 27, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Workaround C2 AAC decoder flush problem on Android 10
Issue: #6671 PiperOrigin-RevId: 303364788
parent
db61af23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
RELEASENOTES.md
View file @
1c11febf
...
@@ -67,6 +67,8 @@
...
@@ -67,6 +67,8 @@
to the
`DefaultAudioSink`
constructor
to the
`DefaultAudioSink`
constructor
(
[
#7134
](
https://github.com/google/ExoPlayer/issues/7134
)
).
(
[
#7134
](
https://github.com/google/ExoPlayer/issues/7134
)
).
*
Add media item based playlist API to Player.
*
Add media item based playlist API to Player.
*
Workaround issue that could cause slower than realtime playback of AAC
on Android 10 (
[
#6671
](
https://github.com/google/ExoPlayer/issues/6671
)
.
*
Text:
*
Text:
*
Parse
`<ruby>`
and
`<rt>`
tags in WebVTT subtitles (rendering is coming
*
Parse
`<ruby>`
and
`<rt>`
tags in WebVTT subtitles (rendering is coming
later).
later).
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
View file @
1c11febf
...
@@ -386,6 +386,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -386,6 +386,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
private
boolean
codecNeedsReconfigureWorkaround
;
private
boolean
codecNeedsReconfigureWorkaround
;
private
boolean
codecNeedsDiscardToSpsWorkaround
;
private
boolean
codecNeedsDiscardToSpsWorkaround
;
private
boolean
codecNeedsFlushWorkaround
;
private
boolean
codecNeedsFlushWorkaround
;
private
boolean
codecNeedsSosFlushWorkaround
;
private
boolean
codecNeedsEosFlushWorkaround
;
private
boolean
codecNeedsEosFlushWorkaround
;
private
boolean
codecNeedsEosOutputExceptionWorkaround
;
private
boolean
codecNeedsEosOutputExceptionWorkaround
;
private
boolean
codecNeedsMonoChannelCountWorkaround
;
private
boolean
codecNeedsMonoChannelCountWorkaround
;
...
@@ -406,6 +407,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -406,6 +407,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
@DrainAction
private
int
codecDrainAction
;
@DrainAction
private
int
codecDrainAction
;
private
boolean
codecReceivedBuffers
;
private
boolean
codecReceivedBuffers
;
private
boolean
codecReceivedEos
;
private
boolean
codecReceivedEos
;
private
boolean
codecHasOutputMediaFormat
;
private
long
largestQueuedPresentationTimeUs
;
private
long
largestQueuedPresentationTimeUs
;
private
long
lastBufferInStreamPresentationTimeUs
;
private
long
lastBufferInStreamPresentationTimeUs
;
private
boolean
inputStreamEnded
;
private
boolean
inputStreamEnded
;
...
@@ -838,6 +840,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -838,6 +840,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
}
}
if
(
codecDrainAction
==
DRAIN_ACTION_REINITIALIZE
if
(
codecDrainAction
==
DRAIN_ACTION_REINITIALIZE
||
codecNeedsFlushWorkaround
||
codecNeedsFlushWorkaround
||
(
codecNeedsSosFlushWorkaround
&&
!
codecHasOutputMediaFormat
)
||
(
codecNeedsEosFlushWorkaround
&&
codecReceivedEos
))
{
||
(
codecNeedsEosFlushWorkaround
&&
codecReceivedEos
))
{
releaseCodec
();
releaseCodec
();
return
true
;
return
true
;
...
@@ -889,11 +892,13 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -889,11 +892,13 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
availableCodecInfos
=
null
;
availableCodecInfos
=
null
;
codecInfo
=
null
;
codecInfo
=
null
;
codecFormat
=
null
;
codecFormat
=
null
;
codecHasOutputMediaFormat
=
false
;
codecOperatingRate
=
CODEC_OPERATING_RATE_UNSET
;
codecOperatingRate
=
CODEC_OPERATING_RATE_UNSET
;
codecAdaptationWorkaroundMode
=
ADAPTATION_WORKAROUND_MODE_NEVER
;
codecAdaptationWorkaroundMode
=
ADAPTATION_WORKAROUND_MODE_NEVER
;
codecNeedsReconfigureWorkaround
=
false
;
codecNeedsReconfigureWorkaround
=
false
;
codecNeedsDiscardToSpsWorkaround
=
false
;
codecNeedsDiscardToSpsWorkaround
=
false
;
codecNeedsFlushWorkaround
=
false
;
codecNeedsFlushWorkaround
=
false
;
codecNeedsSosFlushWorkaround
=
false
;
codecNeedsEosFlushWorkaround
=
false
;
codecNeedsEosFlushWorkaround
=
false
;
codecNeedsEosOutputExceptionWorkaround
=
false
;
codecNeedsEosOutputExceptionWorkaround
=
false
;
codecNeedsMonoChannelCountWorkaround
=
false
;
codecNeedsMonoChannelCountWorkaround
=
false
;
...
@@ -1084,6 +1089,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1084,6 +1089,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
codecNeedsReconfigureWorkaround
=
codecNeedsReconfigureWorkaround
(
codecName
);
codecNeedsReconfigureWorkaround
=
codecNeedsReconfigureWorkaround
(
codecName
);
codecNeedsDiscardToSpsWorkaround
=
codecNeedsDiscardToSpsWorkaround
(
codecName
,
codecFormat
);
codecNeedsDiscardToSpsWorkaround
=
codecNeedsDiscardToSpsWorkaround
(
codecName
,
codecFormat
);
codecNeedsFlushWorkaround
=
codecNeedsFlushWorkaround
(
codecName
);
codecNeedsFlushWorkaround
=
codecNeedsFlushWorkaround
(
codecName
);
codecNeedsSosFlushWorkaround
=
codecNeedsSosFlushWorkaround
(
codecName
);
codecNeedsEosFlushWorkaround
=
codecNeedsEosFlushWorkaround
(
codecName
);
codecNeedsEosFlushWorkaround
=
codecNeedsEosFlushWorkaround
(
codecName
);
codecNeedsEosOutputExceptionWorkaround
=
codecNeedsEosOutputExceptionWorkaround
(
codecName
);
codecNeedsEosOutputExceptionWorkaround
=
codecNeedsEosOutputExceptionWorkaround
(
codecName
);
codecNeedsMonoChannelCountWorkaround
=
codecNeedsMonoChannelCountWorkaround
=
...
@@ -1738,6 +1744,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1738,6 +1744,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
/** Processes a new output {@link MediaFormat}. */
/** Processes a new output {@link MediaFormat}. */
private
void
processOutputMediaFormat
()
throws
ExoPlaybackException
{
private
void
processOutputMediaFormat
()
throws
ExoPlaybackException
{
codecHasOutputMediaFormat
=
true
;
MediaFormat
mediaFormat
=
codecAdapter
.
getOutputFormat
();
MediaFormat
mediaFormat
=
codecAdapter
.
getOutputFormat
();
if
(
codecAdaptationWorkaroundMode
!=
ADAPTATION_WORKAROUND_MODE_NEVER
if
(
codecAdaptationWorkaroundMode
!=
ADAPTATION_WORKAROUND_MODE_NEVER
&&
mediaFormat
.
getInteger
(
MediaFormat
.
KEY_WIDTH
)
==
ADAPTATION_WORKAROUND_SLICE_WIDTH_HEIGHT
&&
mediaFormat
.
getInteger
(
MediaFormat
.
KEY_WIDTH
)
==
ADAPTATION_WORKAROUND_SLICE_WIDTH_HEIGHT
...
@@ -2139,4 +2146,21 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -2139,4 +2146,21 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
return
Util
.
SDK_INT
<=
18
&&
format
.
channelCount
==
1
return
Util
.
SDK_INT
<=
18
&&
format
.
channelCount
==
1
&&
"OMX.MTK.AUDIO.DECODER.MP3"
.
equals
(
name
);
&&
"OMX.MTK.AUDIO.DECODER.MP3"
.
equals
(
name
);
}
}
/**
* Returns whether the decoder is known to behave incorrectly if flushed prior to having output a
* {@link MediaFormat}.
*
* <p>If true is returned, the renderer will work around the issue by instantiating a new decoder
* when this case occurs.
*
* <p>See [Internal: b/141097367].
*
* @param name The name of the decoder.
* @return True if the decoder is known to behave incorrectly if flushed prior to having output a
* {@link MediaFormat}. False otherwise.
*/
private
static
boolean
codecNeedsSosFlushWorkaround
(
String
name
)
{
return
Util
.
SDK_INT
==
29
&&
"c2.android.aac.decoder"
.
equals
(
name
);
}
}
}
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