winlin

refine code, failed when specified complex but no ssl for srslibrtmp

@@ -80,6 +80,9 @@ void parse_amf0_object(char* p, srs_amf0_t args) @@ -80,6 +80,9 @@ void parse_amf0_object(char* p, srs_amf0_t args)
80 80
81 int main(int argc, char** argv) 81 int main(int argc, char** argv)
82 { 82 {
  83 + srs_flv_t flv = NULL;
  84 + srs_rtmp_t rtmp = NULL;
  85 +
83 printf("dump rtmp stream to flv file\n"); 86 printf("dump rtmp stream to flv file\n");
84 printf("srs(simple-rtmp-server) client librtmp library.\n"); 87 printf("srs(simple-rtmp-server) client librtmp library.\n");
85 printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); 88 printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
@@ -184,7 +187,7 @@ int main(int argc, char** argv) @@ -184,7 +187,7 @@ int main(int argc, char** argv)
184 srs_human_trace("output to console"); 187 srs_human_trace("output to console");
185 } 188 }
186 189
187 - srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url); 190 + rtmp = srs_rtmp_create(rtmp_url);
188 191
189 if (__srs_rtmp_dns_resolve(rtmp) != 0) { 192 if (__srs_rtmp_dns_resolve(rtmp) != 0) {
190 srs_human_trace("dns resolve failed."); 193 srs_human_trace("dns resolve failed.");
@@ -227,7 +230,6 @@ int main(int argc, char** argv) @@ -227,7 +230,6 @@ int main(int argc, char** argv)
227 } 230 }
228 srs_human_trace("play stream success"); 231 srs_human_trace("play stream success");
229 232
230 - srs_flv_t flv = NULL;  
231 if (output_flv) { 233 if (output_flv) {
232 flv = srs_flv_open_write(output_flv); 234 flv = srs_flv_open_write(output_flv);
233 } 235 }
@@ -282,9 +284,7 @@ int main(int argc, char** argv) @@ -282,9 +284,7 @@ int main(int argc, char** argv)
282 284
283 rtmp_destroy: 285 rtmp_destroy:
284 srs_rtmp_destroy(rtmp); 286 srs_rtmp_destroy(rtmp);
285 - if (flv) {  
286 - srs_flv_close(flv);  
287 - } 287 + srs_flv_close(flv);
288 srs_human_trace("completed"); 288 srs_human_trace("completed");
289 289
290 return 0; 290 return 0;
@@ -602,6 +602,11 @@ int __srs_rtmp_connect_server(srs_rtmp_t rtmp) @@ -602,6 +602,11 @@ int __srs_rtmp_connect_server(srs_rtmp_t rtmp)
602 602
603 int __srs_rtmp_do_complex_handshake(srs_rtmp_t rtmp) 603 int __srs_rtmp_do_complex_handshake(srs_rtmp_t rtmp)
604 { 604 {
  605 +#ifndef SRS_AUTO_SSL
  606 + // complex handshake requires ssl
  607 + return ERROR_RTMP_HS_SSL_REQUIRE;
  608 +#endif
  609 +
605 int ret = ERROR_SUCCESS; 610 int ret = ERROR_SUCCESS;
606 611
607 srs_assert(rtmp != NULL); 612 srs_assert(rtmp != NULL);