diff --git a/platform/panduza_platform/core/platform.py b/platform/panduza_platform/core/platform.py index bb7b6b4..c2ab918 100644 --- a/platform/panduza_platform/core/platform.py +++ b/platform/panduza_platform/core/platform.py @@ -170,15 +170,22 @@ async def mount_device(self, client_name, group_name, device_cfg, keep_mounted = # --- async def unmount_device(self, device): + self.log.info(f"Unmount device {device}") await device.unmount_interfaces() self.devices.remove(device) # --- async def unmount_all_devices(self, force=False): + self.log.warning(self.devices) for device in self.devices: + print("PAFF ") if force or (not device.keep_mounted): + print("!!!!!!!!!!! ", device) await self.unmount_device(device) + else: + print("??????????? NOOO ", device) + print("ENNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNND") # --- diff --git a/platform/panduza_platform/devices/panduza/fake_webcam/itf_fake_video_stream.py b/platform/panduza_platform/devices/panduza/fake_webcam/itf_fake_video_stream.py index 0d6f9de..1d5f2c4 100644 --- a/platform/panduza_platform/devices/panduza/fake_webcam/itf_fake_video_stream.py +++ b/platform/panduza_platform/devices/panduza/fake_webcam/itf_fake_video_stream.py @@ -1,3 +1,4 @@ +import signal import asyncio import subprocess @@ -27,30 +28,23 @@ async def _PZA_DRV_loop_init(self): # docker run -d -p 1935:1935 -p 8080:8080 alqutami/rtmp-hls:latest-alpine - - # ffmpeg -re \ - # \ - # -i TearsOfSteel.mp4 \ - # -c:v copy \ - # -r 24 -g 24 \ - # -preset superfast \ - # -tune zerolatency \ - # -f flv rtmp://127.0.0.1:1935/live/test + # test video - # ffmpeg -f lavfi -i testsrc=duration=120:size=1280x720:rate=30 testsrc.mp4 + # ffmpeg -f lavfi -i testsrc=duration=120:size=1280x720:rate=30 /etc/panduza/data/video_test.mp4 ffmpeg_command = [ 'ffmpeg', '-re', '-stream_loop', '-1', - '-i', '/etc/panduza/data/video_test.mpg', - '-c:v' , 'copy', - '-r', '24', '-g', '24', + '-i', '/etc/panduza/data/video_test.mp4', '-preset', 'superfast', '-tune', 'zerolatency', + '-vcodec', 'libx264', '-f', 'flv', 'rtmp://127.0.0.1:1935/live/test' ] + # ffplay -fflags nobuffer -flags low_delay -probesize 20000 -analyzeduration 1 -strict experimental -framedrop -f flv rtmp://127.0.0.1:1935/live/test + ffmpeg_cmd_string = '' for part in ffmpeg_command: ffmpeg_cmd_string += f"{part} " @@ -106,13 +100,17 @@ async def _PZA_DRV_loop_init(self): # if att in cmds: # await self.__cmd_handlers[att](cmds[att]) -# # --- + # --- -# async def _PZA_DRV_dying_gasp(self): -# # [REQ_ITF_PLATFORM_0020_00] - Info 'dying_gasp' field -# await self._update_attribute("info", "dying_gasp", True) + async def _PZA_DRV_dying_gasp(self): + """Kill running process when interface down + """ + self.log.info("Stop ffmpeg stream") + self.process.send_signal(signal.SIGTERM) + + # --- + -# # --- # async def __refresh_platform_data_task(self): # """Refresh important data count