winlin

refine the space of code.

@@ -2173,8 +2173,8 @@ int SrsRtmpClient::play(string stream, int stream_id) @@ -2173,8 +2173,8 @@ int SrsRtmpClient::play(string stream, int stream_id)
2173 pkt->stream_name = stream; 2173 pkt->stream_name = stream;
2174 if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) { 2174 if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) {
2175 srs_error("send play stream failed. " 2175 srs_error("send play stream failed. "
2176 - "stream=%s, stream_id=%d, ret=%d",  
2177 - stream.c_str(), stream_id, ret); 2176 + "stream=%s, stream_id=%d, ret=%d",
  2177 + stream.c_str(), stream_id, ret);
2178 return ret; 2178 return ret;
2179 } 2179 }
2180 } 2180 }
@@ -2190,8 +2190,8 @@ int SrsRtmpClient::play(string stream, int stream_id) @@ -2190,8 +2190,8 @@ int SrsRtmpClient::play(string stream, int stream_id)
2190 2190
2191 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { 2191 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
2192 srs_error("send set buffer length failed. " 2192 srs_error("send set buffer length failed. "
2193 - "stream=%s, stream_id=%d, bufferLength=%d, ret=%d",  
2194 - stream.c_str(), stream_id, buffer_length_ms, ret); 2193 + "stream=%s, stream_id=%d, bufferLength=%d, ret=%d",
  2194 + stream.c_str(), stream_id, buffer_length_ms, ret);
2195 return ret; 2195 return ret;
2196 } 2196 }
2197 } 2197 }
@@ -2202,8 +2202,8 @@ int SrsRtmpClient::play(string stream, int stream_id) @@ -2202,8 +2202,8 @@ int SrsRtmpClient::play(string stream, int stream_id)
2202 pkt->chunk_size = SRS_CONSTS_RTMP_SRS_CHUNK_SIZE; 2202 pkt->chunk_size = SRS_CONSTS_RTMP_SRS_CHUNK_SIZE;
2203 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { 2203 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
2204 srs_error("send set chunk size failed. " 2204 srs_error("send set chunk size failed. "
2205 - "stream=%s, chunk_size=%d, ret=%d",  
2206 - stream.c_str(), SRS_CONSTS_RTMP_SRS_CHUNK_SIZE, ret); 2205 + "stream=%s, chunk_size=%d, ret=%d",
  2206 + stream.c_str(), SRS_CONSTS_RTMP_SRS_CHUNK_SIZE, ret);
2207 return ret; 2207 return ret;
2208 } 2208 }
2209 } 2209 }
@@ -2221,8 +2221,8 @@ int SrsRtmpClient::publish(string stream, int stream_id) @@ -2221,8 +2221,8 @@ int SrsRtmpClient::publish(string stream, int stream_id)
2221 pkt->chunk_size = SRS_CONSTS_RTMP_SRS_CHUNK_SIZE; 2221 pkt->chunk_size = SRS_CONSTS_RTMP_SRS_CHUNK_SIZE;
2222 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { 2222 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
2223 srs_error("send set chunk size failed. " 2223 srs_error("send set chunk size failed. "
2224 - "stream=%s, chunk_size=%d, ret=%d",  
2225 - stream.c_str(), SRS_CONSTS_RTMP_SRS_CHUNK_SIZE, ret); 2224 + "stream=%s, chunk_size=%d, ret=%d",
  2225 + stream.c_str(), SRS_CONSTS_RTMP_SRS_CHUNK_SIZE, ret);
2226 return ret; 2226 return ret;
2227 } 2227 }
2228 } 2228 }
@@ -2233,8 +2233,8 @@ int SrsRtmpClient::publish(string stream, int stream_id) @@ -2233,8 +2233,8 @@ int SrsRtmpClient::publish(string stream, int stream_id)
2233 pkt->stream_name = stream; 2233 pkt->stream_name = stream;
2234 if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) { 2234 if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) {
2235 srs_error("send publish message failed. " 2235 srs_error("send publish message failed. "
2236 - "stream=%s, stream_id=%d, ret=%d",  
2237 - stream.c_str(), stream_id, ret); 2236 + "stream=%s, stream_id=%d, ret=%d",
  2237 + stream.c_str(), stream_id, ret);
2238 return ret; 2238 return ret;
2239 } 2239 }
2240 } 2240 }
@@ -2253,7 +2253,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id) @@ -2253,7 +2253,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id)
2253 SrsFMLEStartPacket* pkt = SrsFMLEStartPacket::create_release_stream(stream); 2253 SrsFMLEStartPacket* pkt = SrsFMLEStartPacket::create_release_stream(stream);
2254 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { 2254 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
2255 srs_error("send FMLE publish " 2255 srs_error("send FMLE publish "
2256 - "release stream failed. stream=%s, ret=%d", stream.c_str(), ret); 2256 + "release stream failed. stream=%s, ret=%d", stream.c_str(), ret);
2257 return ret; 2257 return ret;
2258 } 2258 }
2259 } 2259 }
@@ -2263,7 +2263,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id) @@ -2263,7 +2263,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id)
2263 SrsFMLEStartPacket* pkt = SrsFMLEStartPacket::create_FC_publish(stream); 2263 SrsFMLEStartPacket* pkt = SrsFMLEStartPacket::create_FC_publish(stream);
2264 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { 2264 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
2265 srs_error("send FMLE publish " 2265 srs_error("send FMLE publish "
2266 - "FCPublish failed. stream=%s, ret=%d", stream.c_str(), ret); 2266 + "FCPublish failed. stream=%s, ret=%d", stream.c_str(), ret);
2267 return ret; 2267 return ret;
2268 } 2268 }
2269 } 2269 }
@@ -2274,7 +2274,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id) @@ -2274,7 +2274,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id)
2274 pkt->transaction_id = 4; 2274 pkt->transaction_id = 4;
2275 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { 2275 if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
2276 srs_error("send FMLE publish " 2276 srs_error("send FMLE publish "
2277 - "createStream failed. stream=%s, ret=%d", stream.c_str(), ret); 2277 + "createStream failed. stream=%s, ret=%d", stream.c_str(), ret);
2278 return ret; 2278 return ret;
2279 } 2279 }
2280 } 2280 }
@@ -2290,7 +2290,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id) @@ -2290,7 +2290,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id)
2290 SrsAutoFree(SrsCommonMessage, msg); 2290 SrsAutoFree(SrsCommonMessage, msg);
2291 SrsAutoFree(SrsCreateStreamResPacket, pkt); 2291 SrsAutoFree(SrsCreateStreamResPacket, pkt);
2292 srs_info("get create stream response message"); 2292 srs_info("get create stream response message");
2293 - 2293 +
2294 stream_id = (int)pkt->stream_id; 2294 stream_id = (int)pkt->stream_id;
2295 } 2295 }
2296 2296
@@ -2300,7 +2300,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id) @@ -2300,7 +2300,7 @@ int SrsRtmpClient::fmle_publish(string stream, int& stream_id)
2300 pkt->stream_name = stream; 2300 pkt->stream_name = stream;
2301 if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) { 2301 if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) {
2302 srs_error("send FMLE publish publish failed. " 2302 srs_error("send FMLE publish publish failed. "
2303 - "stream=%s, stream_id=%d, ret=%d", stream.c_str(), stream_id, ret); 2303 + "stream=%s, stream_id=%d, ret=%d", stream.c_str(), stream_id, ret);
2304 return ret; 2304 return ret;
2305 } 2305 }
2306 } 2306 }
@@ -2458,9 +2458,9 @@ int SrsRtmpServer::connect_app(SrsRequest* req) @@ -2458,9 +2458,9 @@ int SrsRtmpServer::connect_app(SrsRequest* req)
2458 2458
2459 srs_info("get connect app message params success."); 2459 srs_info("get connect app message params success.");
2460 2460
2461 - srs_discovery_tc_url(req->tcUrl,  
2462 - req->schema, req->host, req->vhost, req->app, req->port,  
2463 - req->param); 2461 + srs_discovery_tc_url(req->tcUrl,
  2462 + req->schema, req->host, req->vhost, req->app, req->port,
  2463 + req->param);
2464 req->strip(); 2464 req->strip();
2465 2465
2466 return ret; 2466 return ret;
@@ -2493,7 +2493,7 @@ int SrsRtmpServer::set_peer_bandwidth(int bandwidth, int type) @@ -2493,7 +2493,7 @@ int SrsRtmpServer::set_peer_bandwidth(int bandwidth, int type)
2493 return ret; 2493 return ret;
2494 } 2494 }
2495 srs_info("send set bandwidth message " 2495 srs_info("send set bandwidth message "
2496 - "success. bandwidth=%d, type=%d", bandwidth, type); 2496 + "success. bandwidth=%d, type=%d", bandwidth, type);
2497 2497
2498 return ret; 2498 return ret;
2499 } 2499 }
@@ -2558,7 +2558,7 @@ void SrsRtmpServer::response_connect_reject(SrsRequest* /*req*/, const char* des @@ -2558,7 +2558,7 @@ void SrsRtmpServer::response_connect_reject(SrsRequest* /*req*/, const char* des
2558 return; 2558 return;
2559 } 2559 }
2560 srs_info("send connect app response rejected message success."); 2560 srs_info("send connect app response rejected message success.");
2561 - 2561 +
2562 return; 2562 return;
2563 } 2563 }
2564 2564
@@ -2589,7 +2589,7 @@ int SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string& @@ -2589,7 +2589,7 @@ int SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string&
2589 } 2589 }
2590 return ret; 2590 return ret;
2591 } 2591 }
2592 - 2592 +
2593 SrsAutoFree(SrsCommonMessage, msg); 2593 SrsAutoFree(SrsCommonMessage, msg);
2594 SrsMessageHeader& h = msg->header; 2594 SrsMessageHeader& h = msg->header;
2595 2595
@@ -2599,7 +2599,7 @@ int SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string& @@ -2599,7 +2599,7 @@ int SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string&
2599 2599
2600 if (!h.is_amf0_command() && !h.is_amf3_command()) { 2600 if (!h.is_amf0_command() && !h.is_amf3_command()) {
2601 srs_trace("identify ignore messages except " 2601 srs_trace("identify ignore messages except "
2602 - "AMF0/AMF3 command message. type=%#x", h.message_type); 2602 + "AMF0/AMF3 command message. type=%#x", h.message_type);
2603 continue; 2603 continue;
2604 } 2604 }
2605 2605
@@ -2713,7 +2713,7 @@ int SrsRtmpServer::start_play(int stream_id) @@ -2713,7 +2713,7 @@ int SrsRtmpServer::start_play(int stream_id)
2713 // |RtmpSampleAccess(false, false) 2713 // |RtmpSampleAccess(false, false)
2714 if (true) { 2714 if (true) {
2715 SrsSampleAccessPacket* pkt = new SrsSampleAccessPacket(); 2715 SrsSampleAccessPacket* pkt = new SrsSampleAccessPacket();
2716 - 2716 +
2717 // allow audio/video sample. 2717 // allow audio/video sample.
2718 // @see: https://github.com/simple-rtmp-server/srs/issues/49 2718 // @see: https://github.com/simple-rtmp-server/srs/issues/49
2719 pkt->audio_sample_access = true; 2719 pkt->audio_sample_access = true;
@@ -2824,7 +2824,7 @@ int SrsRtmpServer::start_fmle_publish(int stream_id) @@ -2824,7 +2824,7 @@ int SrsRtmpServer::start_fmle_publish(int stream_id)
2824 2824
2825 SrsAutoFree(SrsCommonMessage, msg); 2825 SrsAutoFree(SrsCommonMessage, msg);
2826 SrsAutoFree(SrsFMLEStartPacket, pkt); 2826 SrsAutoFree(SrsFMLEStartPacket, pkt);
2827 - 2827 +
2828 fc_publish_tid = pkt->transaction_id; 2828 fc_publish_tid = pkt->transaction_id;
2829 } 2829 }
2830 // FCPublish response 2830 // FCPublish response
@@ -3005,17 +3005,17 @@ int SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int @@ -3005,17 +3005,17 @@ int SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int
3005 } 3005 }
3006 return ret; 3006 return ret;
3007 } 3007 }
3008 - 3008 +
3009 SrsAutoFree(SrsCommonMessage, msg); 3009 SrsAutoFree(SrsCommonMessage, msg);
3010 SrsMessageHeader& h = msg->header; 3010 SrsMessageHeader& h = msg->header;
3011 3011
3012 if (h.is_ackledgement() || h.is_set_chunk_size() || h.is_window_ackledgement_size() || h.is_user_control_message()) { 3012 if (h.is_ackledgement() || h.is_set_chunk_size() || h.is_window_ackledgement_size() || h.is_user_control_message()) {
3013 continue; 3013 continue;
3014 } 3014 }
3015 - 3015 +
3016 if (!h.is_amf0_command() && !h.is_amf3_command()) { 3016 if (!h.is_amf0_command() && !h.is_amf3_command()) {
3017 srs_trace("identify ignore messages except " 3017 srs_trace("identify ignore messages except "
3018 - "AMF0/AMF3 command message. type=%#x", h.message_type); 3018 + "AMF0/AMF3 command message. type=%#x", h.message_type);
3019 continue; 3019 continue;
3020 } 3020 }
3021 3021
@@ -3024,7 +3024,7 @@ int SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int @@ -3024,7 +3024,7 @@ int SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int
3024 srs_error("identify decode message failed. ret=%d", ret); 3024 srs_error("identify decode message failed. ret=%d", ret);
3025 return ret; 3025 return ret;
3026 } 3026 }
3027 - 3027 +
3028 SrsAutoFree(SrsPacket, pkt); 3028 SrsAutoFree(SrsPacket, pkt);
3029 3029
3030 if (dynamic_cast<SrsPlayPacket*>(pkt)) { 3030 if (dynamic_cast<SrsPlayPacket*>(pkt)) {
@@ -3085,7 +3085,7 @@ int SrsRtmpServer::identify_play_client(SrsPlayPacket* req, SrsRtmpConnType& typ @@ -3085,7 +3085,7 @@ int SrsRtmpServer::identify_play_client(SrsPlayPacket* req, SrsRtmpConnType& typ
3085 duration = req->duration; 3085 duration = req->duration;
3086 3086
3087 srs_info("identity client type=play, stream_name=%s, duration=%.2f", stream_name.c_str(), duration); 3087 srs_info("identity client type=play, stream_name=%s, duration=%.2f", stream_name.c_str(), duration);
3088 - 3088 +
3089 return ret; 3089 return ret;
3090 } 3090 }
3091 3091