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

Commit 9395b74a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: Add support for secure dolby playback"

parents 36f0eeb1 85819454
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -107,6 +107,16 @@ struct rtic_event {
    uint8_t payload[0];
};

bool audio_extn_ip_hdlr_intf_supported(audio_format_t format)
{
    if ((format & AUDIO_FORMAT_MAIN_MASK == AUDIO_FORMAT_AC3) ||
        (format & AUDIO_FORMAT_MAIN_MASK == AUDIO_FORMAT_E_AC3) ||
        (format & AUDIO_FORMAT_MAIN_MASK == AUDIO_FORMAT_DOLBY_TRUEHD))
        return true;
    else
        return false;
}

int audio_extn_ip_hdlr_intf_event(void *stream_handle, void *payload, void *ip_hdlr_handle)
{
    ALOGVV("%s:[%d] handle = %p",__func__, ip_hdlr->ref_cnt, ip_hdlr_handle);
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ int audio_extn_ip_hdlr_intf_open(void *handle, bool is_dsp_decode, void *aud_ses
int audio_extn_ip_hdlr_intf_close(void *handle, bool is_dsp_decode, void *aud_sess_handle);
int audio_extn_ip_hdlr_intf_init(void **handle, char *lib_path, void **lib_handle);
int audio_extn_ip_hdlr_intf_deinit(void *handle);
bool audio_extn_ip_hdlr_intf_supported(audio_format_t format);

#else

@@ -43,6 +44,7 @@ int audio_extn_ip_hdlr_intf_deinit(void *handle);
#define audio_extn_ip_hdlr_intf_close(handle, is_dsp_decode, aud_sess_handle) (0)
#define audio_extn_ip_hdlr_intf_init(handle, lib_path, lib_handle)            (0)
#define audio_extn_ip_hdlr_intf_deinit(handle)                                (0)
#define audio_extn_ip_hdlr_intf_supported(format)                             (0)

#endif

+26 −1
Original line number Diff line number Diff line
@@ -2215,6 +2215,12 @@ static int stop_output_stream(struct stream_out *out)
    if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)
        audio_extn_keep_alive_start();

    if (audio_extn_ip_hdlr_intf_supported(out->format) && out->ip_hdlr_handle) {
        ret = audio_extn_ip_hdlr_intf_close(out->ip_hdlr_handle, true, out);
        if (ret < 0)
            ALOGE("%s: audio_extn_ip_hdlr_intf_close failed %d",__func__, ret);
    }

    ALOGV("%s: exit: status(%d)", __func__, ret);
    return ret;
}
@@ -2424,6 +2430,12 @@ int start_output_stream(struct stream_out *out)
    audio_extn_perf_lock_release(&adev->perf_lock_handle);
    ALOGD("%s: exit", __func__);

    if (audio_extn_ip_hdlr_intf_supported(out->format) && out->ip_hdlr_handle) {
        ret = audio_extn_ip_hdlr_intf_open(out->ip_hdlr_handle, true, out);
        if (ret < 0)
            ALOGE("%s: audio_extn_ip_hdlr_intf_open failed %d",__func__, ret);
    }

    return ret;
error_open:
    audio_extn_perf_lock_release(&adev->perf_lock_handle);
@@ -4402,7 +4414,8 @@ int adev_open_output_stream(struct audio_hw_device *dev,
                                             popcount(out->channel_mask), out->playback_started);
    /* setup a channel for client <--> adsp communication for stream events */
    if ((out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) ||
            (out->flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM)) {
            (out->flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) ||
            (audio_extn_ip_hdlr_intf_supported(config->format))) {
        hdlr_stream_cfg.pcm_device_id = platform_get_pcm_device_id(
                out->usecase, PCM_PLAYBACK);
        hdlr_stream_cfg.flags = out->flags;
@@ -4414,6 +4427,13 @@ int adev_open_output_stream(struct audio_hw_device *dev,
            out->adsp_hdlr_stream_handle = NULL;
        }
    }
    if (audio_extn_ip_hdlr_intf_supported(config->format)) {
        ret = audio_extn_ip_hdlr_intf_init(&out->ip_hdlr_handle, NULL, NULL);
        if (ret < 0) {
            ALOGE("%s: audio_extn_ip_hdlr_intf_init failed %d",__func__, ret);
            out->ip_hdlr_handle = NULL;
        }
    }
    ALOGV("%s: exit", __func__);
    return 0;

@@ -4443,6 +4463,11 @@ void adev_close_output_stream(struct audio_hw_device *dev __unused,
        out->adsp_hdlr_stream_handle = NULL;
    }

    if (audio_extn_ip_hdlr_intf_supported(out->format) && out->ip_hdlr_handle) {
        audio_extn_ip_hdlr_intf_deinit(out->ip_hdlr_handle);
        out->ip_hdlr_handle = NULL;
    }

    if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
        pthread_mutex_lock(&adev->lock);
        ret = voice_extn_compress_voip_close_output_stream(&stream->common);
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ struct stream_out {
    bool offload_thread_blocked;

    void *adsp_hdlr_stream_handle;
    void *ip_hdlr_handle;

    stream_callback_t client_callback;
    void *client_cookie;