Hi guys,
I have a question for the code below, please give your opinion, thanks!
The function device_start_waiting_for_profiles is to wait for connecting
profiles,
but only waited 3 seconds(WAIT_FOR_PROFILES_TIMEOUT_USEC), if Bluetooth
transport state
will be changed after 3 seconds(WAIT_FOR_PROFILES_TIMEOUT_USEC),
I think whether there are any issues with the code logic or not.
/* src/modules/bluetooth/bluez5-util.c */
n_disconnected_profiles =
device_count_disconnected_profiles(t->device);
new_device_appeared = !old_any_connected &&
pa_bluetooth_device_any_transport_connected(t->device);
device_disconnected = old_any_connected &&
!pa_bluetooth_device_any_transport_connected(t->device);
if (new_device_appeared) {
if (n_disconnected_profiles > 0)
device_start_waiting_for_profiles(t->device); <---- here
else
pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED],
t->device);
return;
}
static void device_start_waiting_for_profiles(pa_bluetooth_device
*device) {
pa_assert(!device->wait_for_profiles_timer);
device->wait_for_profiles_timer =
pa_core_rttime_new(device->discovery->core,
pa_rtclock_now() + WAIT_FOR_PROFILES_TIMEOUT_USEC, <---- here
wait_for_profiles_cb, device);
}
static void wait_for_profiles_cb(pa_mainloop_api *api,
pa_time_event* event, const struct timeval *tv, void *userdata) {
pa_bluetooth_device *device = userdata;
pa_strbuf *buf;
pa_bluetooth_profile_t profile;
bool first = true;
char *profiles_str;
device_stop_waiting_for_profiles(device); <---- here
/* ...... */
}
Best Regards,
Chengyi
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss