From 806d0c21c21b407c7f505111ef32cea7361a58b9 Mon Sep 17 00:00:00 2001 From: cladisch Date: Thu, 6 Aug 2009 09:43:10 +0000 Subject: Do not leak the mixer handle if setting of a volume fails. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29478 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_alsa.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libao2') diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index cc80b0ded3..491a5861c6 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -209,6 +209,7 @@ static int control(int cmd, void *arg) if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, set_vol)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel, snd_strerror(err)); + snd_mixer_close(handle); return CONTROL_ERROR; } mp_msg(MSGT_AO,MSGL_DBG2,"left=%li, ", set_vol); @@ -218,6 +219,7 @@ static int control(int cmd, void *arg) if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_RIGHT, set_vol)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel, snd_strerror(err)); + snd_mixer_close(handle); return CONTROL_ERROR; } mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n", -- cgit v1.2.3 From 3b6b050e1471702176e6e0cdca96d409a89221ef Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 8 Aug 2009 08:17:35 +0000 Subject: 100l, av_fifo_generic_read does not return anything useful, so ignore its return value and return len instead. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29481 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_coreaudio.c | 3 ++- libao2/ao_sdl.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'libao2') diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c index ad17773fbd..130eee8f97 100644 --- a/libao2/ao_coreaudio.c +++ b/libao2/ao_coreaudio.c @@ -115,7 +115,8 @@ static int write_buffer(unsigned char* data, int len){ static int read_buffer(unsigned char* data,int len){ int buffered = av_fifo_size(ao->buffer); if (len > buffered) len = buffered; - return av_fifo_generic_read(ao->buffer, data, len, NULL); + av_fifo_generic_read(ao->buffer, data, len, NULL); + return len; } OSStatus theRenderProc(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData) diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index aae6e3fc7d..329486b272 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -82,10 +82,11 @@ static int read_buffer(unsigned char* data,int len){ int buffered = av_fifo_size(buffer); if (len > buffered) len = buffered; #ifdef USE_SDL_INTERNAL_MIXER - return av_fifo_generic_read(buffer, data, len, mix_audio); + av_fifo_generic_read(buffer, data, len, mix_audio); #else - return av_fifo_generic_read(buffer, data, len, NULL); + av_fifo_generic_read(buffer, data, len, NULL); #endif + return len; } // end ring buffer stuff -- cgit v1.2.3