mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	Config: Error when both HLS and HTTP-TS enabled. (#3400)
PICK 5b001fe344
Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: john <hondaxiao@tencent.com>
			
			
This commit is contained in:
		
							parent
							
								
									ed95a8f53d
								
							
						
					
					
						commit
						d1dec927d9
					
				
					 3 changed files with 55 additions and 1 deletions
				
			
		|  | @ -8,6 +8,7 @@ The changelog for SRS. | |||
| 
 | ||||
| ## SRS 5.0 Changelog | ||||
| 
 | ||||
| * v5.0, 2023-02-08, Merge [#3391](https://github.com/ossrs/srs/pull/3391): Config: Error when both HLS and HTTP-TS enabled. v5.0.140 (#3391) | ||||
| * v5.0, 2023-01-29, Merge [#3371](https://github.com/ossrs/srs/pull/3371): HLS: support kick-off hls client. v5.0.139 (#3371) | ||||
| * v5.0, 2023-01-19, Merge [#3318](https://github.com/ossrs/srs/pull/3318): RTC: fix rtc publisher pli cid. v5.0.138 (#3318) | ||||
| * v5.0, 2023-01-18, Merge [#3382](https://github.com/ossrs/srs/pull/3382): Rewrite research/api-server code by Go, remove Python. v5.0.137 (#3382) | ||||
|  |  | |||
|  | @ -2674,6 +2674,59 @@ srs_error_t SrsConfig::check_normal_config() | |||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     ////////////////////////////////////////////////////////////////////////
 | ||||
|     // check HLS with HTTP-TS
 | ||||
|     ////////////////////////////////////////////////////////////////////////
 | ||||
|     for (int n = 0; n < (int)vhosts.size(); n++) { | ||||
|         SrsConfDirective* vhost = vhosts[n]; | ||||
| 
 | ||||
|         bool hls_enabled = false; | ||||
|         bool http_remux_ts = false; | ||||
|         int http_remux_cnt = 0; | ||||
| 
 | ||||
|         for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) { | ||||
|             SrsConfDirective* conf = vhost->at(i); | ||||
|             string n = conf->name; | ||||
|             if (n == "http_remux") { | ||||
|                 bool http_remux_enabled = false; | ||||
|                 for (int j = 0; j < (int)conf->directives.size(); j++) { | ||||
|                     string m = conf->at(j)->name; | ||||
| 
 | ||||
|                     // http_remux enabled
 | ||||
|                     if (m == "enabled" && conf->at(j)->arg0() == "on") { | ||||
|                         http_remux_enabled = true; | ||||
|                     } | ||||
| 
 | ||||
|                     // check mount suffix '.ts'
 | ||||
|                     if (http_remux_enabled && m == "mount" && srs_string_ends_with(conf->at(j)->arg0(), ".ts")) { | ||||
|                         http_remux_ts = true; | ||||
|                     } | ||||
|                 } | ||||
|                 http_remux_cnt++; | ||||
|             } else if (n == "hls") { | ||||
|                 for (int j = 0; j < (int)conf->directives.size(); j++) { | ||||
|                     string m = conf->at(j)->name; | ||||
| 
 | ||||
|                     // hls enabled
 | ||||
|                     if (m == "enabled" && conf->at(j)->arg0() == "on") { | ||||
|                         hls_enabled = true; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // check valid http-remux count
 | ||||
|         if (http_remux_cnt > 1) { | ||||
|             return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.http_remux only one but count=%d of %s", http_remux_cnt, vhost->arg0().c_str()); | ||||
|         } | ||||
| 
 | ||||
|         // check hls conflict with http-ts
 | ||||
|         if (hls_enabled && http_remux_ts) { | ||||
|             return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.hls conflict with vhost.http-ts of %s", vhost->arg0().c_str()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // check ingest id unique.
 | ||||
|     for (int i = 0; i < (int)vhosts.size(); i++) { | ||||
|         SrsConfDirective* vhost = vhosts[i]; | ||||
|  |  | |||
|  | @ -9,6 +9,6 @@ | |||
| 
 | ||||
| #define VERSION_MAJOR       5 | ||||
| #define VERSION_MINOR       0 | ||||
| #define VERSION_REVISION    139 | ||||
| #define VERSION_REVISION    140 | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue