Merge "Add bit-perfect mixer behavior."
This commit is contained in:
committed by
Android (Google) Code Review
commit
bbad0926ee
@@ -20825,6 +20825,7 @@ package android.media {
|
||||
method public int getMixerBehavior();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioMixerAttributes> CREATOR;
|
||||
field public static final int MIXER_BEHAVIOR_BIT_PERFECT = 1; // 0x1
|
||||
field public static final int MIXER_BEHAVIOR_DEFAULT = 0; // 0x0
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
// Keep sync with AudioMixerAttributes.java
|
||||
#define MIXER_BEHAVIOR_DEFAULT 0
|
||||
#define MIXER_BEHAVIOR_BIT_PERFECT 1
|
||||
// Invalid value is not added in JAVA API, but keep sync with native value
|
||||
#define MIXER_BEHAVIOR_INVALID -1
|
||||
|
||||
@@ -28,6 +29,8 @@ static inline audio_mixer_behavior_t audioMixerBehaviorToNative(int mixerBehavio
|
||||
switch (mixerBehavior) {
|
||||
case MIXER_BEHAVIOR_DEFAULT:
|
||||
return AUDIO_MIXER_BEHAVIOR_DEFAULT;
|
||||
case MIXER_BEHAVIOR_BIT_PERFECT:
|
||||
return AUDIO_MIXER_BEHAVIOR_BIT_PERFECT;
|
||||
default:
|
||||
return AUDIO_MIXER_BEHAVIOR_INVALID;
|
||||
}
|
||||
@@ -37,6 +40,8 @@ static inline jint audioMixerBehaviorFromNative(audio_mixer_behavior_t mixerBeha
|
||||
switch (mixerBehavior) {
|
||||
case AUDIO_MIXER_BEHAVIOR_DEFAULT:
|
||||
return MIXER_BEHAVIOR_DEFAULT;
|
||||
case AUDIO_MIXER_BEHAVIOR_BIT_PERFECT:
|
||||
return MIXER_BEHAVIOR_BIT_PERFECT;
|
||||
case AUDIO_MIXER_BEHAVIOR_INVALID:
|
||||
default:
|
||||
return MIXER_BEHAVIOR_INVALID;
|
||||
|
||||
@@ -37,10 +37,17 @@ public final class AudioMixerAttributes implements Parcelable {
|
||||
*/
|
||||
public static final int MIXER_BEHAVIOR_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* Constant indicating the audio mixer behavior is bit-perfect, which indicates there will
|
||||
* not be mixing happen, the audio data will be sent as is down to the HAL.
|
||||
*/
|
||||
public static final int MIXER_BEHAVIOR_BIT_PERFECT = 1;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(flag = false, prefix = "MIXER_BEHAVIOR_", value = {
|
||||
MIXER_BEHAVIOR_DEFAULT }
|
||||
)
|
||||
MIXER_BEHAVIOR_DEFAULT,
|
||||
MIXER_BEHAVIOR_BIT_PERFECT
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface MixerBehavior {}
|
||||
|
||||
@@ -103,12 +110,14 @@ public final class AudioMixerAttributes implements Parcelable {
|
||||
|
||||
/**
|
||||
* Sets the mixer behavior for the audio mixer
|
||||
* @param mixerBehavior must be {@link #MIXER_BEHAVIOR_DEFAULT}.
|
||||
* @param mixerBehavior must be {@link #MIXER_BEHAVIOR_DEFAULT} or
|
||||
* {@link #MIXER_BEHAVIOR_BIT_PERFECT}.
|
||||
* @return the same Builder instance.
|
||||
*/
|
||||
public @NonNull Builder setMixerBehavior(@MixerBehavior int mixerBehavior) {
|
||||
switch (mixerBehavior) {
|
||||
case MIXER_BEHAVIOR_DEFAULT:
|
||||
case MIXER_BEHAVIOR_BIT_PERFECT:
|
||||
mMixerBehavior = mixerBehavior;
|
||||
break;
|
||||
default:
|
||||
@@ -137,6 +146,8 @@ public final class AudioMixerAttributes implements Parcelable {
|
||||
switch (mixerBehavior) {
|
||||
case MIXER_BEHAVIOR_DEFAULT:
|
||||
return "default";
|
||||
case MIXER_BEHAVIOR_BIT_PERFECT:
|
||||
return "bit-perfect";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user