Index: roard/streams.c
===================================================================
--- roard/streams.c	(revision 4229)
+++ roard/streams.c	(revision 4237)
@@ -136,4 +136,5 @@
    g_streams[i] = s;
    counters_inc(streams, 1);
+   ROAR_INFO("streams_new(void): New stream %i created (state=initing)", ROAR_DBG_INFO_VERBOSE, i);
    ROAR_DBG("streams_new(void): n->id=%i", n->id);
    ROAR_DBG("streams_new(void) = %i", i);
@@ -164,4 +165,5 @@
   return 0;
 
+ ROAR_INFO("streams_delete(id=%i): stream state: %s->closing", ROAR_DBG_INFO_VERBOSE, id, roar_streamstate2str(s->state));
  s->state = ROAR_STREAMSTATE_CLOSING;
 
@@ -591,4 +593,5 @@
  if ( fh == -1 || fh == -2 ) { // yes, this is valid, indecats full vio!
   ss->ready = 1;
+  ROAR_INFO("streams_set_fh(id=%i, fh=%i): stream state: %s->new", ROAR_DBG_INFO_VERBOSE, id, fh, roar_streamstate2str(ss->state));
   ss->state = ROAR_STREAMSTATE_NEW;
   return 0;
@@ -627,4 +630,5 @@
  if ( !nonblock ) {
   ss->ready = 1;
+  ROAR_INFO("streams_set_fh(id=%i, fh=%i): stream state: %s->new", ROAR_DBG_INFO_VERBOSE, id, fh, roar_streamstate2str(ss->state));
   ss->state = ROAR_STREAMSTATE_NEW;
 
@@ -639,4 +643,5 @@
   ss->ready = 1;
   ss->state = ROAR_STREAMSTATE_NEW;
+  ROAR_INFO("streams_set_fh(id=%i, fh=%i): stream state: %s->new", ROAR_DBG_INFO_VERBOSE, id, fh, roar_streamstate2str(ss->state));
 
   ROAR_DBG("streams_set_fh(id=%i, fh=%i) = 0", id, fh);
@@ -1709,4 +1714,7 @@
     if ( ss->codecfilter != -1 ) {
      if ( codecfilter_write(ss->codecfilter_inst, ss->codecfilter, NULL, 0) == 0 )
+      if ( ss->state != ROAR_STREAMSTATE_OLD ) {
+       ROAR_INFO("streams_send_mon(id=%i): stream state: %s->old", ROAR_DBG_INFO_VERBOSE, id, roar_streamstate2str(ss->state));
+      }
       ss->state = ROAR_STREAMSTATE_OLD;
     }
@@ -1799,4 +1807,7 @@
   if ( (ret = stream_vio_s_write(ss, obuf, olen)) == olen ) {
    s->pos = ROAR_MATH_OVERFLOW_ADD(s->pos, ROAR_OUTPUT_CALC_OUTBUFSAMP(&(s->info), olen)*s->info.channels);
+   if ( ss->state != ROAR_STREAMSTATE_OLD ) {
+    ROAR_INFO("streams_send_mon(id=%i): stream state: %s->old", ROAR_DBG_INFO_VERBOSE, id, roar_streamstate2str(ss->state));
+   }
    ss->state = ROAR_STREAMSTATE_OLD;
    ROAR_DBG("streams_send_mon(id=%i) = 0", id);
@@ -1809,4 +1820,7 @@
    ROAR_WARN("streams_send_mon(id=%i): Overrun in stream: wrote %i of %i bytes, %i bytes missing", id, (int)ret, olen, olen-(int)ret);
    s->pos = ROAR_MATH_OVERFLOW_ADD(s->pos, ROAR_OUTPUT_CALC_OUTBUFSAMP(&(s->info), ret)*s->info.channels);
+   if ( ss->state != ROAR_STREAMSTATE_OLD ) {
+    ROAR_INFO("streams_send_mon(id=%i): stream state: %s->old", ROAR_DBG_INFO_VERBOSE, id, roar_streamstate2str(ss->state));
+   }
    ss->state = ROAR_STREAMSTATE_OLD;
    _return(0);
@@ -1817,4 +1831,7 @@
             == olen ) {
    s->pos = ROAR_MATH_OVERFLOW_ADD(s->pos, ROAR_OUTPUT_CALC_OUTBUFSAMP(&(s->info), olen)*s->info.channels);
+   if ( ss->state != ROAR_STREAMSTATE_OLD ) {
+    ROAR_INFO("streams_send_mon(id=%i): stream state: %s->old", ROAR_DBG_INFO_VERBOSE, id, roar_streamstate2str(ss->state));
+   }
    ss->state = ROAR_STREAMSTATE_OLD;
    _return(0);
@@ -1837,4 +1854,7 @@
   if ( stream_vio_s_write(ss, obuf, olen) == olen ) {
    s->pos = ROAR_MATH_OVERFLOW_ADD(s->pos, ROAR_OUTPUT_CALC_OUTBUFSAMP(&(s->info), olen)*s->info.channels);
+   if ( ss->state != ROAR_STREAMSTATE_OLD ) {
+    ROAR_INFO("streams_send_mon(id=%i): stream state: %s->old", ROAR_DBG_INFO_VERBOSE, id, roar_streamstate2str(ss->state));
+   }
    ss->state = ROAR_STREAMSTATE_OLD;
    _return(0);
@@ -1947,6 +1967,10 @@
        streams_delete(i);
 
-      if ( g_streams[i] != NULL )
+      if ( g_streams[i] != NULL ) {
+       if ( g_streams[i]->state != ROAR_STREAMSTATE_OLD ) {
+        ROAR_INFO("stream_vio_s_read(*): (stream: %i) stream state: %s->old", ROAR_DBG_INFO_VERBOSE, i, roar_streamstate2str(g_streams[i]->state));
+       }
        g_streams[i]->state = ROAR_STREAMSTATE_OLD;
+      }
      }
     }
@@ -1990,6 +2014,10 @@
       }
 
-      if ( g_streams[i] != NULL )
+      if ( g_streams[i] != NULL ) {
+       if ( g_streams[i]->state != ROAR_STREAMSTATE_OLD ) {
+        ROAR_INFO("stream_vio_s_write(*): (stream: %i) stream state: %s->old", ROAR_DBG_INFO_VERBOSE, i, roar_streamstate2str(g_streams[i]->state));
+       }
        g_streams[i]->state = ROAR_STREAMSTATE_OLD;
+      }
      }
     }
