summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-05-16 01:22:47 +0300
committerUoti Urpala <uau@mplayer2.org>2011-05-16 01:32:26 +0300
commitbdcf4ddf35801e73bb4eed985eee0cb084840e23 (patch)
treeab28ac403f9eb89e571a5d7035982a3fa58fc992 /libao2
parentcbdb7e630526753efd5716bb67cf627393f3258c (diff)
downloadmpv-bdcf4ddf35801e73bb4eed985eee0cb084840e23.tar.bz2
mpv-bdcf4ddf35801e73bb4eed985eee0cb084840e23.tar.xz
ao: fix crash after ao init failure (from recent 3a5fd15fa2)
If opening an audio output driver using the old API failed the "global_ao" variable was not set back to NULL as it should have been. This caused an assert failure the next time there was an attempt to open such an AO (either due to fallback to another AO after the failure or after moving to another file). Fix.
Diffstat (limited to 'libao2')
-rw-r--r--libao2/audio_out.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index 699ae7071b..2ad147d8a5 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -274,8 +274,10 @@ int old_ao_init(struct ao *ao, char *params)
global_ao = ao;
ao_subdevice = params ? talloc_strdup(ao, params) : NULL;
if (ao->driver->old_functions->init(ao->samplerate, ao->channels,
- ao->format, 0) == 0)
+ ao->format, 0) == 0) {
+ global_ao = NULL;
return -1;
+ }
return 0;
}