Browse Source

修改流名称

ntv-wangjian 3 years ago
parent
commit
b530dc1c53
1 changed files with 14 additions and 2 deletions
  1. 14
    2
      trunk/src/app/srs_app_gb28181.cpp

+ 14
- 2
trunk/src/app/srs_app_gb28181.cpp View File

@@ -2497,6 +2497,13 @@ srs_error_t SrsGb28181Manger::create_stream_channel(SrsGb28181StreamChannel *cha
2497 2497
     std::string id = channel->get_channel_id();
2498 2498
     SrsGb28181RtmpMuxer *muxer = NULL;
2499 2499
 
2500
+    std::string ntv_stream = id;
2501
+    string::size_type pos = id.find("@");
2502
+    if(pos!=string::npos){
2503
+        ntv_stream = id.substr(0,pos);
2504
+    }
2505
+
2506
+
2500 2507
     muxer = fetch_rtmpmuxer(id);
2501 2508
     if (muxer){
2502 2509
        SrsGb28181StreamChannel s = muxer->get_channel();
@@ -2580,7 +2587,10 @@ srs_error_t SrsGb28181Manger::create_stream_channel(SrsGb28181StreamChannel *cha
2580 2587
 
2581 2588
         url = srs_generate_rtmp_url(_host, rtmp_port, "", "", app, stream, "");
2582 2589
         url = srs_string_replace(url, "[app]", "live");
2583
-        url = srs_string_replace(url, "[stream]", id);
2590
+
2591
+        //url = srs_string_replace(url, "[stream]", id);
2592
+        url = srs_string_replace(url, "[stream]", ntv_stream);
2593
+        
2584 2594
         std::stringstream ss;
2585 2595
         ss << ssrc;
2586 2596
         url = srs_string_replace(url, "[ssrc]", ss.str());
@@ -2601,6 +2611,8 @@ srs_error_t SrsGb28181Manger::create_stream_channel(SrsGb28181StreamChannel *cha
2601 2611
         std::string play_url = srs_generate_rtmp_url(config->host, rtmp_port, "", "", app, stream_name, "");
2602 2612
         channel->set_rtmp_url(play_url);
2603 2613
 
2614
+        srs_trace("gb28181: play_url=%s", play_url.c_str());
2615
+        
2604 2616
         request.app = app;
2605 2617
         request.stream = stream_name;
2606 2618
         //request.vhost = config->host;
@@ -2614,7 +2626,7 @@ srs_error_t SrsGb28181Manger::create_stream_channel(SrsGb28181StreamChannel *cha
2614 2626
 
2615 2627
     rtmpmuxer_map_by_ssrc(muxer, ssrc);
2616 2628
     muxer->set_rtmp_url(url);
2617
-    srs_trace("gb28181: create new stream channel id:%s rtmp url=%s", id.c_str(), url.c_str());
2629
+    srs_trace("gb28181: create new stream channel id:%s rtmp url=%sz", id.c_str(), url.c_str());
2618 2630
 
2619 2631
     muxer->copy_channel(channel);
2620 2632
 

Loading…
Cancel
Save