Skip to content

Commit

Permalink
Honor shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Apr 29, 2024
1 parent ee8d727 commit 7dcff88
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/io/ffmpeg_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let normalize_metadata =
(lbl, v))

exception Stopped
exception Shutdown

type container = {
input : Avutil.input Avutil.container;
Expand Down Expand Up @@ -190,6 +191,7 @@ class input ?(name = "input.ffmpeg") ~autostart ~self_sync ~poll_delay ~debug
method private do_connect () =
Generator.set_max_length self#buffer max_length;
try
if Atomic.get shutdown then raise Shutdown;
if Atomic.compare_and_set source_status `Stopping `Stopped then
raise Stopped;
if Atomic.compare_and_set source_status `Starting `Polling then (
Expand All @@ -211,6 +213,7 @@ class input ?(name = "input.ffmpeg") ~autostart ~self_sync ~poll_delay ~debug
(string_of_source_status v)));
-1.
with
| Shutdown -> -1.
| Stopped ->
Atomic.set source_status `Stopped;
-1.
Expand Down

0 comments on commit 7dcff88

Please sign in to comment.