some audiod fixes
authorAndre <maan@p133.(none)>
Sun, 4 Jun 2006 19:44:17 +0000 (21:44 +0200)
committerAndre <maan@p133.(none)>
Sun, 4 Jun 2006 19:44:17 +0000 (21:44 +0200)
comment out code for unregistering the receiver node from close_receiver.

kill all decoders if !playing

try to close slots in audiod_post_select() rather than in pre_select().
This should fix BADFD error from select().

audiod.c

index f08be18..29ceda5 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -506,8 +506,8 @@ static void close_receiver(int slot_num)
        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);
+//     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;
@@ -944,7 +944,7 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
 
        t->ret = 1;
        now = &s->now;
-       if (audiod_status != AUDIOD_ON)
+       if (audiod_status != AUDIOD_ON || !playing)
                kill_all_decoders();
        else if (playing)
                open_current_receiver();
@@ -952,7 +952,6 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                struct slot_info *s = &slot[i];
                struct audio_format_info *a;
 
-               try_to_close_slot(i);
                if (s->format < 0)
                        continue;
                a = &afi[s->format];
@@ -974,9 +973,13 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
 
 static void audiod_post_select(struct sched *s, __a_unused struct task *t)
 {
-       /* only save away the current time for other users */
+       int i;
+
+       /* save away the current time for other users */
        now = &s->now;
        t->ret = 1;
+       FOR_EACH_SLOT(i)
+               try_to_close_slot(i);
 }
 
 static void init_audiod_task(struct task *t)