comparison stream/cache2.c @ 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 26eddbd6353a
comparison
equal deleted inserted replaced
34487:ebf95780af6e 34488:01c19d9b1e83
267 double double_res; 267 double double_res;
268 unsigned uint_res; 268 unsigned uint_res;
269 int needs_flush = 0; 269 int needs_flush = 0;
270 static unsigned last; 270 static unsigned last;
271 int quit = s->control == -2; 271 int quit = s->control == -2;
272 uint64_t old_pos = s->stream->pos;
273 int old_eof = s->stream->eof;
272 if (quit || !s->stream->control) { 274 if (quit || !s->stream->control) {
273 s->stream_time_length = 0; 275 s->stream_time_length = 0;
274 s->stream_time_pos = MP_NOPTS_VALUE; 276 s->stream_time_pos = MP_NOPTS_VALUE;
275 s->control_res = STREAM_UNSUPPORTED; 277 s->control_res = STREAM_UNSUPPORTED;
276 s->control = -1; 278 s->control = -1;
322 } 324 }
323 if (s->control_res == STREAM_OK && needs_flush) { 325 if (s->control_res == STREAM_OK && needs_flush) {
324 s->read_filepos = s->stream->pos; 326 s->read_filepos = s->stream->pos;
325 s->eof = s->stream->eof; 327 s->eof = s->stream->eof;
326 cache_flush(s); 328 cache_flush(s);
327 } 329 } else if (needs_flush &&
330 (old_pos != s->stream->pos || old_eof != s->stream->eof))
331 mp_msg(MSGT_STREAM, MSGL_ERR, "STREAM_CTRL changed stream pos but returned error, this is not allowed!\n");
328 s->control = -1; 332 s->control = -1;
329 return 1; 333 return 1;
330 } 334 }
331 335
332 static void *shared_alloc(int size) { 336 static void *shared_alloc(int size) {