Skip to content

Commit

Permalink
network: Check max recommended bitrate from service
Browse files Browse the repository at this point in the history
This adds a warning if the maximum recommended video bitrate from the selected service has been exceeded.
  • Loading branch information
prgmitchell committed Jun 25, 2024
1 parent 077c1a4 commit 5594051
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions checks/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,28 @@ def checkStreamDelay(lines):
if (len(delayLines) > 0):
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."]
return None


def checkServiceRecommendations(lines):
maxBitrate = None
for i, line in enumerate(lines):
if "User is ignoring service bitrate limits." in line:
for j in range(i + 1, len(lines)):
if "video bitrate:" in lines[j]:
maxBitrateMatch = re.search(r'video bitrate:\s+(\d+)', lines[j])
if maxBitrateMatch:
maxBitrate = int(maxBitrateMatch.group(1))
break
break

if maxBitrate is not None:
for i, line in enumerate(lines):
if "bitrate:" in line and "video bitrate:" not in line:
currentBitrateMatch = re.search(r'bitrate:\s+(\d+)', line)
if currentBitrateMatch:
currentBitrate = int(currentBitrateMatch.group(1))
if currentBitrate > maxBitrate:
return [LEVEL_WARNING, "Max Video Bitrate Limit Exceeded",
f"Current bitrate {currentBitrate}kbps exceeds max video bitrate limit {maxBitrate}kbps. "
"This may result in the streaming service not displaying the video from your stream or rejecting it entirely."]
return None
3 changes: 2 additions & 1 deletion loganalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def doAnalysis(url=None, filename=None):
checkPortableMode(logLines),
checkSafeMode(logLines),
checkSnapPackage(logLines),
checkMacPermissions(logLines)
checkMacPermissions(logLines),
checkServiceRecommendations(logLines)
])
messages.extend(checkVideoSettings(logLines))
m = parseScenes(logLines)
Expand Down

0 comments on commit 5594051

Please sign in to comment.