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

Commit 6653a096 authored by Zhou Song's avatar Zhou Song
Browse files

hal: allow to get render position for non-offload use cases

For pcm voip use case which goes with direct output, render
position can be queried from HAL, while currently it is not
supported and always return with invalid status.

Return with written frames for pcm use cases when render
position queried from HAL.

CRs-Fixed: 828864

Change-Id: I5fec7f5fc1f61dc36cbeb41a4121c2c83f63b7f4
parent 0841437c
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -2170,9 +2170,13 @@ static int out_get_render_position(const struct audio_stream_out *stream,
                                   uint32_t *dsp_frames)
                                   uint32_t *dsp_frames)
{
{
    struct stream_out *out = (struct stream_out *)stream;
    struct stream_out *out = (struct stream_out *)stream;
    if (is_offload_usecase(out->usecase) && (dsp_frames != NULL)) {

        ssize_t ret = 0;
    if (dsp_frames == NULL)
        return -EINVAL;

    *dsp_frames = 0;
    *dsp_frames = 0;
    if (is_offload_usecase(out->usecase)) {
        ssize_t ret = 0;
        pthread_mutex_lock(&out->lock);
        pthread_mutex_lock(&out->lock);
        if (out->compr != NULL) {
        if (out->compr != NULL) {
            ret = compress_get_tstamp(out->compr, (unsigned long *)dsp_frames,
            ret = compress_get_tstamp(out->compr, (unsigned long *)dsp_frames,
@@ -2193,6 +2197,9 @@ static int out_get_render_position(const struct audio_stream_out *stream,
        } else {
        } else {
            return 0;
            return 0;
        }
        }
    } else if (audio_is_linear_pcm(out->format)) {
        *dsp_frames = out->written;
        return 0;
    } else
    } else
        return -EINVAL;
        return -EINVAL;
}
}