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
     std::string id = channel->get_channel_id();
2497
     std::string id = channel->get_channel_id();
2498
     SrsGb28181RtmpMuxer *muxer = NULL;
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
     muxer = fetch_rtmpmuxer(id);
2507
     muxer = fetch_rtmpmuxer(id);
2501
     if (muxer){
2508
     if (muxer){
2502
        SrsGb28181StreamChannel s = muxer->get_channel();
2509
        SrsGb28181StreamChannel s = muxer->get_channel();
2580
 
2587
 
2581
         url = srs_generate_rtmp_url(_host, rtmp_port, "", "", app, stream, "");
2588
         url = srs_generate_rtmp_url(_host, rtmp_port, "", "", app, stream, "");
2582
         url = srs_string_replace(url, "[app]", "live");
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
         std::stringstream ss;
2594
         std::stringstream ss;
2585
         ss << ssrc;
2595
         ss << ssrc;
2586
         url = srs_string_replace(url, "[ssrc]", ss.str());
2596
         url = srs_string_replace(url, "[ssrc]", ss.str());
2601
         std::string play_url = srs_generate_rtmp_url(config->host, rtmp_port, "", "", app, stream_name, "");
2611
         std::string play_url = srs_generate_rtmp_url(config->host, rtmp_port, "", "", app, stream_name, "");
2602
         channel->set_rtmp_url(play_url);
2612
         channel->set_rtmp_url(play_url);
2603
 
2613
 
2614
+        srs_trace("gb28181: play_url=%s", play_url.c_str());
2615
+        
2604
         request.app = app;
2616
         request.app = app;
2605
         request.stream = stream_name;
2617
         request.stream = stream_name;
2606
         //request.vhost = config->host;
2618
         //request.vhost = config->host;
2614
 
2626
 
2615
     rtmpmuxer_map_by_ssrc(muxer, ssrc);
2627
     rtmpmuxer_map_by_ssrc(muxer, ssrc);
2616
     muxer->set_rtmp_url(url);
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
     muxer->copy_channel(channel);
2631
     muxer->copy_channel(channel);
2620
 
2632
 

Loading…
Cancel
Save