mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix the parameter passed to AudioSink.InitializationException
We used to pass `audioTrackConfig.encoding` as the `bufferSize` parameter to `AudioSink.InitializationException`, for which this CL is supposed to correct. But `encoding` is a useful information for logging anyway, thus an `encoding` parameter is also added to `AudioSink.InitializationException` constructor, so now we pass both `encoding` and `bufferSize` parameters. PiperOrigin-RevId: 745534997
This commit is contained in:
parent
eae886fe28
commit
71fb3ad5a5
@ -263,6 +263,7 @@ public interface AudioSink {
|
|||||||
* @param audioTrackState The underlying {@link AudioTrack}'s state.
|
* @param audioTrackState The underlying {@link AudioTrack}'s state.
|
||||||
* @param sampleRate The requested sample rate in Hz.
|
* @param sampleRate The requested sample rate in Hz.
|
||||||
* @param channelConfig The requested channel configuration.
|
* @param channelConfig The requested channel configuration.
|
||||||
|
* @param encoding The requested encoding.
|
||||||
* @param bufferSize The requested buffer size in bytes.
|
* @param bufferSize The requested buffer size in bytes.
|
||||||
* @param format The input format of the sink when the error occurs.
|
* @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 isRecoverable Whether the exception can be recovered by recreating the sink.
|
||||||
@ -272,6 +273,7 @@ public interface AudioSink {
|
|||||||
int audioTrackState,
|
int audioTrackState,
|
||||||
int sampleRate,
|
int sampleRate,
|
||||||
int channelConfig,
|
int channelConfig,
|
||||||
|
int encoding,
|
||||||
int bufferSize,
|
int bufferSize,
|
||||||
Format format,
|
Format format,
|
||||||
boolean isRecoverable,
|
boolean isRecoverable,
|
||||||
@ -280,7 +282,15 @@ public interface AudioSink {
|
|||||||
"AudioTrack init failed "
|
"AudioTrack init failed "
|
||||||
+ audioTrackState
|
+ audioTrackState
|
||||||
+ " "
|
+ " "
|
||||||
+ ("Config(" + sampleRate + ", " + channelConfig + ", " + bufferSize + ")")
|
+ ("Config("
|
||||||
|
+ sampleRate
|
||||||
|
+ ", "
|
||||||
|
+ channelConfig
|
||||||
|
+ ", "
|
||||||
|
+ encoding
|
||||||
|
+ ", "
|
||||||
|
+ bufferSize
|
||||||
|
+ ")")
|
||||||
+ " "
|
+ " "
|
||||||
+ format
|
+ format
|
||||||
+ (isRecoverable ? " (recoverable)" : ""),
|
+ (isRecoverable ? " (recoverable)" : ""),
|
||||||
|
@ -1118,6 +1118,7 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
audioTrackConfig.sampleRate,
|
audioTrackConfig.sampleRate,
|
||||||
audioTrackConfig.channelConfig,
|
audioTrackConfig.channelConfig,
|
||||||
audioTrackConfig.encoding,
|
audioTrackConfig.encoding,
|
||||||
|
audioTrackConfig.bufferSize,
|
||||||
inputFormat,
|
inputFormat,
|
||||||
/* isRecoverable= */ audioTrackConfig.offload,
|
/* isRecoverable= */ audioTrackConfig.offload,
|
||||||
e);
|
e);
|
||||||
@ -1136,6 +1137,7 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
audioTrackConfig.sampleRate,
|
audioTrackConfig.sampleRate,
|
||||||
audioTrackConfig.channelConfig,
|
audioTrackConfig.channelConfig,
|
||||||
audioTrackConfig.encoding,
|
audioTrackConfig.encoding,
|
||||||
|
audioTrackConfig.bufferSize,
|
||||||
inputFormat,
|
inputFormat,
|
||||||
/* isRecoverable= */ audioTrackConfig.offload,
|
/* isRecoverable= */ audioTrackConfig.offload,
|
||||||
/* audioTrackException= */ null);
|
/* audioTrackException= */ null);
|
||||||
|
@ -334,6 +334,7 @@ public class EndToEndOffloadFailureRecoveryTest {
|
|||||||
AudioTrack.STATE_UNINITIALIZED,
|
AudioTrack.STATE_UNINITIALIZED,
|
||||||
/* sampleRate= */ 48_000,
|
/* sampleRate= */ 48_000,
|
||||||
/* channelConfig= */ 0,
|
/* channelConfig= */ 0,
|
||||||
|
/* encoding= */ Format.NO_VALUE,
|
||||||
/* bufferSize= */ C.LENGTH_UNSET,
|
/* bufferSize= */ C.LENGTH_UNSET,
|
||||||
inputFormat,
|
inputFormat,
|
||||||
/* isRecoverable= */ true,
|
/* isRecoverable= */ true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user