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

Commit 8fc6d91d authored by Dhanalakshmi Siddani's avatar Dhanalakshmi Siddani
Browse files

Audio: Revert hal changes to block pcm_close during SSR

 pcm driver supports pcm_close during SSR, so reverted
 HAL code to block pcm session close during SSR.

 CRs-Fixed: 663477

Change-Id: I752e3f4f55288f91294e090b974ba1367c27122d
parent 723c4b74
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -836,11 +836,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;

@@ -1237,10 +1235,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,
@@ -1679,12 +1675,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);
        }
    }

@@ -1736,12 +1726,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);
    }

@@ -2097,12 +2086,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);
        }
    }

@@ -2136,13 +2119,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;
@@ -186,7 +180,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;
};
@@ -205,7 +198,6 @@ struct stream_in {
    bool enable_aec;
    bool enable_ns;
    audio_format_t format;
    int pcm_error_type;

    struct audio_device *dev;
};