summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-01 23:28:58 +0100
committerwm4 <wm4@nowhere>2012-12-03 21:08:51 +0100
commit6294c785490be5fc31d29758ca592510fd161371 (patch)
treea03c9135534f28cf7e9a62abcde87c65eb54eeaa /stream/stream.c
parent2d58234c86e59298de52fec12d1eb59086d68763 (diff)
downloadmpv-6294c785490be5fc31d29758ca592510fd161371.tar.bz2
mpv-6294c785490be5fc31d29758ca592510fd161371.tar.xz
cache: simplify further
This commit is separate from the previous one to separate our own changes from changes merged from mplayer2 (as far as that was possible). Make it easier for stream implementations to request being cached. Set a default cache size in stream.c, and remove them from various stream implementations. Only MS streaming support sets a meaningful cache size. Make querying cache size saner. This reduces the amount of #ifdefs needed.
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/stream/stream.c b/stream/stream.c
index bd87448fac..6e0644e59c 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -183,13 +183,9 @@ static stream_t *open_stream_plugin(const stream_info_t *sinfo,
return NULL;
}
- s->cache_size = 0;
- if (s->streaming_ctrl && s->streaming_ctrl->buffering) {
+ if (s->streaming && !s->cache_size) {
// Set default cache size to use if user does not specify it.
- // buffer in KBytes, *5 assuming the prefill is 20% of the buffer.
- s->cache_size = s->streaming_ctrl->prebuffer_size / 1024 * 5;
- if (s->cache_size < 64)
- s->cache_size = 64;
+ s->cache_size = 320;
}
if(s->type <= -2)
@@ -480,11 +476,11 @@ void stream_reset(stream_t *s){
}
int stream_control(stream_t *s, int cmd, void *arg){
- if(!s->control) return STREAM_UNSUPPORTED;
#ifdef CONFIG_STREAM_CACHE
if (s->cache_pid)
return cache_do_control(s, cmd, arg);
#endif
+ if(!s->control) return STREAM_UNSUPPORTED;
return s->control(s, cmd, arg);
}