fix: srs sync should ignore streams with only listeners, but no publishers
This commit is contained in:
		
							parent
							
								
									e2130621ad
								
							
						
					
					
						commit
						4299d46b7b
					
				| 
						 | 
					@ -24,6 +24,11 @@ def scrape_srs_server(node: SRSNode):
 | 
				
			||||||
        streamobjs = []
 | 
					        streamobjs = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for streamjson in streams:
 | 
					        for streamjson in streams:
 | 
				
			||||||
 | 
					            # if there are consumers still connected to a stream, the stream will stay listed,
 | 
				
			||||||
 | 
					            # but the publish status will be false. we do not care about such (dead) streams.
 | 
				
			||||||
 | 
					            active = streamjson.get('publish', {}).get('active', False)
 | 
				
			||||||
 | 
					            if not active:
 | 
				
			||||||
 | 
					                continue
 | 
				
			||||||
            # find the corresponding stream object by comparing the stream uuid
 | 
					            # find the corresponding stream object by comparing the stream uuid
 | 
				
			||||||
            stream = Stream.objects.get(stream=streamjson.get('name'))
 | 
					            stream = Stream.objects.get(stream=streamjson.get('name'))
 | 
				
			||||||
            streaminstance, _ = SRSStreamInstance.objects.get_or_create(stream=stream, node=node)
 | 
					            streaminstance, _ = SRSStreamInstance.objects.get_or_create(stream=stream, node=node)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue