Diff of /src/demuxers/demux_ogg.c [1db887] .. [6fa58e] Maximize Restore

  Switch to side-by-side view

--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.c
@@ -233,13 +233,19 @@
 static int read_ogg_packet (demux_ogg_t *this) {
   char *buffer;
   long bytes;
+  long total = 0;
   while (ogg_sync_pageout(&this->oy,&this->og)!=1) {
     buffer = ogg_sync_buffer(&this->oy, CHUNKSIZE);
     bytes  = this->input->read(this->input, buffer, CHUNKSIZE);
+    if (bytes == 0) {
+      if (total == 0) {
+        printf("read_ogg_packet read nothing\n");
+        return 0;
+      }
+      break;
+    }
     ogg_sync_wrote(&this->oy, bytes);
-    if (bytes < CHUNKSIZE/2) {
-      return 0;
-    }
+    total += bytes;
   }
   return 1;
 }
@@ -1346,7 +1352,6 @@
 
   while (!done) {
     if (!read_ogg_packet(this)) {
-      this->status = DEMUX_FINISHED;
       return;
     }
     /* now we've got at least one new page */