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

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

Merge "hal: update input source type during open input stream"

parents 32ad5963 cbf88545
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -3327,7 +3327,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
                                  struct audio_stream_in **stream_in,
                                  audio_input_flags_t flags __unused,
                                  const char *address __unused,
                                  audio_source_t source __unused)
                                  audio_source_t source)
{
    struct audio_device *adev = (struct audio_device *)dev;
    struct stream_in *in;
@@ -3347,8 +3347,8 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
    }

    ALOGD("%s: enter: sample_rate(%d) channel_mask(%#x) devices(%#x)\
        stream_handle(%p) io_handle(%d)",__func__, config->sample_rate, config->channel_mask,
        devices, &in->stream, handle);
        stream_handle(%p) io_handle(%d) source(%d)",__func__, config->sample_rate, config->channel_mask,
        devices, &in->stream, handle, source);

    pthread_mutex_init(&in->lock, (const pthread_mutexattr_t *) NULL);

@@ -3369,7 +3369,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
    in->stream.get_input_frames_lost = in_get_input_frames_lost;

    in->device = devices;
    in->source = AUDIO_SOURCE_DEFAULT;
    in->source = source;
    in->dev = adev;
    in->standby = 1;
    in->channel_mask = config->channel_mask;
@@ -3435,6 +3435,13 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
                                            channel_count,
                                            is_low_latency);
        in->config.period_size = buffer_size / frame_size;
        if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) &&
               (in->dev->mode == AUDIO_MODE_IN_COMMUNICATION) &&
               (voice_extn_compress_voip_is_format_supported(in->format)) &&
               (in->config.rate == 8000 || in->config.rate == 16000) &&
               (audio_channel_count_from_in_mask(in->channel_mask) == 1)) {
            voice_extn_compress_voip_open_input_stream(in);
        }
    }

    /* This stream could be for sound trigger lab,
+4 −1
Original line number Diff line number Diff line
@@ -697,6 +697,10 @@ int voice_extn_compress_voip_open_input_stream(struct stream_in *in)
        voip_data.sample_rate = in->config.rate;
    }

    ret = voip_set_mode(in->dev, in->format);
    if (ret < 0)
        goto done;

    in->usecase = USECASE_COMPRESS_VOIP_CALL;
    if (in->config.rate == 16000)
        in->config = pcm_config_voip_wb;
@@ -704,7 +708,6 @@ int voice_extn_compress_voip_open_input_stream(struct stream_in *in)
        in->config = pcm_config_voip_nb;

    voip_data.in_stream_count++;
    ret = voip_set_mode(in->dev, in->format);

done:
    ALOGV("%s: exit, ret=%d", __func__, ret);