Currently the exit code of para_write is always the value returned
by schedule(). This is zero unless the call to select() fails,
usually does not happen, so errors resulting from the writers do not
cause para_write to exit with a non-zero exit code.
In particular, para_write exits successfully if the underlying
writer(s) nodes could not open their sound device or unregistered
their task due to other errors.
Fix this by investigating each writer node's t->error value after
schedule() has returned. If this value does not correspond to an end
of file condition, the strerror text of this error code is written
to stderr, and para_write exits non-zero.
bytes = btr_next_buffer(btrn, &data);
if (ret < 0 || bytes < wn->min_iqs) { /* eof */
assert(btr_no_parent(btrn));
bytes = btr_next_buffer(btrn, &data);
if (ret < 0 || bytes < wn->min_iqs) { /* eof */
assert(btr_no_parent(btrn));
+ ret = -E_WRITE_COMMON_EOF;
if (!pad)
goto err;
/* wait until pending frames are played */
if (!pad)
goto err;
/* wait until pending frames are played */
PARA_ERROR(BAD_SAMPLE_FORMAT, "sample format not supported"), \
PARA_ERROR(BAD_CHANNEL_COUNT, "channel count not supported"), \
PARA_ERROR(BAD_SAMPLERATE, "sample rate not supported"), \
PARA_ERROR(BAD_SAMPLE_FORMAT, "sample format not supported"), \
PARA_ERROR(BAD_CHANNEL_COUNT, "channel count not supported"), \
PARA_ERROR(BAD_SAMPLERATE, "sample rate not supported"), \
- PARA_ERROR(OSS_EOF, "oss: end of file"), \
#define COMPRESS_FILTER_ERRORS \
#define COMPRESS_FILTER_ERRORS \
PARA_ERROR(SET_RATE, "snd_pcm_hw_params_set_rate_near failed"), \
PARA_ERROR(START_THRESHOLD, "snd_pcm_sw_params_set_start_threshold() failed"), \
PARA_ERROR(STOP_THRESHOLD, "snd_pcm_sw_params_set_stop_threshold() failed"), \
PARA_ERROR(SET_RATE, "snd_pcm_hw_params_set_rate_near failed"), \
PARA_ERROR(START_THRESHOLD, "snd_pcm_sw_params_set_start_threshold() failed"), \
PARA_ERROR(STOP_THRESHOLD, "snd_pcm_sw_params_set_stop_threshold() failed"), \
- PARA_ERROR(ALSA_EOF, "alsa: end of file"), \
-
#define WRITE_COMMON_ERRORS \
PARA_ERROR(WRITE_COMMON_SYNTAX, "syntax error in write option"), \
#define WRITE_COMMON_ERRORS \
PARA_ERROR(WRITE_COMMON_SYNTAX, "syntax error in write option"), \
+ PARA_ERROR(WRITE_COMMON_EOF, "end of file"), \
#define AACDEC_FILTER_ERRORS \
#define AACDEC_FILTER_ERRORS \
bytes = btr_next_buffer(btrn, &data);
frames = bytes / powd->bytes_per_frame;
if (!frames) { /* eof and less than a single frame available */
bytes = btr_next_buffer(btrn, &data);
frames = bytes / powd->bytes_per_frame;
if (!frames) { /* eof and less than a single frame available */
+ ret = -E_WRITE_COMMON_EOF;
s->default_timeout.tv_sec = 10;
s->default_timeout.tv_usec = 50000;
ret = schedule(s);
s->default_timeout.tv_sec = 10;
s->default_timeout.tv_usec = 50000;
ret = schedule(s);
+ if (ret >= 0) {
+ int j;
+ for (j = 0; j < i; j++) {
+ struct task *t = &wns[j].task;
+ assert(t->error < 0);
+ if (t->error != -E_WRITE_COMMON_EOF
+ && t->error != -E_BTR_EOF) {
+ PARA_ERROR_LOG("%s: %s\n", t->status,
+ para_strerror(-t->error));
+ if (ret >= 0)
+ ret = t->error;
+ }
+ }
+ }
out:
for (i--; i >= 0; i--) {
struct writer_node *wn = wns + i;
out:
for (i--; i >= 0; i--) {
struct writer_node *wn = wns + i;