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
8c9b92ef
authored
Nov 25, 2020
by
samrobinson
Committed by
Andrew Lewis
Nov 27, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add Format field to AudioSink.InitializationException
#exofixit PiperOrigin-RevId: 344232362
parent
ee36e648
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DecoderAudioRenderer.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/audio/AudioSink.java
View file @
8c9b92ef
...
...
@@ -167,11 +167,18 @@ public interface AudioSink {
public
final
int
audioTrackState
;
/** If the exception can be recovered by recreating the sink. */
public
final
boolean
isRecoverable
;
/** The input {@link Format} of the sink when the error occurs. */
public
final
Format
format
;
/**
* Creates a new instance.
*
* @param audioTrackState The underlying {@link AudioTrack}'s state.
* @param sampleRate The requested sample rate in Hz.
* @param channelConfig The requested channel configuration.
* @param bufferSize The requested buffer size in bytes.
* @param format The input format of the sink when the error occurs.
* @param isRecoverable Whether the exception can be recovered by recreating the sink.
* @param audioTrackException Exception thrown during the creation of the {@link AudioTrack}.
*/
public
InitializationException
(
...
...
@@ -179,6 +186,7 @@ public interface AudioSink {
int
sampleRate
,
int
channelConfig
,
int
bufferSize
,
Format
format
,
boolean
isRecoverable
,
@Nullable
Exception
audioTrackException
)
{
super
(
...
...
@@ -190,8 +198,8 @@ public interface AudioSink {
audioTrackException
);
this
.
audioTrackState
=
audioTrackState
;
this
.
isRecoverable
=
isRecoverable
;
this
.
format
=
format
;
}
}
/** Thrown when a failure occurs writing to the sink. */
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DecoderAudioRenderer.java
View file @
8c9b92ef
...
...
@@ -305,7 +305,7 @@ public abstract class DecoderAudioRenderer<
}
catch
(
AudioSink
.
ConfigurationException
e
)
{
throw
createRendererException
(
e
,
e
.
format
);
}
catch
(
AudioSink
.
InitializationException
e
)
{
throw
createRendererException
(
e
,
inputF
ormat
,
e
.
isRecoverable
);
throw
createRendererException
(
e
,
e
.
f
ormat
,
e
.
isRecoverable
);
}
catch
(
AudioSink
.
WriteException
e
)
{
throw
createRendererException
(
e
,
inputFormat
,
e
.
isRecoverable
);
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
8c9b92ef
...
...
@@ -1960,6 +1960,7 @@ public final class DefaultAudioSink implements AudioSink {
outputSampleRate
,
outputChannelConfig
,
bufferSize
,
inputFormat
,
/* isRecoverable= */
outputModeIsOffload
(),
e
);
}
...
...
@@ -1977,6 +1978,7 @@ public final class DefaultAudioSink implements AudioSink {
outputSampleRate
,
outputChannelConfig
,
bufferSize
,
inputFormat
,
/* isRecoverable= */
outputModeIsOffload
(),
/* audioTrackException= */
null
);
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
View file @
8c9b92ef
...
...
@@ -608,7 +608,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
try
{
fullyConsumed
=
audioSink
.
handleBuffer
(
buffer
,
bufferPresentationTimeUs
,
sampleCount
);
}
catch
(
InitializationException
e
)
{
throw
createRendererException
(
e
,
format
,
e
.
isRecoverable
);
throw
createRendererException
(
e
,
e
.
format
,
e
.
isRecoverable
);
}
catch
(
WriteException
e
)
{
throw
createRendererException
(
e
,
format
,
e
.
isRecoverable
);
}
...
...
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