mirror of https://github.com/mpv-player/mpv
ao_pulse: don't always print error message if PulseAudio unavailable
PulseAudio is rather high on the auto proving order (to avoid using an emulated sound API), but it prints an annoying error message if the PA client library can't connect to a server. On the other hand, we do want this error message printed if the user explicitly selects the pulse audio output driver. Add a flag to indicate that an AO is opened due to auto probing. ao_pulse checks that flag, and if it's set, do not print if the initialization error is PA_ERR_CONNECTIONREFUSED, whcih I assume is the error signalling PulseAudio unavailability. (This error happens if no PulseAudio server is installed.)
This commit is contained in:
parent
d80b84f1a0
commit
f113e20794
|
@ -297,8 +297,11 @@ unlock_and_fail:
|
|||
pa_threaded_mainloop_unlock(priv->mainloop);
|
||||
|
||||
fail:
|
||||
if (priv->context)
|
||||
GENERIC_ERR_MSG(priv->context, "Init failed");
|
||||
if (priv->context) {
|
||||
if (!(pa_context_errno(priv->context) == PA_ERR_CONNECTIONREFUSED
|
||||
&& ao->probing))
|
||||
GENERIC_ERR_MSG(priv->context, "Init failed");
|
||||
}
|
||||
free(devarg);
|
||||
uninit(ao, true);
|
||||
return -1;
|
||||
|
|
|
@ -167,7 +167,9 @@ void ao_init(struct ao *ao, char **ao_list)
|
|||
for (int i = 0; audio_out_drivers[i]; i++) {
|
||||
const struct ao_driver *audio_out = audio_out_drivers[i];
|
||||
ao->driver = audio_out;
|
||||
ao->probing = true;
|
||||
if (audio_out->init(ao, NULL) >= 0) {
|
||||
ao->probing = false;
|
||||
ao->initialized = true;
|
||||
ao->driver = audio_out;
|
||||
return;
|
||||
|
|
|
@ -100,6 +100,7 @@ struct ao {
|
|||
double pts;
|
||||
struct bstr buffer;
|
||||
int buffer_playable_size;
|
||||
bool probing;
|
||||
bool initialized;
|
||||
bool untimed;
|
||||
bool no_persistent_volume;
|
||||
|
|
Loading…
Reference in New Issue