summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f75fe9d)
The current code started a new receiver node for the current format
only if the receiver_node is NULL for each slot which streams
that format. Since that pointer is only set to NULL _after_ the
writer/filters are closed, audiod did not start the new receiver
early enough.
Fix is simple: Check also the eof field in struct receiver_node.
As we're at it, rename decoder_running() to receiver_running() and
move it straight above its single caller.
As a consequence of this change, the restart_barrier has to be set
already in rn_event_handler() as this is the place where rn->eof is
set to one.
{
struct slot_info *s = &slot[slot_num];
struct audio_format_info *a;
{
struct slot_info *s = &slot[slot_num];
struct audio_format_info *a;
- const struct timeval restart_delay = {0, 200 * 1000};
if (s->format < 0 || !s->receiver_node)
return;
a = &afi[s->format];
PARA_NOTICE_LOG("closing %s receiver in slot %d (eof = %d)\n",
audio_formats[s->format] , slot_num, s->receiver_node->eof);
if (s->format < 0 || !s->receiver_node)
return;
a = &afi[s->format];
PARA_NOTICE_LOG("closing %s receiver in slot %d (eof = %d)\n",
audio_formats[s->format] , slot_num, s->receiver_node->eof);
-// if (!s->receiver_node->eof)
-// unregister_task(&s->receiver_node->task);
a->receiver->close(s->receiver_node);
free(s->receiver_node);
s->receiver_node = NULL;
a->receiver->close(s->receiver_node);
free(s->receiver_node);
s->receiver_node = NULL;
- /* set restart barrier */
- tv_add(now, &restart_delay, &afi[s->format].restart_barrier);
}
static void kill_all_decoders(void)
}
static void kill_all_decoders(void)
return -E_NO_MORE_SLOTS;
}
return -E_NO_MORE_SLOTS;
}
-static int decoder_running(int format)
-{
- int i, ret = 0;
- struct slot_info *s;
-
- FOR_EACH_SLOT(i) {
- s = &slot[i];
- if (s->format == format && s->receiver_node)
- ret |= 1;
- if (s->format == format && s->wng)
- ret |= 2;
- }
- return ret;
-}
-
static void close_stat_pipe(void)
{
int i;
static void close_stat_pipe(void)
{
int i;
static void rn_event_handler(struct task *t)
{
struct receiver_node *rn = t->private_data;
static void rn_event_handler(struct task *t)
{
struct receiver_node *rn = t->private_data;
+ const struct timeval restart_delay = {0, 10 * 1000};
+ int i;
PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
unregister_task(t);
rn->eof = 1;
PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
unregister_task(t);
rn->eof = 1;
+ /* set restart barrier */
+ FOR_EACH_SLOT(i) {
+ if (slot[i].receiver_node != rn)
+ continue;
+ tv_add(now, &restart_delay, &afi[slot[i].format].restart_barrier);
+ }
}
static void open_receiver(int format)
}
static void open_receiver(int format)
register_task(&rn->task);
}
register_task(&rn->task);
}
+static int receiver_running(int format)
+{
+ int i;
+
+ FOR_EACH_SLOT(i) {
+ struct slot_info *s = &slot[i];
+ if (s->format == format && s->receiver_node
+ && !s->receiver_node->eof)
+ return 1;
+ }
+ return 0;
+}
+
static int open_current_receiver(struct sched *s)
{
int i;
static int open_current_receiver(struct sched *s)
{
int i;
i = get_audio_format_num(stat_task->af_status);
if (i < 0)
return 0;
i = get_audio_format_num(stat_task->af_status);
if (i < 0)
return 0;
- if (decoder_running(i))
+ if (receiver_running(i))
return 0;
if (tv_diff(now, &afi[i].restart_barrier, &diff) < 0) {
s->timeout = diff;
return 0;
if (tv_diff(now, &afi[i].restart_barrier, &diff) < 0) {
s->timeout = diff;