Skip to content

Commit

Permalink
Fix udp streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
fieldOfView committed Nov 2, 2023
1 parent 1f098e8 commit db68d37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions udpstreamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def __init__(
interpolation: str = "smooth",
gamma: float = 0.5,
) -> None:
WLEDStreamer.__init__(self, width, height, crop, scale, interpolation, gamma)
self._ip = socket.gethostbyname(host)
self._port = port
self._socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

self.ip = socket.gethostbyname(host)
self.port = port
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
WLEDStreamer.__init__(self, width, height, crop, scale, interpolation, gamma)

def close(self):
self.socket.close()
self._socket.close()

def sendFrame(self, frame: np.ndarray) -> None:
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
Expand All @@ -49,8 +49,8 @@ def sendFrame(self, frame: np.ndarray) -> None:
.tobytes()
)

self.socket.sendto(message, (self.ip, self.port))
self._socket.sendto(message, (self._ip, self._port))

def _loadInfo(self) -> None:
response = requests.get("http://" + self.ip + "/json/info", timeout=5)
response = requests.get("http://" + self._ip + "/json/info", timeout=5)
self._wled_info = json.loads(response.text)
2 changes: 1 addition & 1 deletion wledvideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, source: Union[str, int], loop: bool = False) -> None:
}
STREAMER_CONFIG_DEFAULTS = {
"host": "127.0.0.1",
"port": 21234,
"port": 21324,
"serial": "",
"baudrate": 115200,
"width": 0,
Expand Down

0 comments on commit db68d37

Please sign in to comment.