Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6af0a24 authored by Phil Burk's avatar Phil Burk Committed by android-build-merger
Browse files

Merge "AudioFormat: implement ENCODING_IEC61937" into nyc-dev

am: af9aa07f

* commit 'af9aa07f':
  AudioFormat: implement ENCODING_IEC61937
parents b707ce78 af9aa07f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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

@@ -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:
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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 {
@@ -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 {
+2 −2
Original line number Diff line number Diff line
@@ -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;