[xiph-cvs] cvs commit: ices/src audio.c input.c stream.c

Michael Smith msmith at xiph.org
Fri Aug 9 21:50:00 PDT 2002



msmith      02/08/10 00:50:00

  Modified:    src      audio.c input.c stream.c
  Log:
  Make ices more tolerant of certain corrupt streams.

Revision  Changes    Path
1.3       +5 -1      ices/src/audio.c

Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/audio.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- audio.c	3 Aug 2002 14:41:10 -0000	1.2
+++ audio.c	10 Aug 2002 04:50:00 -0000	1.3
@@ -2,7 +2,7 @@
  * stereo->mono downmixing
  * resampling
  *
- * $Id: audio.c,v 1.2 2002/08/03 14:41:10 msmith Exp $
+ * $Id: audio.c,v 1.3 2002/08/10 04:50:00 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -156,6 +156,10 @@
     int res;
 
     s->buffill = res_push_check(&s->resampler, buflen);
+    if(s->buffill <= 0) {
+        LOG_ERROR1("Fatal reencoding error: res_push_check returned %d", 
+                s->buffill);
+    }
 
     if(s->bufsize < s->buffill) {
         s->bufsize = s->buffill;

<p><p>1.16      +12 -2     ices/src/input.c

Index: input.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/input.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- input.c	9 Aug 2002 13:59:02 -0000	1.15
+++ input.c	10 Aug 2002 04:50:00 -0000	1.16
@@ -2,7 +2,7 @@
  *  - Main producer control loop. Fetches data from input modules, and controls
  *    submission of these to the instance threads. Timing control happens here.
  *
- * $Id: input.c,v 1.15 2002/08/09 13:59:02 msmith Exp $
+ * $Id: input.c,v 1.16 2002/08/10 04:50:00 msmith Exp $
  * 
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -141,6 +141,11 @@
                 ogg_stream_clear(&os);
         }
 
+    if(ogg_page_granulepos(&og) == -1) {
+        LOG_ERROR0("Timing control: corrupt timing information in vorbis file, cannot stream.");
+        return -1;
+    }
+
         control->samples = ogg_page_granulepos(&og) - control->oldsamples;
         control->oldsamples = ogg_page_granulepos(&og);
 
@@ -372,8 +377,13 @@
                                 break;
                 }
 
-        if(ret < 0)
+        if(ret < 0) {
+            /* Tell the input module to go to the next track, hopefully allowing
+             * resync. */
+	        ices_config->inmod->handle_event(ices_config->inmod,
+                    EVENT_NEXTTRACK,NULL);
             valid_stream = 0;
+        }
 
         inc_count = 0;
 

<p><p>1.17      +4 -2      ices/src/stream.c

Index: stream.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/stream.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- stream.c	10 Aug 2002 03:31:27 -0000	1.16
+++ stream.c	10 Aug 2002 04:50:00 -0000	1.17
@@ -1,7 +1,7 @@
 /* stream.c
  * - Core streaming functions/main loop.
  *
- * $Id: stream.c,v 1.16 2002/08/10 03:31:27 msmith Exp $
+ * $Id: stream.c,v 1.17 2002/08/10 04:50:00 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -64,6 +64,8 @@
         shout_set_format(sdsc->shout, SHOUT_FORMAT_VORBIS);
         shout_set_protocol(sdsc->shout, SHOUT_PROTOCOL_ICE);
 
+    signal(SIGPIPE, signal_hup_handler);
+
         connip = malloc(16);
         if(!resolver_getip(stream->hostname, connip, 16))
         {
@@ -279,7 +281,7 @@
     if(stream->savefile != NULL) 
         fclose(stream->savefile);
 
-    	shout_free(sdsc->shout);
+    shout_free(sdsc->shout);
         encode_clear(sdsc->enc);
         reencode_clear(sdsc->reenc);
     downmix_clear(sdsc->downmix);

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list