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

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

Merge " Audio: Revert hal changes to block pcm_close during SSR"

parents 5a688d0a 8fc6d91d
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -842,11 +842,9 @@ int start_input_stream(struct stream_in *in)
        pcm_close(in->pcm);
        in->pcm = NULL;
        ret = -EIO;
        in->pcm_error_type = PCM_ERROR_EIO;
        goto error_open;
    }

    in->pcm_error_type = PCM_ERROR_NONE;
    ALOGV("%s: exit", __func__);
    return ret;

@@ -1243,10 +1241,8 @@ int start_output_stream(struct stream_out *out)
            pcm_close(out->pcm);
            out->pcm = NULL;
            ret = -EIO;
            out->pcm_error_type = PCM_ERROR_EIO;
            goto error_open;
        }
        out->pcm_error_type = PCM_ERROR_NONE;
    } else {
        out->pcm = NULL;
        out->compr = compress_open(adev->snd_card,
@@ -1684,12 +1680,6 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
            ALOGD(" %s: sound card is not active/SSR state", __func__);
            ret= -ENETRESET;
            goto exit;
        } else if (PCM_ERROR_ENETRESET ==  out->pcm_error_type) {
            ALOGD(" %s restarting pcm session on post SSR", __func__);
            out->standby = false;
            pthread_mutex_unlock(&out->lock);
            out_standby(&out->stream.common);
            pthread_mutex_lock(&out->lock);
        }
    }

@@ -1741,12 +1731,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
    }

exit:

    /* ToDo: There may be a corner case when SSR happens back to back during
       start/stop. Need to post different error to handle that. */
    if (-ENETRESET == ret) {
        pthread_mutex_lock(&adev->snd_card_status.lock);
        adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
        out->pcm_error_type = PCM_ERROR_ENETRESET;
        out->standby = true; /*standby will be called on post SSR */
        pthread_mutex_unlock(&adev->snd_card_status.lock);
    }

@@ -2102,12 +2091,6 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
            ALOGD(" %s: sound card is not active/SSR state", __func__);
            ret= -ENETRESET;
            goto exit;
        } else if (PCM_ERROR_ENETRESET ==  in->pcm_error_type) {
            ALOGD(" %s restarting pcm session on post SSR", __func__);
            in->standby = false;
            pthread_mutex_unlock(&in->lock);
            in_standby(&in->stream.common);
            pthread_mutex_lock(&in->lock);
        }
    }

@@ -2141,13 +2124,12 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
        memset(buffer, 0, bytes);

exit:

    /* ToDo: There may be a corner case when SSR happens back to back during
        start/stop. Need to post different error to handle that. */
    if (-ENETRESET == ret) {
        pthread_mutex_lock(&adev->snd_card_status.lock);
        adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
        in->pcm_error_type = PCM_ERROR_ENETRESET;
        memset(buffer, 0, bytes);
        in->standby = true; /*standby will be called on post SSR */
        pthread_mutex_unlock(&adev->snd_card_status.lock);
    }
    pthread_mutex_unlock(&in->lock);
+0 −8
Original line number Diff line number Diff line
@@ -140,12 +140,6 @@ enum {
    OFFLOAD_STATE_PAUSED,
};

enum {
    PCM_ERROR_NONE,
    PCM_ERROR_EIO,
    PCM_ERROR_ENETRESET,  /* For SSR */
};

struct offload_cmd {
    struct listnode node;
    int cmd;
@@ -193,7 +187,6 @@ struct stream_out {
    void *offload_cookie;
    struct compr_gapless_mdata gapless_mdata;
    int send_new_metadata;
    int pcm_error_type;

    struct audio_device *dev;
};
@@ -212,7 +205,6 @@ struct stream_in {
    bool enable_aec;
    bool enable_ns;
    audio_format_t format;
    int pcm_error_type;

    struct audio_device *dev;
};