Merge "AudioFormat: Retrieve sample rate capability from framework" am: ba32f57428
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1700287 Change-Id: I35be9d48f84dea6d8a9cb356873ea30725288ebf
This commit is contained in:
@@ -2277,6 +2277,15 @@ static jint android_media_AudioSystem_getMaxChannelCount(JNIEnv *env, jobject th
|
|||||||
return FCC_8;
|
return FCC_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jint android_media_AudioSystem_getMaxSampleRate(JNIEnv *env, jobject thiz) {
|
||||||
|
// see frameworks/av/services/audiopolicy/common/include/policy.h
|
||||||
|
return 192000; // SAMPLE_RATE_HZ_MAX (for API)
|
||||||
|
}
|
||||||
|
|
||||||
|
static jint android_media_AudioSystem_getMinSampleRate(JNIEnv *env, jobject thiz) {
|
||||||
|
return 4000; // SAMPLE_RATE_HZ_MIN (for API)
|
||||||
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
android_media_AudioSystem_setAssistantUid(JNIEnv *env, jobject thiz, jint uid)
|
android_media_AudioSystem_setAssistantUid(JNIEnv *env, jobject thiz, jint uid)
|
||||||
{
|
{
|
||||||
@@ -2674,6 +2683,8 @@ static const JNINativeMethod gEventHandlerMethods[] = {
|
|||||||
|
|
||||||
static const JNINativeMethod gFrameworkCapabilities[] = {
|
static const JNINativeMethod gFrameworkCapabilities[] = {
|
||||||
{"native_getMaxChannelCount", "()I", (void *)android_media_AudioSystem_getMaxChannelCount},
|
{"native_getMaxChannelCount", "()I", (void *)android_media_AudioSystem_getMaxChannelCount},
|
||||||
|
{"native_getMaxSampleRate", "()I", (void *)android_media_AudioSystem_getMaxSampleRate},
|
||||||
|
{"native_getMinSampleRate", "()I", (void *)android_media_AudioSystem_getMinSampleRate},
|
||||||
};
|
};
|
||||||
|
|
||||||
int register_android_media_AudioSystem(JNIEnv *env)
|
int register_android_media_AudioSystem(JNIEnv *env)
|
||||||
|
|||||||
@@ -518,13 +518,13 @@ public final class AudioFormat implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
// never unhide
|
// never unhide
|
||||||
public static final int SAMPLE_RATE_HZ_MIN = 4000;
|
public static final int SAMPLE_RATE_HZ_MIN = AudioSystem.SAMPLE_RATE_HZ_MIN;
|
||||||
/** Maximum value for sample rate,
|
/** Maximum value for sample rate,
|
||||||
* assuming AudioTrack and AudioRecord share the same limitations.
|
* assuming AudioTrack and AudioRecord share the same limitations.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
// never unhide
|
// never unhide
|
||||||
public static final int SAMPLE_RATE_HZ_MAX = 192000;
|
public static final int SAMPLE_RATE_HZ_MAX = AudioSystem.SAMPLE_RATE_HZ_MAX;
|
||||||
/** Sample rate will be a route-dependent value.
|
/** Sample rate will be a route-dependent value.
|
||||||
* For AudioTrack, it is usually the sink sample rate,
|
* For AudioTrack, it is usually the sink sample rate,
|
||||||
* and for AudioRecord it is usually the source sample rate.
|
* and for AudioRecord it is usually the source sample rate.
|
||||||
|
|||||||
@@ -115,6 +115,18 @@ public class AudioSystem
|
|||||||
public static final int OUT_CHANNEL_COUNT_MAX = native_getMaxChannelCount();
|
public static final int OUT_CHANNEL_COUNT_MAX = native_getMaxChannelCount();
|
||||||
private static native int native_getMaxChannelCount();
|
private static native int native_getMaxChannelCount();
|
||||||
|
|
||||||
|
/** Maximum value for sample rate, used by AudioFormat.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int SAMPLE_RATE_HZ_MAX = native_getMaxSampleRate();
|
||||||
|
private static native int native_getMaxSampleRate();
|
||||||
|
|
||||||
|
/** Minimum value for sample rate, used by AudioFormat.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int SAMPLE_RATE_HZ_MIN = native_getMinSampleRate();
|
||||||
|
private static native int native_getMinSampleRate();
|
||||||
|
|
||||||
// Expose only the getter method publicly so we can change it in the future
|
// Expose only the getter method publicly so we can change it in the future
|
||||||
private static final int NUM_STREAM_TYPES = 12;
|
private static final int NUM_STREAM_TYPES = 12;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user