diff options
author | Andy Hung <hunga@google.com> | 2021-02-26 15:42:29 -0800 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2021-03-01 21:53:22 -0800 |
commit | 6bb7c589b26079b98f59965b88455d828154a3d6 (patch) | |
tree | 80e7070220a59dce917215e24bdb93727f55c85c /media/java | |
parent | 32a606fe54a3377ffe22142d3c7e04f4ab969281 (diff) |
AudioTrack: Add TunerConfiguration.CONTENT_ID_NONE
Test: atest AudioTrackTest#testTunerConfiguration
Bug: 181354677
Merged-In: I679c809ee8834c5a608243c353bc3a76ec55243c
Change-Id: I679c809ee8834c5a608243c353bc3a76ec55243c
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/AudioTrack.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index d7ef4549ca3f..1b05c3b57256 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -922,12 +922,21 @@ public class AudioTrack extends PlayerBase private final int mSyncId; /** + * A special content id for {@link #TunerConfiguration(int, int)} + * indicating audio is delivered + * from an {@code AudioTrack} write, not tunneled from the tuner stack. + */ + public static final int CONTENT_ID_NONE = 0; + + /** * Constructs a TunerConfiguration instance for use in {@link AudioTrack.Builder} * * @param contentId selects the audio stream to use. * The contentId may be obtained from - * {@link android.media.tv.tuner.filter.Filter#getId()}. - * This is always a positive number. + * {@link android.media.tv.tuner.filter.Filter#getId()}, + * such obtained id is always a positive number. + * If audio is to be delivered through an {@code AudioTrack} write + * then {@code CONTENT_ID_NONE} may be used. * @param syncId selects the clock to use for synchronization * of audio with other streams such as video. * The syncId may be obtained from @@ -936,10 +945,10 @@ public class AudioTrack extends PlayerBase */ @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public TunerConfiguration( - @IntRange(from = 1) int contentId, @IntRange(from = 1)int syncId) { - if (contentId < 1) { + @IntRange(from = 0) int contentId, @IntRange(from = 1)int syncId) { + if (contentId < 0) { throw new IllegalArgumentException( - "contentId " + contentId + " must be positive"); + "contentId " + contentId + " must be positive or CONTENT_ID_NONE"); } if (syncId < 1) { throw new IllegalArgumentException("syncId " + syncId + " must be positive"); |