Loading core/jni/android_media_AudioFormat.h +5 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #define ENCODING_AAC_LC 10 #define ENCODING_AAC_HE_V1 11 #define ENCODING_AAC_HE_V2 12 #define ENCODING_IEC61937 13 #define ENCODING_INVALID 0 #define ENCODING_DEFAULT 1 Loading Loading @@ -64,6 +65,8 @@ static inline audio_format_t audioFormatToNative(int audioFormat) return AUDIO_FORMAT_AAC_HE_V1; case ENCODING_AAC_HE_V2: return AUDIO_FORMAT_AAC_HE_V2; case ENCODING_IEC61937: return AUDIO_FORMAT_IEC61937; case ENCODING_DEFAULT: return AUDIO_FORMAT_DEFAULT; default: Loading Loading @@ -103,6 +106,8 @@ static inline int audioFormatFromNative(audio_format_t nativeFormat) return ENCODING_AAC_HE_V1; case AUDIO_FORMAT_AAC_HE_V2: return ENCODING_AAC_HE_V2; case AUDIO_FORMAT_IEC61937: return ENCODING_IEC61937; case AUDIO_FORMAT_DEFAULT: return ENCODING_DEFAULT; default: Loading core/jni/android_media_AudioTrack.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, // compute the frame count size_t frameCount; if (audio_is_linear_pcm(format)) { if (audio_has_proportional_frames(format)) { const size_t bytesPerSample = audio_bytes_per_sample(format); frameCount = buffSizeInBytes / (channelCount * bytesPerSample); } else { Loading Loading @@ -1008,7 +1008,7 @@ static jint android_media_AudioTrack_get_min_buff_size(JNIEnv *env, jobject thi return -1; } const audio_format_t format = audioFormatToNative(audioFormat); if (audio_is_linear_pcm(format)) { if (audio_has_proportional_frames(format)) { const size_t bytesPerSample = audio_bytes_per_sample(format); return frameCount * channelCount * bytesPerSample; } else { Loading media/java/android/media/AudioTrack.java +2 −2 Original line number Diff line number Diff line Loading @@ -885,10 +885,10 @@ public class AudioTrack implements AudioRouting // postcondition: // mNativeBufferSizeInBytes is valid (multiple of frame size, positive) private void audioBuffSizeCheck(int audioBufferSize) { // NB: this section is only valid with PCM data. // NB: this section is only valid with PCM or IEC61937 data. // To update when supporting compressed formats int frameSizeInBytes; if (AudioFormat.isEncodingLinearPcm(mAudioFormat)) { if (AudioFormat.isEncodingLinearFrames(mAudioFormat)) { frameSizeInBytes = mChannelCount * AudioFormat.getBytesPerSample(mAudioFormat); } else { frameSizeInBytes = 1; Loading Loading
core/jni/android_media_AudioFormat.h +5 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #define ENCODING_AAC_LC 10 #define ENCODING_AAC_HE_V1 11 #define ENCODING_AAC_HE_V2 12 #define ENCODING_IEC61937 13 #define ENCODING_INVALID 0 #define ENCODING_DEFAULT 1 Loading Loading @@ -64,6 +65,8 @@ static inline audio_format_t audioFormatToNative(int audioFormat) return AUDIO_FORMAT_AAC_HE_V1; case ENCODING_AAC_HE_V2: return AUDIO_FORMAT_AAC_HE_V2; case ENCODING_IEC61937: return AUDIO_FORMAT_IEC61937; case ENCODING_DEFAULT: return AUDIO_FORMAT_DEFAULT; default: Loading Loading @@ -103,6 +106,8 @@ static inline int audioFormatFromNative(audio_format_t nativeFormat) return ENCODING_AAC_HE_V1; case AUDIO_FORMAT_AAC_HE_V2: return ENCODING_AAC_HE_V2; case AUDIO_FORMAT_IEC61937: return ENCODING_IEC61937; case AUDIO_FORMAT_DEFAULT: return ENCODING_DEFAULT; default: Loading
core/jni/android_media_AudioTrack.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, // compute the frame count size_t frameCount; if (audio_is_linear_pcm(format)) { if (audio_has_proportional_frames(format)) { const size_t bytesPerSample = audio_bytes_per_sample(format); frameCount = buffSizeInBytes / (channelCount * bytesPerSample); } else { Loading Loading @@ -1008,7 +1008,7 @@ static jint android_media_AudioTrack_get_min_buff_size(JNIEnv *env, jobject thi return -1; } const audio_format_t format = audioFormatToNative(audioFormat); if (audio_is_linear_pcm(format)) { if (audio_has_proportional_frames(format)) { const size_t bytesPerSample = audio_bytes_per_sample(format); return frameCount * channelCount * bytesPerSample; } else { Loading
media/java/android/media/AudioTrack.java +2 −2 Original line number Diff line number Diff line Loading @@ -885,10 +885,10 @@ public class AudioTrack implements AudioRouting // postcondition: // mNativeBufferSizeInBytes is valid (multiple of frame size, positive) private void audioBuffSizeCheck(int audioBufferSize) { // NB: this section is only valid with PCM data. // NB: this section is only valid with PCM or IEC61937 data. // To update when supporting compressed formats int frameSizeInBytes; if (AudioFormat.isEncodingLinearPcm(mAudioFormat)) { if (AudioFormat.isEncodingLinearFrames(mAudioFormat)) { frameSizeInBytes = mChannelCount * AudioFormat.getBytesPerSample(mAudioFormat); } else { frameSizeInBytes = 1; Loading