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

Commit 0f8c87bb authored by Ben Romberger's avatar Ben Romberger Committed by Gerrit - the friendly Code Review server
Browse files

hal: Allow only 48k, 96k, or 192k for TrueHD playback

TrueHD for compressed pass-through is only supported
for sample rates of 48k, 96, or 192k. Return an error
code for any other requested sample rates.

Change-Id: I9b917cee31f907fddbaa5ea755aad491ae55e3fc
parent 4aa38403
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4300,6 +4300,18 @@ int adev_open_output_stream(struct audio_hw_device *dev,
            goto error_open;
        }

        /* TrueHD only supported for 48k multiples (48k, 96k, 192k) */
        if ((config->offload_info.format == AUDIO_FORMAT_DOLBY_TRUEHD) &&
                (audio_extn_passthru_is_passthrough_stream(out)) &&
                !((config->sample_rate == 48000) ||
                  (config->sample_rate == 96000) ||
                  (config->sample_rate == 192000))) {
            ALOGE("%s: Unsupported sample rate %d for audio format %x",
                    __func__, config->sample_rate, config->offload_info.format);
            ret = -EINVAL;
            goto error_open;
        }

        out->compr_config.codec = (struct snd_codec *)
                                    calloc(1, sizeof(struct snd_codec));