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

Commit e4514fad authored by Sidipotu Ashok's avatar Sidipotu Ashok Committed by Gerrit - the friendly Code Review server
Browse files

hal: improve logging.

-log to print open/close/standby of out/in streams
-log to print the the device switches

Change-Id: I1b3bf3d6ba19faa4df804f781fc15c0f96a5b80f
parent 44b3e215
Loading
Loading
Loading
Loading
+28 −13
Original line number Diff line number Diff line
@@ -706,6 +706,8 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
                                                               out_snd_device,
                                                               in_snd_device);

    ALOGD("%s: done",__func__);

    return status;
}

@@ -750,7 +752,8 @@ int start_input_stream(struct stream_in *in)
    struct audio_device *adev = in->dev;

    in->usecase = platform_update_usecase_from_source(in->source,in->usecase);
    ALOGV("%s: enter: usecase(%d)", __func__, in->usecase);
    ALOGD("%s: enter: stream(%p)usecase(%d: %s)",
          __func__, &in->stream, in->usecase, use_case_table[in->usecase]);

    /* Check if source matches incall recording usecase criteria */
    ret = voice_check_and_set_incall_rec_usecase(adev, in);
@@ -1077,8 +1080,9 @@ int start_output_stream(struct stream_out *out)
    struct audio_usecase *uc_info;
    struct audio_device *adev = out->dev;

    ALOGV("%s: enter: usecase(%d: %s) devices(%#x)",
          __func__, out->usecase, use_case_table[out->usecase], out->devices);
    ALOGD("%s: enter: stream(%p)usecase(%d: %s) devices(%#x)",
          __func__, &out->stream, out->usecase, use_case_table[out->usecase],
          out->devices);
    out->pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
    if (out->pcm_device_id < 0) {
        ALOGE("%s: Invalid PCM device id(%d) for the usecase(%d)",
@@ -1266,13 +1270,13 @@ static int out_standby(struct audio_stream *stream)
    struct stream_out *out = (struct stream_out *)stream;
    struct audio_device *adev = out->dev;

    ALOGV("%s: enter: usecase(%d: %s)", __func__,
          out->usecase, use_case_table[out->usecase]);
    ALOGD("%s: enter: stream (%p) usecase(%d: %s)", __func__,
          stream, out->usecase, use_case_table[out->usecase]);
    if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
        /* Ignore standby in case of voip call because the voip output
         * stream is closed in adev_close_output_stream()
         */
        ALOGV("%s: Ignore Standby in VOIP call", __func__);
        ALOGD("%s: Ignore Standby in VOIP call", __func__);
        return 0;
    }

@@ -1817,7 +1821,9 @@ static int in_standby(struct audio_stream *stream)
    struct stream_in *in = (struct stream_in *)stream;
    struct audio_device *adev = in->dev;
    int status = 0;
    ALOGV("%s: enter", __func__);
    ALOGD("%s: enter: stream (%p) usecase(%d: %s)", __func__,
          stream, in->usecase, use_case_table[in->usecase]);


    if (in->usecase == USECASE_COMPRESS_VOIP_CALL) {
        /* Ignore standby in case of voip call because the voip input
@@ -1857,7 +1863,7 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
    char value[32];
    int ret = 0, val = 0, err;

    ALOGV("%s: enter: kvpairs=%s", __func__, kvpairs);
    ALOGD("%s: enter: kvpairs=%s", __func__, kvpairs);
    parms = str_parms_create_str(kvpairs);

    pthread_mutex_lock(&in->lock);
@@ -2040,11 +2046,14 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
    struct stream_out *out;
    int i, ret = 0;

    ALOGV("%s: enter: sample_rate(%d) channel_mask(%#x) devices(%#x) flags(%#x)",
          __func__, config->sample_rate, config->channel_mask, devices, flags);
    *stream_out = NULL;
    out = (struct stream_out *)calloc(1, sizeof(struct stream_out));

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


    if (!out) {
        return -ENOMEM;
    }
@@ -2246,6 +2255,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
    config->sample_rate = out->stream.common.get_sample_rate(&out->stream.common);

    *stream_out = &out->stream;
    ALOGD("%s: Stream (%p) picks up usecase (%s)", __func__, &out->stream,
        use_case_table[out->usecase]);
    ALOGV("%s: exit", __func__);
    return 0;

@@ -2263,7 +2274,8 @@ static void adev_close_output_stream(struct audio_hw_device *dev,
    struct audio_device *adev = out->dev;
    int ret = 0;

    ALOGV("%s: enter", __func__);
    ALOGD("%s: enter:stream_handle(%p)",__func__, out);

    if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
        ret = voice_extn_compress_voip_close_output_stream(&stream->common);
        if(ret != 0)
@@ -2475,12 +2487,15 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
    int ret = 0, buffer_size, frame_size;
    int channel_count = popcount(config->channel_mask);

    ALOGV("%s: enter", __func__);

    *stream_in = NULL;
    if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0)
        return -EINVAL;

    in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
    ALOGD("%s: enter: sample_rate(%d) channel_mask(%#x) devices(%#x)\
        stream_handle(%p)",__func__, config->sample_rate, config->channel_mask,
        devices, &in->stream);

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

@@ -2551,7 +2566,7 @@ static void adev_close_input_stream(struct audio_hw_device *dev,
{
    int ret;
    struct stream_in *in = (struct stream_in *)stream;
    ALOGV("%s", __func__);
    ALOGD("%s: enter:stream_handle(%p)",__func__, in);

    if (in->usecase == USECASE_COMPRESS_VOIP_CALL) {
        ret = voice_extn_compress_voip_close_input_stream(&stream->common);
+5 −3
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ status_t AudioPolicyManager::setDeviceConnectionState(audio_devices_t device,
{
    SortedVector <audio_io_handle_t> outputs;

    ALOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address);
    ALOGD("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address);

    // connect/disconnect only 1 device at a time
    if (!audio_is_output_device(device) && !audio_is_input_device(device)) return BAD_VALUE;
@@ -395,7 +395,7 @@ void AudioPolicyManager::setPhoneState(int state)

void AudioPolicyManager::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config)
{
    ALOGV("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);
    ALOGD("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);

    bool forceVolumeReeval = false;
    switch(usage) {
@@ -492,7 +492,7 @@ audio_io_handle_t AudioPolicyManager::getInput(int inputSource,
    audio_io_handle_t input = 0;
    audio_devices_t device = getDeviceForInputSource(inputSource);

    ALOGV("getInput() inputSource %d, samplingRate %d, format %d, channelMask %x, acoustics %x",
    ALOGD("getInput() inputSource %d, samplingRate %d, format %d, channelMask %x, acoustics %x",
          inputSource, samplingRate, format, channelMask, acoustics);

    if (device == AUDIO_DEVICE_NONE) {
@@ -545,6 +545,8 @@ audio_io_handle_t AudioPolicyManager::getInput(int inputSource,
        return 0;
    }
    mInputs.add(input, inputDesc);
    ALOGD("getInput() returns input %d", input);

    return input;
}