From 9e37d05a8086b4aa7ea0ec4582059d9e23177192 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Tue, 18 Jun 2002 16:08:36 +0000 Subject: [PATCH] fix bug where plugin would crash if decoder hits unexpected end of file --- src/plugin_winamp2/in_flac.c | 5 ++++- src/plugin_winamp3/flacpcm.cpp | 5 ++++- src/plugin_xmms/plugin.c | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugin_winamp2/in_flac.c b/src/plugin_winamp2/in_flac.c index d172aca1..003c017d 100644 --- a/src/plugin_winamp2/in_flac.c +++ b/src/plugin_winamp2/in_flac.c @@ -276,8 +276,11 @@ DWORD WINAPI __stdcall DecodeThread(void *b) done = 1; break; } - else if(!FLAC__file_decoder_process_one_frame(decoder_)) + else if(!FLAC__file_decoder_process_one_frame(decoder_)) { + MessageBox(mod_.hMainWindow, FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(decoder_)], "READ ERROR processing frame", 0); + done = 1; break; + } } if (samples_in_reservoir_ == 0) { diff --git a/src/plugin_winamp3/flacpcm.cpp b/src/plugin_winamp3/flacpcm.cpp index c35f7d86..88c73b60 100644 --- a/src/plugin_winamp3/flacpcm.cpp +++ b/src/plugin_winamp3/flacpcm.cpp @@ -152,8 +152,11 @@ int FlacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswit eof = true; break; } - else if(!FLAC__seekable_stream_decoder_process_one_frame(decoder)) + else if(!FLAC__seekable_stream_decoder_process_one_frame(decoder)) { + //@@@ how to do this? MessageBox(mod_.hMainWindow, FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(decoder_)], "READ ERROR processing frame", 0); + eof = true; break; + } } if(samples_in_reservoir == 0) { diff --git a/src/plugin_xmms/plugin.c b/src/plugin_xmms/plugin.c index 61f185f6..60521826 100644 --- a/src/plugin_xmms/plugin.c +++ b/src/plugin_xmms/plugin.c @@ -307,8 +307,12 @@ void *play_loop_(void *arg) file_info_.eof = true; break; } - else if(!FLAC__file_decoder_process_one_frame(decoder_)) + else if(!FLAC__file_decoder_process_one_frame(decoder_)) { + /*@@@ this should probably be a dialog */ + fprintf(stderr, "libxmms-flac: READ ERROR processing frame\n"); + file_info_.eof = true; break; + } } if(reservoir_samples_ > 0) { const unsigned channels = file_info_.channels;