[MPlayer-cvslog] r34575 - trunk/stream/cache2.c
reimar
subversion at mplayerhq.hu
Sun Jan 15 13:23:41 CET 2012
Author: reimar
Date: Sun Jan 15 13:23:40 2012
New Revision: 34575
Log:
Fix seeking with e.g. flv files.
This is a regression that was introduced in r34461.
Found and bisected by Anssi Hannula [anssi.hannula iki fi].
Modified:
trunk/stream/cache2.c
Modified: trunk/stream/cache2.c
==============================================================================
--- trunk/stream/cache2.c Sun Jan 15 13:08:26 2012 (r34574)
+++ trunk/stream/cache2.c Sun Jan 15 13:23:40 2012 (r34575)
@@ -320,7 +320,7 @@ static int cache_execute_control(cache_v
s->control_res = STREAM_UNSUPPORTED;
break;
}
- if (needs_flush) {
+ if (s->control_res == STREAM_OK && needs_flush) {
s->read_filepos = s->stream->pos;
s->eof = s->stream->eof;
cache_flush(s);
@@ -644,14 +644,19 @@ int cache_do_control(stream_t *stream, i
return STREAM_UNSUPPORTED;
}
}
- // to avoid unnecessary differences with non-cache behaviour,
- // do this also on failure.
+ if (s->control_res != STREAM_OK)
+ return s->control_res;
+ // We cannot do this on failure, since this would cause the
+ // stream position to jump when e.g. STREAM_CTRL_SEEK_TO_TIME
+ // is unsupported - but in that case we need the old value
+ // to do the fallback seek.
+ // This unfortunately can lead to slightly different behaviour
+ // with and without cache if the protocol changes pos even
+ // when an error happened.
if (pos_change) {
stream->pos = s->read_filepos;
stream->eof = s->eof;
}
- if (s->control_res != STREAM_OK)
- return s->control_res;
switch (cmd) {
case STREAM_CTRL_GET_TIME_LENGTH:
case STREAM_CTRL_GET_CURRENT_TIME:
More information about the MPlayer-cvslog
mailing list