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);
|
||||
|
||||
if (mixer->open) {
|
||||
volume = mixer->plugin->get_volume(mixer, error_r);
|
||||
if (volume < 0)
|
||||
GError *error = NULL;
|
||||
|
||||
volume = mixer->plugin->get_volume(mixer, &error);
|
||||
if (volume < 0 && error != NULL) {
|
||||
g_propagate_error(error_r, error);
|
||||
mixer_failed(mixer);
|
||||
}
|
||||
} else
|
||||
volume = -1;
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ struct mixer_plugin {
|
|||
*
|
||||
* @param error_r location to store the error occuring, or
|
||||
* NULL to ignore errors
|
||||
* @return the current volume (0..100 including) or -1 on
|
||||
* error
|
||||
* @return the current volume (0..100 including) or -1 if
|
||||
* unavailable or on error (error_r set, mixer will be closed)
|
||||
*/
|
||||
int (*get_volume)(struct mixer *mixer, GError **error_r);
|
||||
|
||||
|
|
Loading…
Reference in New Issue