Use preferred pa_context_new_with_proplist API

This commit is contained in:
Robin Gareus 2019-09-01 19:01:18 +02:00
parent 6746456d3a
commit 45cf29b7c5
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -235,12 +235,30 @@ PulseAudioBackend::init_pulse ()
return BackendInitializationError;
}
if (!(p_context = pa_context_new (pa_threaded_mainloop_get_api (p_mainloop), PROGRAM_NAME))) {
/* see https://freedesktop.org/software/pulseaudio/doxygen/proplist_8h.html */
pa_proplist* proplist = pa_proplist_new ();
pa_proplist_sets (proplist, PA_PROP_MEDIA_SOFTWARE, PROGRAM_NAME);
pa_proplist_sets (proplist, PA_PROP_MEDIA_ROLE, "production");
#if 0 // TODO
/* in tools/linux_packaging/stage2.run.in uses xdg
* ICON_NAME="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}"
* e.g. "Harrison-Mixbus32C_3.7.24" "Ardour-Ardour_5.12.0"
*
* gtk2_ardour/wscript $ARDOUR_ICON is used in .desktop.in
* 'ardour<major>'
*/
pa_proplist_sets (proplist, PA_PROP_APPLICATION_ICON_NAME, "Ardour-Ardour_5.12.0");
#endif
if (!(p_context = pa_context_new_with_proplist (pa_threaded_mainloop_get_api (p_mainloop), PROGRAM_NAME, proplist))) {
PBD::error << _("PulseAudioBackend: Failed to allocate context") << endmsg;
close_pulse ();
pa_proplist_free (proplist);
return BackendInitializationError;
}
pa_proplist_free (proplist);
pa_context_set_state_callback (p_context, PulseAudioBackend::context_state_cb, this);
if (pa_context_connect (p_context, NULL, PA_CONTEXT_NOFLAGS, NULL) < 0) {