1414import numpy as np
1515
1616from funscript_editor .utils .watchdog import Watchdog
17+ from funscript_editor .utils .config import SETTINGS
1718
1819@dataclass
1920class VideoInfo :
@@ -43,9 +44,10 @@ def __init__(self,
4344 skip_frames :int = 0 ,
4445 start_frame :int = 0 ,
4546 queue_size :int = 256 ,
46- watchdog_timeout :int = 4 ,
47+ watchdog_timeout_in_seconds :int = max (( 3 , int ( SETTINGS [ 'ffmpeg_timeout_in_seconds' ]) )) ,
4748 log_queue_overrun :bool = False ):
4849
50+ self .watchdog_timeout_in_seconds = watchdog_timeout_in_seconds
4951 self .video_path = video_path
5052 self .config = config
5153 self .skip_frames = skip_frames
@@ -61,7 +63,7 @@ def __init__(self,
6163 self .video_info = self .get_video_info (video_path )
6264 self .frame_buffer = Queue (maxsize = queue_size )
6365
64- self .watchdog = Watchdog (watchdog_timeout , self .watchdog_timeout )
66+ self .watchdog = Watchdog (watchdog_timeout_in_seconds , self .watchdog_timeout_callback )
6567 self .thread = Thread (target = self .run , args = ())
6668 self .thread .daemon = True
6769 self .thread .start ()
@@ -74,7 +76,7 @@ def __del__(self):
7476 logger = logging .getLogger (__name__ )
7577
7678
77- def watchdog_timeout (self ):
79+ def watchdog_timeout_callback (self ):
7880 """ Watchdog timeout for ffmpeg stream """
7981 if not self .stopped :
8082 self .logger .error ("FFmpegStream Timeout" )
@@ -380,7 +382,7 @@ def run(self) -> None:
380382 ]
381383
382384 self .watchdog .start ()
383- self .logger .info ("FFmpeg Stream Watchdog started" )
385+ self .logger .info ("FFmpeg Stream Watchdog started with %d sec timeout" , self . watchdog_timeout_in_seconds )
384386 self .logger .info ("Open FFmpeg Stream" )
385387 self .pipe = sp .Popen (
386388 command ,
0 commit comments