Skip to content

Commit

Permalink
wyze: cluster mode support
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Dec 31, 2024
1 parent 2682256 commit e163aa8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/wyze/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{
"scrypted.debugHost": "scrypted-nvr",
"scrypted.debugHost": "127.0.0.1",

"python.analysis.extraPaths": [
"./node_modules/@scrypted/sdk/types/scrypted_python"
Expand Down
4 changes: 2 additions & 2 deletions plugins/wyze/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/wyze/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
},
"version": "0.0.55"
"version": "0.0.56"
}
9 changes: 5 additions & 4 deletions plugins/wyze/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,12 @@ def kill():
pkill(aprocess)

async def ensureServer(self, cb) -> int:
server = await asyncio.start_server(cb, "127.0.0.1", 0)
host = os.environ.get("SCRYPTED_CLUSTER_ADDRESS", None) or "127.0.0.1"
server = await asyncio.start_server(cb, host, 0)
sock = server.sockets[0]
host, port = sock.getsockname()
asyncio.ensure_future(server.serve_forever())
return port
return host, port

async def probeCodec(self, substream: bool):
sps: bytes = None
Expand Down Expand Up @@ -414,7 +415,7 @@ async def getVideoStream(
print_exception(self.print, e)
raise

rfcPort = await self.rfcSubServer if substream else await self.rfcServer
rfcHost, rfcPort = await self.rfcSubServer if substream else await self.rfcServer

msos = self.getVideoStreamOptionsInternal()
mso = msos[1] if substream else msos[0]
Expand All @@ -441,7 +442,7 @@ async def getVideoStream(
a=rtpmap:97 {audioCodecName}/{info.audioSampleRate}/1
"""
rfc = {
"url": f"tcp://127.0.0.1:{rfcPort}",
"url": f"tcp://{rfcHost}:{rfcPort}",
"sdp": sdp,
"mediaStreamOptions": mso,
}
Expand Down

0 comments on commit e163aa8

Please sign in to comment.