diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2006-04-21 23:22:04 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2006-04-21 23:22:04 +0000 |
commit | 36c94c8401395e65aeb722e05d24915c9a361c97 (patch) | |
tree | 65003b1c83dbe43b44e170e2f51f6bdefa1fd277 /src | |
parent | 65d46d7e0123cf42b5c98f633bd41c90acaa180d (diff) | |
download | xine-lib-36c94c8401395e65aeb722e05d24915c9a361c97.tar.gz xine-lib-36c94c8401395e65aeb722e05d24915c9a361c97.tar.bz2 |
Fix MP3 playing when mad is disabled (patch from Diego Pettenò)
This patch validates codec and context before trying to call ffmpeg to avoid
crashes when mad is not enabled and an mp3 is tried to be played. This way, if
mad support is not enabled it can fail "gracefully" without having a segfault
that takes down the frontend entirely.
Thanks to Ian Monroe <ian@monroe.nu> for the backtrace from which I started
testing.
CVS patchset: 7978
CVS date: 2006/04/21 23:22:04
Diffstat (limited to 'src')
-rw-r--r-- | src/libffmpeg/audio_decoder.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libffmpeg/audio_decoder.c b/src/libffmpeg/audio_decoder.c index 11efbbba7..53e1415ee 100644 --- a/src/libffmpeg/audio_decoder.c +++ b/src/libffmpeg/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.23 2006/03/07 08:03:08 tmattern Exp $ + * $Id: audio_decoder.c,v 1.24 2006/04/21 23:22:04 dsalt Exp $ * * xine audio decoder plugin using ffmpeg * @@ -242,6 +242,13 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) } else if (!(buf->decoder_flags & BUF_FLAG_SPECIAL)) { if( !this->decoder_ok ) { + if ( ! this->context || ! this->codec ) { + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("ffmpeg_audio_dec: trying to open null codec\n")); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); + return; + } + pthread_mutex_lock (&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock (&ffmpeg_lock); |