diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-14 14:36:46 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-14 14:36:46 +0000 |
commit | ef72f996814301fc0ed9cc358f620e67a81486f7 (patch) | |
tree | 1f866cd2931eb8fff7f0e904934d13f5d49b2a81 | |
parent | 58c71e0e366c174fd6f71446758fe311e68f4bee (diff) | |
download | rockbox-ef72f996814301fc0ed9cc358f620e67a81486f7.tar.gz rockbox-ef72f996814301fc0ed9cc358f620e67a81486f7.zip |
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
-rw-r--r-- | apps/playback.c | 12 | ||||
-rw-r--r-- | apps/plugin.c | 8 | ||||
-rw-r--r-- | firmware/export/i2c-h100.h | 2 | ||||
-rw-r--r-- | firmware/pcm_playback.c | 2 |
4 files changed, 13 insertions, 11 deletions
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) | |||
463 | 463 | ||
464 | if (!queue_empty(&audio_queue)) { | 464 | if (!queue_empty(&audio_queue)) { |
465 | logf("Filling interrupted"); | 465 | logf("Filling interrupted"); |
466 | //close(current_fd); | ||
467 | //current_fd = -1; | ||
468 | return ; | 466 | return ; |
469 | } | 467 | } |
470 | 468 | ||
@@ -1002,6 +1000,11 @@ bool audio_load_track(int offset, bool start_play, int peek_offset) | |||
1002 | 1000 | ||
1003 | tracks[track_widx].filepos = i; | 1001 | tracks[track_widx].filepos = i; |
1004 | 1002 | ||
1003 | if (current_fd >= 0) { | ||
1004 | close(current_fd); | ||
1005 | current_fd = -1; | ||
1006 | } | ||
1007 | |||
1005 | /* Leave the file handle open for faster buffer refill. */ | 1008 | /* Leave the file handle open for faster buffer refill. */ |
1006 | if (tracks[track_widx].filerem != 0) { | 1009 | if (tracks[track_widx].filerem != 0) { |
1007 | current_fd = fd; | 1010 | current_fd = fd; |
@@ -1010,7 +1013,6 @@ bool audio_load_track(int offset, bool start_play, int peek_offset) | |||
1010 | } else { | 1013 | } else { |
1011 | logf("Completely buf."); | 1014 | logf("Completely buf."); |
1012 | close(fd); | 1015 | close(fd); |
1013 | current_fd = -1; | ||
1014 | if (++track_widx >= MAX_TRACK) { | 1016 | if (++track_widx >= MAX_TRACK) { |
1015 | track_widx = 0; | 1017 | track_widx = 0; |
1016 | } | 1018 | } |
@@ -1485,10 +1487,6 @@ void audio_next(void) | |||
1485 | ci.stop_codec = true; | 1487 | ci.stop_codec = true; |
1486 | playlist_next(1); | 1488 | playlist_next(1); |
1487 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1489 | queue_post(&audio_queue, AUDIO_PLAY, 0); |
1488 | } else { | ||
1489 | #ifndef SIMULATOR | ||
1490 | pcm_play_stop(); | ||
1491 | #endif | ||
1492 | } | 1490 | } |
1493 | } | 1491 | } |
1494 | 1492 | ||
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 @@ | |||
29 | #include "file.h" | 29 | #include "file.h" |
30 | #include "kernel.h" | 30 | #include "kernel.h" |
31 | #include "sprintf.h" | 31 | #include "sprintf.h" |
32 | #include "logf.h" | ||
32 | #include "screens.h" | 33 | #include "screens.h" |
33 | #include "misc.h" | 34 | #include "misc.h" |
34 | #include "mas.h" | 35 | #include "mas.h" |
@@ -374,15 +375,18 @@ int codec_load_file(const char *plugin, void *parameter) | |||
374 | fd = open(plugin, O_RDONLY); | 375 | fd = open(plugin, O_RDONLY); |
375 | if (fd < 0) { | 376 | if (fd < 0) { |
376 | snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin); | 377 | snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin); |
378 | logf("Codec load error:%d", fd); | ||
377 | splash(HZ*2, true, msgbuf); | 379 | splash(HZ*2, true, msgbuf); |
378 | return fd; | 380 | return fd; |
379 | } | 381 | } |
380 | 382 | ||
381 | rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE); | 383 | rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE); |
382 | if (rc <= 0) | 384 | close(fd); |
385 | if (rc <= 0) { | ||
386 | logf("Codec read error"); | ||
383 | return PLUGIN_ERROR; | 387 | return PLUGIN_ERROR; |
388 | } | ||
384 | plugin_size = rc; | 389 | plugin_size = rc; |
385 | close(fd); | ||
386 | 390 | ||
387 | return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0); | 391 | return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0); |
388 | } | 392 | } |
diff --git a/firmware/export/i2c-h100.h b/firmware/export/i2c-h100.h index f8fd423b7e..5647b502db 100644 --- a/firmware/export/i2c-h100.h +++ b/firmware/export/i2c-h100.h | |||
@@ -31,7 +31,7 @@ int i2c_write(int device, unsigned char *buf, int count); | |||
31 | void i2c_close(void); | 31 | void i2c_close(void); |
32 | 32 | ||
33 | 33 | ||
34 | #define MAX_LOOP 0x10000 /* TODO: select a better value */ | 34 | #define MAX_LOOP 0x100 /* TODO: select a better value */ |
35 | 35 | ||
36 | /* PLLCR control */ | 36 | /* PLLCR control */ |
37 | #define QSPISEL (1 << 11) /* Selects QSPI or I2C interface */ | 37 | #define QSPISEL (1 << 11) /* Selects QSPI or I2C interface */ |
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index 83b7b2fc2e..d1be2a1102 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c | |||
@@ -382,7 +382,7 @@ unsigned int audiobuffer_get_latency(void) | |||
382 | 382 | ||
383 | bool pcm_is_lowdata(void) | 383 | bool pcm_is_lowdata(void) |
384 | { | 384 | { |
385 | if (!pcm_is_playing()) | 385 | if (!pcm_is_playing() || pcm_paused) |
386 | return false; | 386 | return false; |
387 | 387 | ||
388 | if (pcmbuf_unplayed_bytes < PCM_WATERMARK) | 388 | if (pcmbuf_unplayed_bytes < PCM_WATERMARK) |