Fix WrongConstant lint failure for IamfDecoder#OUTPUT_PCM_ENCODING

To avoid `WrongConstant` failures with methods that expect
`C.@PcmEncoding`, `OUTPUT_PCM_ENCODING` now points to the constant in
`C` instead of `AudioFormat`.

#cherrypick

PiperOrigin-RevId: 670251463
This commit is contained in:
ivanbuper 2024-09-02 10:17:35 -07:00 committed by Copybara-Service
parent 4562c781ed
commit ebb550a9f1
2 changed files with 4 additions and 1 deletions

View File

@ -33,7 +33,7 @@ import java.util.List;
public final class IamfDecoder
extends SimpleDecoder<DecoderInputBuffer, SimpleDecoderOutputBuffer, IamfDecoderException> {
/* package */ static final int OUTPUT_SAMPLE_RATE = 48000;
/* package */ static final int OUTPUT_PCM_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
/* package */ static final int OUTPUT_PCM_ENCODING = C.ENCODING_PCM_16BIT;
/* package */ static final int SPATIALIZED_OUTPUT_LAYOUT = AudioFormat.CHANNEL_OUT_5POINT1;
// Matches IAMF_SoundSystem in IAMF_defines.h

View File

@ -15,6 +15,7 @@
*/
package androidx.media3.decoder.iamf;
import android.annotation.SuppressLint;
import android.content.Context;
import android.media.AudioFormat;
import android.media.AudioManager;
@ -84,6 +85,8 @@ public class LibiamfAudioRenderer extends DecoderAudioRenderer<IamfDecoder> {
return "LibiamfAudioRenderer";
}
// IamfDecoder#OUTPUT_PCM_ENCODING indirectly points to AudioFormat#ENCODING_PCM_16BIT.
@SuppressLint("WrongConstant")
private boolean isSpatializationSupported() {
// Spatializer is only available on API 32 and above.
if (Util.SDK_INT < 32) {