Mercurial > mplayer.hg
changeset 4289:973c6912c586
Set the cache value if the network layer was able to compute it.
author | bertrand |
---|---|
date | Sun, 20 Jan 2002 21:39:56 +0000 |
parents | b84e9861461c |
children | 1f8ceb12284d |
files | libmpdemux/network.c |
diffstat | 1 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/network.c Sun Jan 20 21:38:11 2002 +0000 +++ b/libmpdemux/network.c Sun Jan 20 21:39:56 2002 +0000 @@ -18,6 +18,7 @@ #include "stream.h" #include "demuxer.h" +#include "../cfgparser.h" #include "network.h" #include "http.h" @@ -26,6 +27,7 @@ #include "rtp.h" extern int verbose; +extern m_config_t *mconfig; static struct { char *mime_type; @@ -546,10 +548,8 @@ stream->streaming_ctrl->streaming_read = nop_streaming_read; stream->streaming_ctrl->streaming_seek = nop_streaming_seek; - stream->streaming_ctrl->prebuffer_size = 180000; -// stream->streaming_ctrl->prebuffer_size = 0; + stream->streaming_ctrl->prebuffer_size = 4096; // KBytes stream->streaming_ctrl->buffering = 1; -// stream->streaming_ctrl->buffering = 0; stream->streaming_ctrl->status = streaming_playing_e; return 0; } @@ -649,8 +649,8 @@ streaming_ctrl->streaming_read = rtp_streaming_read; streaming_ctrl->streaming_seek = nop_streaming_seek; - streaming_ctrl->prebuffer_size = 180000; - streaming_ctrl->buffering = 0; //1; + streaming_ctrl->prebuffer_size = 4096; // KBytes + streaming_ctrl->buffering = 0; streaming_ctrl->status = streaming_playing_e; return 0; } @@ -700,7 +700,7 @@ // the network stream, it's a raw stream ret = nop_streaming_start( stream ); if( ret<0 ) { - printf("asf_streaming_start failed\n"); + printf("nop_streaming_start failed\n"); } break; default: @@ -711,7 +711,19 @@ if( ret<0 ) { streaming_ctrl_free( stream->streaming_ctrl ); stream->streaming_ctrl = NULL; - } + } else if( stream->streaming_ctrl->buffering ) { + char cache_size[10]; + int ret=-1; + // buffer in KBytes, *5 because the prefill is 20% of the buffer. + sprintf( cache_size, "%d", (stream->streaming_ctrl->prebuffer_size/1024)*5 ); +printf("Cache size = %s KBytes\n", cache_size ); + ret = m_config_set_option(mconfig, "cache", cache_size ); + if( ret<0 ) { + printf("Unable to set the cache size option (return=%d)\n", ret ); + } else { + printf("Cache size set to %s KBytes\n", cache_size ); + } + } return ret; }