From 966f4a8b78e6324b930e5a50f2bb930bd87e565e Mon Sep 17 00:00:00 2001 From: Abs62 Date: Fri, 27 Sep 2019 17:00:52 +0300 Subject: [PATCH] FFmpeg player: Fix some crashes on broken files --- ffmpegaudio.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ffmpegaudio.cc b/ffmpegaudio.cc index 56e8f788..415fc79c 100644 --- a/ffmpegaudio.cc +++ b/ffmpegaudio.cc @@ -51,7 +51,9 @@ AudioService & AudioService::instance() AudioService::AudioService() { +#if LIBAVFORMAT_VERSION_MAJOR < 58 || ( LIBAVFORMAT_VERSION_MAJOR == 58 && LIBAVFORMAT_VERSION_MINOR < 9 ) av_register_all(); +#endif ao_initialize(); } @@ -438,6 +440,8 @@ bool DecoderContext::play( QString & errorString ) #else /* flush the decoder */ av_init_packet( &packet ); + packet.data = NULL; + packet.size = 0; int ret = avcodec_send_packet(codecContext_, &packet ); while( ret >= 0 ) {