winlin

refine code, add comments for bandwidth; remove the bwtc configure script test item.

@@ -119,12 +119,6 @@ ok_msg "test \" ${item} \"" @@ -119,12 +119,6 @@ ok_msg "test \" ${item} \""
119 ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi 119 ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
120 ok_msg "test \" ${item} \" success" 120 ok_msg "test \" ${item} \" success"
121 121
122 -item="./configure --fast --with-bwtc"  
123 -ok_msg "test \" ${item} \""  
124 -(./configure --fast --with-bwtc && make) >>$log 2>&1  
125 -ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi  
126 -ok_msg "test \" ${item} \" success"  
127 -  
128 item="./configure --fast --with-research" 122 item="./configure --fast --with-research"
129 ok_msg "test \" ${item} \"" 123 ok_msg "test \" ${item} \""
130 (./configure --fast --with-research && make) >>$log 2>&1 124 (./configure --fast --with-research && make) >>$log 2>&1
@@ -141,20 +141,60 @@ private: @@ -141,20 +141,60 @@ private:
141 * @param limit, the bandwidth limit object, to slowdown if exceed the kbps. 141 * @param limit, the bandwidth limit object, to slowdown if exceed the kbps.
142 */ 142 */
143 virtual int do_bandwidth_check(SrsKbpsLimit* limit); 143 virtual int do_bandwidth_check(SrsKbpsLimit* limit);
  144 +// play check/test, downloading bandwidth kbps.
  145 +private:
144 /** 146 /**
145 - * play check/test, downloading bandwidth kbps. 147 + * start play/download bandwidth check/test,
  148 + * send start-play command to client, client must response starting-play
  149 + * to start the test.
146 */ 150 */
147 virtual int play_start(SrsBandwidthSample* sample, SrsKbpsLimit* limit); 151 virtual int play_start(SrsBandwidthSample* sample, SrsKbpsLimit* limit);
  152 + /**
  153 + * do play/download bandwidth check/test,
  154 + * server send call messages to client in specified time,
  155 + * calc the time and bytes sent, then we got the kbps.
  156 + */
148 virtual int play_checking(SrsBandwidthSample* sample, SrsKbpsLimit* limit); 157 virtual int play_checking(SrsBandwidthSample* sample, SrsKbpsLimit* limit);
  158 + /**
  159 + * stop play/download bandwidth check/test,
  160 + * send stop-play command to client, client must response stopped-play
  161 + * to stop the test.
  162 + */
149 virtual int play_stop(SrsBandwidthSample* sample, SrsKbpsLimit* limit); 163 virtual int play_stop(SrsBandwidthSample* sample, SrsKbpsLimit* limit);
  164 +// publish check/test, publishing bandwidth kbps.
  165 +private:
150 /** 166 /**
151 - * publish check/test, publishing bandwidth kbps. 167 + * start publish/upload bandwidth check/test,
  168 + * send start-publish command to client, client must response starting-publish
  169 + * to start the test.
152 */ 170 */
153 virtual int publish_start(SrsBandwidthSample* sample, SrsKbpsLimit* limit); 171 virtual int publish_start(SrsBandwidthSample* sample, SrsKbpsLimit* limit);
  172 + /**
  173 + * do publish/upload bandwidth check/test,
  174 + * client send call messages to client in specified time,
  175 + * server calc the time and bytes received, then we got the kbps.
  176 + * @remark, for linux client, it will send a stop publish client, server will stop publishing.
  177 + * then enter the publish-stop stage with client.
  178 + * @remark, for flash client, it will send many many call messages, that is,
  179 + * the send queue is fullfill with call messages, so we should never expect the
  180 + * response message in the publish-stop stage.
  181 + */
154 virtual int publish_checking(SrsBandwidthSample* sample, SrsKbpsLimit* limit); 182 virtual int publish_checking(SrsBandwidthSample* sample, SrsKbpsLimit* limit);
  183 + /**
  184 + * stop publish/upload bandwidth check/test,
  185 + * send stop-publish command to client,
  186 + * for linux client, always expect a stopped-publish response from client,
  187 + * for flash client, the sent queue is fullfill with publishing call messages,
  188 + * so server never expect the stopped-publish from it.
  189 + */
155 virtual int publish_stop(SrsBandwidthSample* sample, SrsKbpsLimit* limit); 190 virtual int publish_stop(SrsBandwidthSample* sample, SrsKbpsLimit* limit);
  191 +private:
156 /** 192 /**
157 * report and final packet 193 * report and final packet
  194 + * report a finish packet, with the bytes/time/kbps bandwidth check/test result,
  195 + * for linux client, server always expect a final packet from client,
  196 + * for flash client, the sent queue is fullfill with publishing call messages,
  197 + * so server never expect the final packet from it.
158 */ 198 */
159 virtual int finial(SrsBandwidthSample& play_sample, SrsBandwidthSample& publish_sample, int64_t start_time, int64_t& end_time); 199 virtual int finial(SrsBandwidthSample& play_sample, SrsBandwidthSample& publish_sample, int64_t start_time, int64_t& end_time);
160 }; 200 };