diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-03-10 02:14:30 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-03-10 02:35:02 +0200 |
commit | bc1d0ca37d9bdfd69a945043650e0246ffeb5f94 (patch) | |
tree | 8269c9cbc1df72afb5715b77669698a0781f6250 /stream/cache2.c | |
parent | f7cc4152f7c55808c5dd6bbd49c216c9345eb686 (diff) | |
parent | e9a5e7f667d1b0c0dec0053ad9ec6f7bc3162b60 (diff) | |
download | mpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.bz2 mpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.xz |
Merge svn changes up to r30798
Diffstat (limited to 'stream/cache2.c')
-rw-r--r-- | stream/cache2.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/stream/cache2.c b/stream/cache2.c index 38061a4779..98e5d93501 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -218,14 +218,14 @@ static int cache_fill(cache_vars_t* s){ } static int cache_execute_control(cache_vars_t *s) { - int res = 1; static unsigned last; - if (!s->stream->control) { + int quit = s->control == -2; + if (quit || !s->stream->control) { s->stream_time_length = 0; s->control_new_pos = 0; s->control_res = STREAM_UNSUPPORTED; s->control = -1; - return res; + return !quit; } if (GetTimerMS() - last > 99) { double len; @@ -235,7 +235,7 @@ static int cache_execute_control(cache_vars_t *s) { s->stream_time_length = 0; last = GetTimerMS(); } - if (s->control == -1) return res; + if (s->control == -1) return 1; switch (s->control) { case STREAM_CTRL_GET_CURRENT_TIME: case STREAM_CTRL_SEEK_TO_TIME: @@ -250,15 +250,13 @@ static int cache_execute_control(cache_vars_t *s) { case STREAM_CTRL_SET_ANGLE: s->control_res = s->stream->control(s->stream, s->control, &s->control_uint_arg); break; - case -2: - res = 0; default: s->control_res = STREAM_UNSUPPORTED; break; } s->control_new_pos = s->stream->pos; s->control = -1; - return res; + return 1; } static cache_vars_t* cache_init(int size,int sector){ @@ -310,9 +308,9 @@ void cache_uninit(stream_t *s) { } if(!c) return; #if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) - free(c->stream); free(c->buffer); c->buffer = NULL; + c->stream = NULL; free(s->cache_data); #else shmem_free(c->buffer,c->buffer_size); @@ -423,12 +421,12 @@ static void ThreadProc( void *s ){ } while (cache_execute_control(s)); #if defined(__MINGW32__) || defined(__OS2__) _endthread(); -#endif -#ifdef PTHREAD_CACHE +#elif defined(PTHREAD_CACHE) return NULL; -#endif +#else // make sure forked code never leaves this function exit(0); +#endif } int cache_stream_fill_buffer(stream_t *s){ |