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

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

Merge "audio: Support for compress offload recovery"

parents d700078f 7e19fc11
Loading
Loading
Loading
Loading
+18 −2
Original line number Original line Diff line number Diff line
@@ -2024,6 +2024,7 @@ 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;
    struct audio_device *adev = out->dev;
    if (is_offload_usecase(out->usecase) && (dsp_frames != NULL)) {
    if (is_offload_usecase(out->usecase) && (dsp_frames != NULL)) {
        ssize_t ret = 0;
        ssize_t ret = 0;
        *dsp_frames = 0;
        *dsp_frames = 0;
@@ -2044,6 +2045,13 @@ static int out_get_render_position(const struct audio_stream_out *stream,
        } else if(ret < 0) {
        } else if(ret < 0) {
            ALOGE(" ERROR: Unable to get time stamp from compress driver");
            ALOGE(" ERROR: Unable to get time stamp from compress driver");
            return -EINVAL;
            return -EINVAL;
        } else if (get_snd_card_state(adev) == SND_CARD_STATE_OFFLINE){
            /*
             * Handle corner case where compress session is closed during SSR
             * and timestamp is queried
             */
            ALOGE(" ERROR: sound card not active, return error");
            return -EINVAL;
        } else {
        } else {
            return 0;
            return 0;
        }
        }
@@ -2080,12 +2088,20 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,


    if (is_offload_usecase(out->usecase)) {
    if (is_offload_usecase(out->usecase)) {
        if (out->compr != NULL) {
        if (out->compr != NULL) {
            compress_get_tstamp(out->compr, &dsp_frames,
            ret = compress_get_tstamp(out->compr, &dsp_frames,
                    &out->sample_rate);
                    &out->sample_rate);
            ALOGVV("%s rendered frames %ld sample_rate %d",
            ALOGVV("%s rendered frames %ld sample_rate %d",
                   __func__, dsp_frames, out->sample_rate);
                   __func__, dsp_frames, out->sample_rate);
            *frames = dsp_frames;
            *frames = dsp_frames;
            if (ret < 0)
                ret = -errno;
            if (-ENETRESET == ret) {
                ALOGE(" ERROR: sound card not active Unable to get time stamp from compress driver");
                set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
                ret = -EINVAL;
            } else
                ret = 0;
                ret = 0;

            /* this is the best we can do */
            /* this is the best we can do */
            clock_gettime(CLOCK_MONOTONIC, timestamp);
            clock_gettime(CLOCK_MONOTONIC, timestamp);
        }
        }