Conversation
…20250620-hls-video-queue
|
[MEDIUM] Overall: The new HLS stream management introduces a robust rotation mechanism that kills and restarts the FFmpeg process, and cleans up old segments, when a signal (via |
| logging.info(f"process {process.pid} exited with code {exit_code}") | ||
| logging.info(f"process {process.pid} started for {video_type.value} video: {video_path}") | ||
|
|
||
| MetricsHandler.subprocess_count.labels( |
There was a problem hiding this comment.
[MEDIUM] The condition for releasing interlude_lock has been expanded to include video_type == State.PLAYING. This means an interlude will now play after a video process exits if it was of type State.PLAYING, regardless of its exit code (e.g., even if it was forcibly stopped). This is a change in behavior for interlude playback.
|
[MEDIUM] |
| @@ -60,6 +60,8 @@ class UrlType(enum.Enum): | |||
|
|
|||
| interlude_lock = threading.Lock() | |||
|
|
|||
There was a problem hiding this comment.
[CRITICAL] The HLS stream rotation logic in run_hls_stream has a critical flaw regarding the hls_lock initialization and usage. hls_lock is initialized as unlocked. When run_hls_stream starts, it immediately starts an FFmpeg process for HLS, then acquires the hls_lock (which succeeds immediately as it's unlocked), kills the FFmpeg process it just started, cleans the directory, starts another FFmpeg process, and then blocks indefinitely on the second hls_lock.acquire() call because no hls_lock.release() has occurred yet. This leads to an immediate, unnecessary rotation of the HLS stream on startup, followed by indefinite blocking of the HLS rotation mechanism until the first external hls_lock.release() signal is received from another thread (e.g., when a video starts or stops).
|
[MEDIUM] |
| @@ -134,17 +136,19 @@ def create_ffmpeg_stream( | |||
| # the below function returns 0 if the video ended on its own | |||
There was a problem hiding this comment.
[LOW] The logging message logging.info(f"process {process.pid} started for {video_type.value} video: {video_path}") is placed after process.wait(). At this point, the FFmpeg process has already exited, not 'started'. For accurate logging, this message should be moved to immediately after subprocess.Popen to reflect when the process actually begins execution.
Simple PR to test pr review bot