Skip to content

Commit

Permalink
feat: more p2p testing
Browse files Browse the repository at this point in the history
  • Loading branch information
fuatakgun committed Nov 24, 2023
1 parent de39e3e commit 657ef84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions custom_components/eufy_security/eufy_security_api/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ async def _handle_rtsp_livestream_stopped(self, event: Event):
self.stream_status = StreamStatus.IDLE

async def _handle_livestream_video_data_received(self, event: Event):
await self.video_queue.put(event.data["buffer"]["data"])
await self.video_queue.put(bytearray(event.data["buffer"]["data"]))

async def _handle_livestream_audio_data_received(self, event: Event):
pass
#await self.audio_queue.put(event.data["buffer"]["data"])
#await self.audio_queue.put(bytearray(event.data["buffer"]["data"]))

async def _initiate_start_stream(self, stream_type) -> bool:
self.set_stream_prodiver(stream_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def chunk_generator(self, queue):
item = queue.get_nowait()
_LOGGER.debug(f"chunk_generator yield data {retry} - {len(item)}")
retry = 0
yield bytearray(item)
yield item
except TimeoutError as te:
_LOGGER.debug(f"chunk_generator timeout Exception %s - traceback: %s", te, traceback.format_exc())
raise te
Expand All @@ -45,6 +45,8 @@ async def write_bytes(self, queue):
async with aiohttp.ClientSession() as session:
resp = await session.post(url, data = self.chunk_generator(queue), timeout=aiohttp.ClientTimeout(total=None, connect=5))
_LOGGER.debug(f"write_bytes - post response - {resp.status} - {await resp.text()}")
_LOGGER.debug("write_bytes - post ended - retry")
retry = True

except (asyncio.exceptions.TimeoutError, asyncio.exceptions.CancelledError) as ex:
# live stream probabaly stopped, handle peacefully
Expand All @@ -58,7 +60,6 @@ async def write_bytes(self, queue):
_LOGGER.debug(f"write_bytes general exception %s - traceback: %s", ex, traceback.format_exc())

_LOGGER.debug("write_bytes - ended")

await self.stop(retry)

async def create_stream_on_go2rtc(self):
Expand Down

0 comments on commit 657ef84

Please sign in to comment.