Skip to content

Commit 9d092f3

Browse files
prgmitchellRytoEX
authored andcommitted
network: Check max recommended bitrate from service
This adds a warning if the maximum recommended video bitrate from the selected service has been exceeded.
1 parent 9c87c97 commit 9d092f3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

checks/network.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,28 @@ def checkStreamDelay(lines):
100100
if (len(delayLines) > 0):
101101
return [LEVEL_INFO, "Stream Delay", "Stream Delay may currently be active. This means that your stream is being delayed by a certain number of seconds. If this is not what you intended, please disable it in Settings -> Advanced -> Stream Delay."]
102102
return None
103+
104+
105+
def checkServiceRecommendations(lines):
106+
maxBitrate = None
107+
for i, line in enumerate(lines):
108+
if "User is ignoring service bitrate limits." in line:
109+
for j in range(i + 1, len(lines)):
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))
114+
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."]
127+
return None

loganalyzer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ def doAnalysis(url=None, filename=None):
189189
checkDesktopEnvironment(logLines),
190190
checkMissingModules(logLines),
191191
checkLinuxVCam(logLines),
192-
checkMacPermissions(logLines)
192+
checkMacPermissions(logLines),
193+
checkServiceRecommendations(logLines)
193194
])
194195
messages.extend(checkVideoSettings(logLines))
195196
m = parseScenes(logLines)

0 commit comments

Comments
 (0)