comparison libmpdemux/network.c @ 4302:9f12fd5f47d0

Modified the cache option value setting/reading, so we can report in any case the cache size value used.
author bertrand
date Tue, 22 Jan 2002 06:12:18 +0000
parents 1b6f6519b037
children bab3aac84143
comparison
equal deleted inserted replaced
4301:8f43b10f387f 4302:9f12fd5f47d0
710 710
711 if( ret<0 ) { 711 if( ret<0 ) {
712 streaming_ctrl_free( stream->streaming_ctrl ); 712 streaming_ctrl_free( stream->streaming_ctrl );
713 stream->streaming_ctrl = NULL; 713 stream->streaming_ctrl = NULL;
714 } else if( stream->streaming_ctrl->buffering) { 714 } else if( stream->streaming_ctrl->buffering) {
715 int ret; 715 int cache_size = 0;
716 int ret, val;
716 ret = m_config_is_option_set(mconfig,"cache"); 717 ret = m_config_is_option_set(mconfig,"cache");
717 if(ret < 0) { 718 if(ret < 0) {
718 printf("Unable to know if cache size option was set\n"); 719 printf("Unable to know if cache size option was set\n");
719 } else if(!ret) { 720 } else if(!ret) {
720 // buffer in KBytes, *5 because the prefill is 20% of the buffer. 721 // cache option not set, will use the our computed value.
721 if(m_config_set_int(mconfig,"cache",(stream->streaming_ctrl->prebuffer_size/1024)*5)) 722 // buffer in KBytes, *5 because the prefill is 20% of the buffer.
722 printf("Cache size set to %d KBytes\n",(stream->streaming_ctrl->prebuffer_size/1024)*5); 723 val = (stream->streaming_ctrl->prebuffer_size/1024)*5;
723 else 724 if( m_config_set_int( mconfig, "cache", val )<0 ) {
724 printf("Unable to set the cache size option\n"); 725 printf("Unable to set the cache size option\n");
725 } else 726 } else {
726 printf("Cache size alredy set\n"); 727 cache_size = val;
728 }
729 } else {
730 // cache option set, will use the given one.
731 val = m_config_get_int( mconfig, "cache", NULL );
732 if( val<0 ) {
733 printf("Unable to retrieve the cache option value\n");
734 } else {
735 cache_size = val;
736 }
737 }
738 printf("Cache size set to %d KBytes\n", cache_size );
727 } 739 }
728 return ret; 740 return ret;
729 } 741 }
730 742
731 int 743 int