mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
acp: add debug for open and close
Debug open and close calls. Make pa_alsa_close to close the device.
This commit is contained in:
parent
34c1c1614e
commit
a9ced45d4b
5 changed files with 27 additions and 18 deletions
|
|
@ -382,8 +382,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
|
|||
0, NULL, NULL, false))) {
|
||||
pa_alsa_init_proplist_pcm(NULL, m->output_proplist, m->output_pcm);
|
||||
pa_proplist_setf(m->output_proplist, "clock.name", "api.alsa.%u", index);
|
||||
snd_pcm_close(m->output_pcm);
|
||||
m->output_pcm = NULL;
|
||||
pa_alsa_close(&m->output_pcm);
|
||||
m->supported = true;
|
||||
pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX);
|
||||
}
|
||||
|
|
@ -413,8 +412,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
|
|||
0, NULL, NULL, false))) {
|
||||
pa_alsa_init_proplist_pcm(NULL, m->input_proplist, m->input_pcm);
|
||||
pa_proplist_setf(m->input_proplist, "clock.name", "api.alsa.%u", index);
|
||||
snd_pcm_close(m->input_pcm);
|
||||
m->input_pcm = NULL;
|
||||
pa_alsa_close(&m->input_pcm);
|
||||
m->supported = true;
|
||||
pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4966,8 +4966,7 @@ static void profile_finalize_probing(pa_alsa_profile *to_be_finalized, pa_alsa_p
|
|||
continue;
|
||||
|
||||
pa_alsa_init_proplist_pcm(NULL, m->output_proplist, m->output_pcm);
|
||||
snd_pcm_close(m->output_pcm);
|
||||
m->output_pcm = NULL;
|
||||
pa_alsa_close(&m->output_pcm);
|
||||
}
|
||||
|
||||
if (to_be_finalized->input_mappings)
|
||||
|
|
@ -4986,8 +4985,7 @@ static void profile_finalize_probing(pa_alsa_profile *to_be_finalized, pa_alsa_p
|
|||
continue;
|
||||
|
||||
pa_alsa_init_proplist_pcm(NULL, m->input_proplist, m->input_pcm);
|
||||
snd_pcm_close(m->input_pcm);
|
||||
m->input_pcm = NULL;
|
||||
pa_alsa_close(&m->input_pcm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1941,8 +1941,7 @@ static void profile_finalize_probing(pa_alsa_profile *p) {
|
|||
continue;
|
||||
|
||||
pa_alsa_init_proplist_pcm(NULL, m->output_proplist, m->output_pcm);
|
||||
snd_pcm_close(m->output_pcm);
|
||||
m->output_pcm = NULL;
|
||||
pa_alsa_close(&m->output_pcm);
|
||||
}
|
||||
|
||||
PA_IDXSET_FOREACH(m, p->input_mappings, idx) {
|
||||
|
|
@ -1953,8 +1952,7 @@ static void profile_finalize_probing(pa_alsa_profile *p) {
|
|||
continue;
|
||||
|
||||
pa_alsa_init_proplist_pcm(NULL, m->input_proplist, m->input_pcm);
|
||||
snd_pcm_close(m->input_pcm);
|
||||
m->input_pcm = NULL;
|
||||
pa_alsa_close(&m->input_pcm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -656,6 +656,20 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping(
|
|||
return pcm_handle;
|
||||
}
|
||||
|
||||
int pa_alsa_close(snd_pcm_t **pcm)
|
||||
{
|
||||
int err;
|
||||
pa_assert(pcm);
|
||||
pa_log_info("ALSA device close %p", *pcm);
|
||||
if (*pcm == NULL)
|
||||
return 0;
|
||||
if ((err = snd_pcm_close(*pcm)) < 0) {
|
||||
pa_log_warn("ALSA close failed: %s", snd_strerror(err));
|
||||
}
|
||||
*pcm = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
snd_pcm_t *pa_alsa_open_by_device_string(
|
||||
const char *device,
|
||||
char **dev,
|
||||
|
|
@ -691,8 +705,8 @@ snd_pcm_t *pa_alsa_open_by_device_string(
|
|||
pa_log_info("Error opening PCM device %s: %s", d, pa_alsa_strerror(err));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pa_log_debug("Managed to open %s", d);
|
||||
pa_log_info("ALSA device open '%s' %s: %p", d,
|
||||
mode == SND_PCM_STREAM_CAPTURE ? "capture" : "playback", pcm_handle);
|
||||
|
||||
if ((err = pa_alsa_set_hw_params(
|
||||
pcm_handle,
|
||||
|
|
@ -707,7 +721,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
|
|||
if (!reformat) {
|
||||
reformat = true;
|
||||
|
||||
snd_pcm_close(pcm_handle);
|
||||
pa_alsa_close(&pcm_handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -721,12 +735,12 @@ snd_pcm_t *pa_alsa_open_by_device_string(
|
|||
|
||||
reformat = false;
|
||||
|
||||
snd_pcm_close(pcm_handle);
|
||||
pa_alsa_close(&pcm_handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
pa_log_info("Failed to set hardware parameters on %s: %s", d, pa_alsa_strerror(err));
|
||||
snd_pcm_close(pcm_handle);
|
||||
pa_alsa_close(&pcm_handle);
|
||||
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -734,7 +748,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
|
|||
if (ss->channels > PA_CHANNELS_MAX) {
|
||||
pa_log("Device %s has %u channels, but PulseAudio supports only %u channels. Unable to use the device.",
|
||||
d, ss->channels, PA_CHANNELS_MAX);
|
||||
snd_pcm_close(pcm_handle);
|
||||
pa_alsa_close(&pcm_handle);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ snd_pcm_t *pa_alsa_open_by_template(
|
|||
void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm);
|
||||
void pa_alsa_dump_status(snd_pcm_t *pcm);
|
||||
#endif
|
||||
int pa_alsa_close(snd_pcm_t **pcm);
|
||||
|
||||
void pa_alsa_refcnt_inc(void);
|
||||
void pa_alsa_refcnt_dec(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue