[xiph-commits] r3137 - in liboggplay/trunk: plugin/test src/liboggplay

shans at svn.annodex.net shans at svn.annodex.net
Thu Jun 28 18:06:12 PDT 2007


Author: shans
Date: 2007-06-28 18:06:12 -0700 (Thu, 28 Jun 2007)
New Revision: 3137

Added:
   liboggplay/trunk/plugin/test/eat_tv.html
Modified:
   liboggplay/trunk/src/liboggplay/oggplay.c
   liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
Log:
Fixed bug in tcp handling of slow streams
new test page (eatTV!)



Added: liboggplay/trunk/plugin/test/eat_tv.html
===================================================================
--- liboggplay/trunk/plugin/test/eat_tv.html	                        (rev 0)
+++ liboggplay/trunk/plugin/test/eat_tv.html	2007-06-29 01:06:12 UTC (rev 3137)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>Eat TV</title>
+</head>
+<body>
+<embed type="application/liboggplay" 
+       src="http://editingarchive.com:8000/eatv-public.ogg"
+       width=640 height=480/>
+</body>

Modified: liboggplay/trunk/src/liboggplay/oggplay.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay.c	2007-06-29 00:47:23 UTC (rev 3136)
+++ liboggplay/trunk/src/liboggplay/oggplay.c	2007-06-29 01:06:12 UTC (rev 3137)
@@ -130,8 +130,13 @@
 oggplay_open_with_reader(OggPlayReader *reader) {
 
   OggPlay *me = oggplay_new_with_reader(reader);
-  
-  if (oggplay_initialise(me, 0) != E_OGGPLAY_OK) {
+ 
+  int r = E_OGGPLAY_TIMEOUT;
+  while (r == E_OGGPLAY_TIMEOUT) {
+    r = oggplay_initialise(me, 0);
+  }
+
+  if (r != E_OGGPLAY_OK) {
     free(me);
     return NULL;
   }

Modified: liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c	2007-06-29 00:47:23 UTC (rev 3136)
+++ liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c	2007-06-29 01:06:12 UTC (rev 3137)
@@ -246,6 +246,8 @@
 
 }
 
+#include <error.h>
+
 OggPlayErrorCode
 oggplay_tcp_reader_initialise(OggPlayReader * opr, int block) {
 
@@ -380,10 +382,10 @@
       remaining = TCP_READER_MAX_IN_MEMORY - me->amount_in_memory - 1;
 #ifdef WIN32
       nbytes = recv(me->socket, (char*)(me->buffer + me->amount_in_memory), 
-              remaining - 1, 0);
+              remaining, 0);
 #else
       nbytes = read(me->socket, (char*)(me->buffer + me->amount_in_memory), 
-              remaining - 1);
+              remaining);
 #endif
       if (nbytes < 0) {
         return E_OGGPLAY_SOCKET_ERROR;
@@ -424,7 +426,6 @@
 
       pos = strstr((char *)(me->buffer), "OggS");
       if (pos != NULL) {
-        printf("found oggz\n");
         break;
       }
     }
@@ -440,6 +441,7 @@
     me->state = OTRS_HTTP_RESPONDED;
   }
 
+
     
   /*
    * Read in enough data to fill the buffer.
@@ -449,7 +451,7 @@
   }
 
   if (me->state == OTRS_HTTP_RESPONDED) {
-    remaining = TCP_READER_MAX_IN_MEMORY - me->stored_offset;
+    remaining = TCP_READER_MAX_IN_MEMORY - me->amount_in_memory;
     START_TIMEOUT(time_ref);
     while (remaining > 0) {
 #ifdef WIN32
@@ -466,6 +468,7 @@
 #endif
           RETURN_ON_TIMEOUT_OR_CONTINUE(time_ref);
         }
+        error(0, errno, "ERROR");
         return E_OGGPLAY_SOCKET_ERROR;
       } else if (nbytes == 0) {
         /*



More information about the commits mailing list