mirror of
https://github.com/androidx/media.git
synced 2025-04-29 22:36:54 +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 sampleRate The requested sample rate in Hz.
|
||||
* @param channelConfig The requested channel configuration.
|
||||
* @param encoding The requested encoding.
|
||||
* @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.
|
||||
@ -272,6 +273,7 @@ public interface AudioSink {
|
||||
int audioTrackState,
|
||||
int sampleRate,
|
||||
int channelConfig,
|
||||
int encoding,
|
||||
int bufferSize,
|
||||
Format format,
|
||||
boolean isRecoverable,
|
||||
@ -280,7 +282,15 @@ public interface AudioSink {
|
||||
"AudioTrack init failed "
|
||||
+ audioTrackState
|
||||
+ " "
|
||||
+ ("Config(" + sampleRate + ", " + channelConfig + ", " + bufferSize + ")")
|
||||
+ ("Config("
|
||||
+ sampleRate
|
||||
+ ", "
|
||||
+ channelConfig
|
||||
+ ", "
|
||||
+ encoding
|
||||
+ ", "
|
||||
+ bufferSize
|
||||
+ ")")
|
||||
+ " "
|
||||
+ format
|
||||
+ (isRecoverable ? " (recoverable)" : ""),
|
||||
|
@ -1118,6 +1118,7 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
audioTrackConfig.sampleRate,
|
||||
audioTrackConfig.channelConfig,
|
||||
audioTrackConfig.encoding,
|
||||
audioTrackConfig.bufferSize,
|
||||
inputFormat,
|
||||
/* isRecoverable= */ audioTrackConfig.offload,
|
||||
e);
|
||||
@ -1136,6 +1137,7 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
audioTrackConfig.sampleRate,
|
||||
audioTrackConfig.channelConfig,
|
||||
audioTrackConfig.encoding,
|
||||
audioTrackConfig.bufferSize,
|
||||
inputFormat,
|
||||
/* isRecoverable= */ audioTrackConfig.offload,
|
||||
/* audioTrackException= */ null);
|
||||
|
@ -334,6 +334,7 @@ public class EndToEndOffloadFailureRecoveryTest {
|
||||
AudioTrack.STATE_UNINITIALIZED,
|
||||
/* sampleRate= */ 48_000,
|
||||
/* channelConfig= */ 0,
|
||||
/* encoding= */ Format.NO_VALUE,
|
||||
/* bufferSize= */ C.LENGTH_UNSET,
|
||||
inputFormat,
|
||||
/* isRecoverable= */ true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user