mixer_plugin: get_volume() may return -1 if unavailable
If the method get_volume() returns -1 and no error object is set, then the volume is currently unavailable, but the mixer should not be closed immediately.
This commit is contained in:
parent
ede828c910
commit
c4f895daf4
|
@ -140,9 +140,13 @@ mixer_get_volume(struct mixer *mixer, GError **error_r)
|
||||||
g_mutex_lock(mixer->mutex);
|
g_mutex_lock(mixer->mutex);
|
||||||
|
|
||||||
if (mixer->open) {
|
if (mixer->open) {
|
||||||
volume = mixer->plugin->get_volume(mixer, error_r);
|
GError *error = NULL;
|
||||||
if (volume < 0)
|
|
||||||
|
volume = mixer->plugin->get_volume(mixer, &error);
|
||||||
|
if (volume < 0 && error != NULL) {
|
||||||
|
g_propagate_error(error_r, error);
|
||||||
mixer_failed(mixer);
|
mixer_failed(mixer);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
volume = -1;
|
volume = -1;
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ struct mixer_plugin {
|
||||||
*
|
*
|
||||||
* @param error_r location to store the error occuring, or
|
* @param error_r location to store the error occuring, or
|
||||||
* NULL to ignore errors
|
* NULL to ignore errors
|
||||||
* @return the current volume (0..100 including) or -1 on
|
* @return the current volume (0..100 including) or -1 if
|
||||||
* error
|
* unavailable or on error (error_r set, mixer will be closed)
|
||||||
*/
|
*/
|
||||||
int (*get_volume)(struct mixer *mixer, GError **error_r);
|
int (*get_volume)(struct mixer *mixer, GError **error_r);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue