forked from len0rd/rockbox
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
This commit is contained in:
parent
58c71e0e36
commit
ef72f99681
4 changed files with 14 additions and 12 deletions
|
@ -463,8 +463,6 @@ void audio_fill_file_buffer(void)
|
||||||
|
|
||||||
if (!queue_empty(&audio_queue)) {
|
if (!queue_empty(&audio_queue)) {
|
||||||
logf("Filling interrupted");
|
logf("Filling interrupted");
|
||||||
//close(current_fd);
|
|
||||||
//current_fd = -1;
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,6 +1000,11 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
|
||||||
|
|
||||||
tracks[track_widx].filepos = i;
|
tracks[track_widx].filepos = i;
|
||||||
|
|
||||||
|
if (current_fd >= 0) {
|
||||||
|
close(current_fd);
|
||||||
|
current_fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Leave the file handle open for faster buffer refill. */
|
/* Leave the file handle open for faster buffer refill. */
|
||||||
if (tracks[track_widx].filerem != 0) {
|
if (tracks[track_widx].filerem != 0) {
|
||||||
current_fd = fd;
|
current_fd = fd;
|
||||||
|
@ -1010,7 +1013,6 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
|
||||||
} else {
|
} else {
|
||||||
logf("Completely buf.");
|
logf("Completely buf.");
|
||||||
close(fd);
|
close(fd);
|
||||||
current_fd = -1;
|
|
||||||
if (++track_widx >= MAX_TRACK) {
|
if (++track_widx >= MAX_TRACK) {
|
||||||
track_widx = 0;
|
track_widx = 0;
|
||||||
}
|
}
|
||||||
|
@ -1485,10 +1487,6 @@ void audio_next(void)
|
||||||
ci.stop_codec = true;
|
ci.stop_codec = true;
|
||||||
playlist_next(1);
|
playlist_next(1);
|
||||||
queue_post(&audio_queue, AUDIO_PLAY, 0);
|
queue_post(&audio_queue, AUDIO_PLAY, 0);
|
||||||
} else {
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
pcm_play_stop();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
|
#include "logf.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "mas.h"
|
#include "mas.h"
|
||||||
|
@ -374,15 +375,18 @@ int codec_load_file(const char *plugin, void *parameter)
|
||||||
fd = open(plugin, O_RDONLY);
|
fd = open(plugin, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin);
|
snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin);
|
||||||
|
logf("Codec load error:%d", fd);
|
||||||
splash(HZ*2, true, msgbuf);
|
splash(HZ*2, true, msgbuf);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE);
|
rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE);
|
||||||
if (rc <= 0)
|
|
||||||
return PLUGIN_ERROR;
|
|
||||||
plugin_size = rc;
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
if (rc <= 0) {
|
||||||
|
logf("Codec read error");
|
||||||
|
return PLUGIN_ERROR;
|
||||||
|
}
|
||||||
|
plugin_size = rc;
|
||||||
|
|
||||||
return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0);
|
return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ int i2c_write(int device, unsigned char *buf, int count);
|
||||||
void i2c_close(void);
|
void i2c_close(void);
|
||||||
|
|
||||||
|
|
||||||
#define MAX_LOOP 0x10000 /* TODO: select a better value */
|
#define MAX_LOOP 0x100 /* TODO: select a better value */
|
||||||
|
|
||||||
/* PLLCR control */
|
/* PLLCR control */
|
||||||
#define QSPISEL (1 << 11) /* Selects QSPI or I2C interface */
|
#define QSPISEL (1 << 11) /* Selects QSPI or I2C interface */
|
||||||
|
|
|
@ -382,7 +382,7 @@ unsigned int audiobuffer_get_latency(void)
|
||||||
|
|
||||||
bool pcm_is_lowdata(void)
|
bool pcm_is_lowdata(void)
|
||||||
{
|
{
|
||||||
if (!pcm_is_playing())
|
if (!pcm_is_playing() || pcm_paused)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pcmbuf_unplayed_bytes < PCM_WATERMARK)
|
if (pcmbuf_unplayed_bytes < PCM_WATERMARK)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue