From ef72f996814301fc0ed9cc358f620e67a81486f7 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Tue, 14 Jun 2005 14:36:46 +0000 Subject: Fixed a dead lock, file handle leak that caused wps to jam and selected a smaller i2c timeout value. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6707 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 12 +++++------- apps/plugin.c | 8 ++++++-- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/playback.c b/apps/playback.c index cda67acbe1..7ef4f7b4bc 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -463,8 +463,6 @@ void audio_fill_file_buffer(void) if (!queue_empty(&audio_queue)) { logf("Filling interrupted"); - //close(current_fd); - //current_fd = -1; return ; } @@ -1002,6 +1000,11 @@ bool audio_load_track(int offset, bool start_play, int peek_offset) tracks[track_widx].filepos = i; + if (current_fd >= 0) { + close(current_fd); + current_fd = -1; + } + /* Leave the file handle open for faster buffer refill. */ if (tracks[track_widx].filerem != 0) { current_fd = fd; @@ -1010,7 +1013,6 @@ bool audio_load_track(int offset, bool start_play, int peek_offset) } else { logf("Completely buf."); close(fd); - current_fd = -1; if (++track_widx >= MAX_TRACK) { track_widx = 0; } @@ -1485,10 +1487,6 @@ void audio_next(void) ci.stop_codec = true; playlist_next(1); queue_post(&audio_queue, AUDIO_PLAY, 0); - } else { -#ifndef SIMULATOR - pcm_play_stop(); -#endif } } diff --git a/apps/plugin.c b/apps/plugin.c index edf32d227d..46bc0df44d 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -29,6 +29,7 @@ #include "file.h" #include "kernel.h" #include "sprintf.h" +#include "logf.h" #include "screens.h" #include "misc.h" #include "mas.h" @@ -374,15 +375,18 @@ int codec_load_file(const char *plugin, void *parameter) fd = open(plugin, O_RDONLY); if (fd < 0) { snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin); + logf("Codec load error:%d", fd); splash(HZ*2, true, msgbuf); return fd; } rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE); - if (rc <= 0) + close(fd); + if (rc <= 0) { + logf("Codec read error"); return PLUGIN_ERROR; + } plugin_size = rc; - close(fd); return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0); } -- cgit v1.2.3