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

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

Merge "audio: move gef device change notification to the tail"

parents 6e9e0a2f 5d608082
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -2015,6 +2015,10 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
    struct stream_out stream_out;
    audio_usecase_t hfp_ucid;
    int status = 0;
    audio_devices_t audio_device;
    audio_channel_mask_t channel_mask;
    int sample_rate;
    int acdb_id;

    ALOGD("%s for use case (%s)", __func__, use_case_table[uc_id]);

@@ -2255,14 +2259,11 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
            usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
        }

        /* Notify device change info to effect clients registered */
        pthread_mutex_unlock(&adev->lock);
        audio_extn_gef_notify_device_config(
                usecase->stream.out->devices,
                usecase->stream.out->channel_mask,
                usecase->stream.out->app_type_cfg.sample_rate,
                platform_get_snd_device_acdb_id(usecase->out_snd_device));
        pthread_mutex_lock(&adev->lock);
        /* Cache stream information to be notified to gef clients */
        audio_device = usecase->stream.out->devices;
        channel_mask = usecase->stream.out->channel_mask;
        sample_rate = usecase->stream.out->app_type_cfg.sample_rate;
        acdb_id = platform_get_snd_device_acdb_id(usecase->out_snd_device);
    }
    enable_audio_route(adev, usecase);

@@ -2319,6 +2320,16 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
         }
    }

    /* Notify device change info to effect clients registered
     * NOTE: device lock has to be unlock temporarily here.
     * To the worst case, we notify stale info to clients.
     */
    if (usecase->type == PCM_PLAYBACK) {
        pthread_mutex_unlock(&adev->lock);
        audio_extn_gef_notify_device_config(audio_device, channel_mask, sample_rate, acdb_id);
        pthread_mutex_lock(&adev->lock);
    }

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

    return status;