Skip to content

Commit

Permalink
wyze: suppress ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Dec 22, 2023
1 parent 1030d7d commit ca14764
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
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 @@ -33,5 +33,5 @@
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
},
"version": "0.0.34"
"version": "0.0.35"
}
15 changes: 8 additions & 7 deletions plugins/wyze/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,9 @@ async def handleRfcClient(
ffmpeg = await scrypted_sdk.mediaManager.getFFmpegPath()
loop = asyncio.get_event_loop()

class Protocol:
def __init__(self, pt: int) -> None:
self.pt = pt

class RFC4571Writer:
def connection_made(self, transport):
self.transport = transport
pass

def datagram_received(self, data, addr):
l = len(data)
Expand All @@ -203,7 +200,7 @@ def datagram_received(self, data, addr):
writer.write(data)

vt, vp = await loop.create_datagram_endpoint(
lambda: Protocol(96), local_addr=("127.0.0.1", 0)
lambda: RFC4571Writer(), local_addr=("127.0.0.1", 0)
)
vhost, vport = vt._sock.getsockname()

Expand All @@ -226,6 +223,8 @@ def datagram_received(self, data, addr):
"96",
f"rtp://127.0.0.1:{vport}?pkt_size=1300",
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.DEVNULL,
)
vprocess.stdin.write(b"\x00\x00\x00\x01")
vprocess.stdin.write(info.videoCodecInfo[0])
Expand All @@ -235,7 +234,7 @@ def datagram_received(self, data, addr):
aprocess: asyncio.subprocess.Process = None
if not self.getMuted():
at, ap = await loop.create_datagram_endpoint(
lambda: Protocol(97), local_addr=("127.0.0.1", 0)
lambda: RFC4571Writer(), local_addr=("127.0.0.1", 0)
)

ahost, aport = at._sock.getsockname()
Expand All @@ -261,6 +260,8 @@ def datagram_received(self, data, addr):
"97",
f"rtp://127.0.0.1:{aport}?pkt_size=1300",
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.DEVNULL,
)

try:
Expand Down

0 comments on commit ca14764

Please sign in to comment.