module-filter-chain: do better error reporting
When we find no valid sample file to read, go through all files and report why they fail to load. Also display the current working directory so that we can see where file are loaded from. See #3223
This commit is contained in:
parent
65a5272a9f
commit
135647f193
|
@ -690,11 +690,8 @@ static float *read_closest(char **filenames, float gain, int delay, int offset,
|
|||
|
||||
for (i = 0; i < MAX_RATES && filenames[i] && filenames[i][0]; i++) {
|
||||
fs[i] = sf_open(filenames[i], SFM_READ, &infos[i]);
|
||||
if (!fs[i]) {
|
||||
pw_log_error("Can't open file %s: %s", filenames[i],
|
||||
sf_strerror(fs[i]));
|
||||
if (fs[i] == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (labs((long)infos[i].samplerate - (long)*rate) < diff) {
|
||||
best = i;
|
||||
|
@ -706,9 +703,20 @@ static float *read_closest(char **filenames, float gain, int delay, int offset,
|
|||
pw_log_info("loading best rate:%u %s", infos[best].samplerate, filenames[best]);
|
||||
samples = read_samples_from_sf(fs[best], infos[best], gain, delay,
|
||||
offset, length, channel, rate, n_samples);
|
||||
} else {
|
||||
char buf[PATH_MAX];
|
||||
pw_log_error("Can't open any sample file (CWD %s):",
|
||||
getcwd(buf, sizeof(buf)));
|
||||
for (i = 0; i < MAX_RATES && filenames[i] && filenames[i][0]; i++) {
|
||||
fs[i] = sf_open(filenames[i], SFM_READ, &infos[i]);
|
||||
if (fs[i] == NULL)
|
||||
pw_log_error(" failed file %s: %s", filenames[i], sf_strerror(fs[i]));
|
||||
else
|
||||
pw_log_warn(" unexpectedly opened file %s", filenames[i]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MAX_RATES; i++)
|
||||
if (fs[i])
|
||||
if (fs[i] != NULL)
|
||||
sf_close(fs[i]);
|
||||
|
||||
return samples;
|
||||
|
|
Loading…
Reference in New Issue