From 1b1b61f2de8f438ab9dc00c09f9ffeab41f5539c Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 17 Jun 2014 21:11:07 +0200 Subject: fixed aborting hanging mms streams; fixed bug in decoder detection login, which was causing unpredictable codec selection when playing streaming audio --- streamer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'streamer.c') diff --git a/streamer.c b/streamer.c index f61d635a..825faaad 100644 --- a/streamer.c +++ b/streamer.c @@ -190,6 +190,16 @@ streamer_abort_files (void) { DB_FILE *file = fileinfo_file; DB_FILE *newfile = new_fileinfo_file; DB_FILE *strfile = streamer_file; + + // this situation occurs during decoder->init + // we still don't have the filehandle acquired from the streamer thread, + // but the file is open already + if (!newfile && !new_fileinfo_file && new_fileinfo) { + mutex_lock (decodemutex); + newfile = new_fileinfo->file; + mutex_unlock (decodemutex); + } + if (file) { deadbeef->fabort (file); } @@ -199,6 +209,7 @@ streamer_abort_files (void) { if (strfile) { deadbeef->fabort (strfile); } + } @@ -1202,6 +1213,7 @@ m3u_error: mutex_unlock (decodemutex); if (new_fileinfo && dec->init (new_fileinfo, DB_PLAYITEM (it)) != 0) { trace ("\033[0;31mfailed to init decoder\033[37;0m\n"); + pl_delete_meta (it, "!DECODER"); mutex_lock (decodemutex); dec->free (new_fileinfo); new_fileinfo = NULL; -- cgit v1.2.3