aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpdemux
diff options
context:
space:
mode:
authorGravatar bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-22 06:12:18 +0000
committerGravatar bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-22 06:12:18 +0000
commit63ddd5ab74742580942c388c507086470eb7580a (patch)
tree4483bd2b2c0fc96ba198b018a87107bb5e072171 /libmpdemux
parent361bd9c4f6e7db81e8ae953f51b35c0618c0d60f (diff)
Modified the cache option value setting/reading, so we can report
in any case the cache size value used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4303 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/network.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/libmpdemux/network.c b/libmpdemux/network.c
index 3110691f39..667c4174b6 100644
--- a/libmpdemux/network.c
+++ b/libmpdemux/network.c
@@ -712,18 +712,30 @@ streaming_start(stream_t *stream, int demuxer_type, URL_t *url) {
streaming_ctrl_free( stream->streaming_ctrl );
stream->streaming_ctrl = NULL;
} else if( stream->streaming_ctrl->buffering) {
- int ret;
+ int cache_size = 0;
+ int ret, val;
ret = m_config_is_option_set(mconfig,"cache");
if(ret < 0) {
- printf("Unable to know if cache size option was set\n");
+ printf("Unable to know if cache size option was set\n");
} else if(!ret) {
- // buffer in KBytes, *5 because the prefill is 20% of the buffer.
- if(m_config_set_int(mconfig,"cache",(stream->streaming_ctrl->prebuffer_size/1024)*5))
- printf("Cache size set to %d KBytes\n",(stream->streaming_ctrl->prebuffer_size/1024)*5);
- else
- printf("Unable to set the cache size option\n");
- } else
- printf("Cache size alredy set\n");
+ // cache option not set, will use the our computed value.
+ // buffer in KBytes, *5 because the prefill is 20% of the buffer.
+ val = (stream->streaming_ctrl->prebuffer_size/1024)*5;
+ if( m_config_set_int( mconfig, "cache", val )<0 ) {
+ printf("Unable to set the cache size option\n");
+ } else {
+ cache_size = val;
+ }
+ } else {
+ // cache option set, will use the given one.
+ val = m_config_get_int( mconfig, "cache", NULL );
+ if( val<0 ) {
+ printf("Unable to retrieve the cache option value\n");
+ } else {
+ cache_size = val;
+ }
+ }
+ printf("Cache size set to %d KBytes\n", cache_size );
}
return ret;
}