Skip to content

Commit 3202bfa

Browse files
committed
fix
fix
1 parent 75740d9 commit 3202bfa

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

checks/network.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,25 @@ def checkStreamDelay(lines):
103103

104104

105105
def checkServiceRecommendations(lines):
106+
maxBitrate = None
106107
for i, line in enumerate(lines):
107-
if "User is ignoring service bitrate limits. Max Video Bitrate:" in line:
108-
maxVideoBitrateMatch = re.search(r'Max Video Bitrate: (\d+|None)', line)
109-
if not maxVideoBitrateMatch or maxVideoBitrateMatch.group(1) == 'None':
110-
continue
111-
maxVideoBitrate = int(maxVideoBitrateMatch.group(1))
108+
if "User is ignoring service bitrate limits." in line:
112109
for j in range(i + 1, len(lines)):
113-
if "bitrate:" in lines[j]:
114-
currentBitrate = int(re.search(r'bitrate:\s+(\d+)', lines[j]).group(1))
115-
if currentBitrate > maxVideoBitrate:
116-
return [LEVEL_WARNING, "Max Video Bitrate Limit Exceeded", "Current bitrate " + str(currentBitrate) + "kbps exceeds max video bitrate limit " + str(maxVideoBitrate) + "kbps. This may result in the streaming service not displaying the video from your stream or rejecting it entirely."]
110+
if "video bitrate:" in lines[j]:
111+
maxBitrateMatch = re.search(r'video bitrate:\s+(\d+)', lines[j])
112+
if maxBitrateMatch:
113+
maxBitrate = int(maxBitrateMatch.group(1))
117114
break
115+
break
116+
117+
if maxBitrate is not None:
118+
for i, line in enumerate(lines):
119+
if "bitrate:" in line and "video bitrate:" not in line:
120+
currentBitrateMatch = re.search(r'bitrate:\s+(\d+)', line)
121+
if currentBitrateMatch:
122+
currentBitrate = int(currentBitrateMatch.group(1))
123+
if currentBitrate > maxBitrate:
124+
return [LEVEL_WARNING, "Max Video Bitrate Limit Exceeded",
125+
f"Current bitrate {currentBitrate}kbps exceeds max video bitrate limit {maxBitrate}kbps. "
126+
"This may result in the streaming service not displaying the video from your stream or rejecting it entirely."]
118127
return None

0 commit comments

Comments
 (0)