changeset 34488:01c19d9b1e83

Print an error when streams behave in a way that the cache cannot handle.
author reimar
date Sun, 15 Jan 2012 12:38:38 +0000
parents ebf95780af6e
children bdc9f135ac26
files stream/cache2.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stream/cache2.c	Sun Jan 15 12:23:40 2012 +0000
+++ b/stream/cache2.c	Sun Jan 15 12:38:38 2012 +0000
@@ -269,6 +269,8 @@
   int needs_flush = 0;
   static unsigned last;
   int quit = s->control == -2;
+  uint64_t old_pos = s->stream->pos;
+  int old_eof = s->stream->eof;
   if (quit || !s->stream->control) {
     s->stream_time_length = 0;
     s->stream_time_pos = MP_NOPTS_VALUE;
@@ -324,7 +326,9 @@
     s->read_filepos = s->stream->pos;
     s->eof = s->stream->eof;
     cache_flush(s);
-  }
+  } else if (needs_flush &&
+             (old_pos != s->stream->pos || old_eof != s->stream->eof))
+    mp_msg(MSGT_STREAM, MSGL_ERR, "STREAM_CTRL changed stream pos but returned error, this is not allowed!\n");
   s->control = -1;
   return 1;
 }