Skip to content

Commit

Permalink
Add track mark on process restart in `input.external.{rawaudio,rawvid…
Browse files Browse the repository at this point in the history
…eo}. Fixes: #2872
  • Loading branch information
toots committed Jan 31, 2023
1 parent 4e3e281 commit c3cfb52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/sources/external_input_audio.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ class external_input ~name ~restart ~bufferize ~restart_on_error ~max ~converter
(Frame.seconds_of_audio (buffered + length - (3 * abg_max_len / 4)))
else `Continue
in
object
object (self)
inherit
External_input.base
~name ?read_header ~restart ~restart_on_error ~on_data command

inherit Generated.source ~empty_on_abort:false ~bufferize ()
method on_stop = Generator.add_track_mark self#buffer
end

let proto =
Expand Down
3 changes: 2 additions & 1 deletion src/core/sources/external_input_video.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ class video ~name ~restart ~bufferize ~restart_on_error ~max ~on_data
`Delay (Frame.seconds_of_audio (buffered - (3 * abg_max_len / 4)))
else `Continue
in
object
object (self)
inherit
External_input.base
~name ?read_header ~restart ~restart_on_error ~on_data command

inherit Generated.source ~empty_on_abort:false ~bufferize ()
method on_stop = Generator.add_track_mark self#buffer
end

(***** AVI *****)
Expand Down
2 changes: 2 additions & 0 deletions src/core/tools/external_input.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class virtual base ~name ~restart ~restart_on_error ~on_data ?read_header
(** The header was already read. *)
val mutable header_read = false

method virtual on_stop : unit
method stype = `Fallible

method! wake_up _ =
Expand All @@ -57,6 +58,7 @@ class virtual base ~name ~restart ~restart_on_error ~on_data ?read_header
`Continue
in
let on_stop status =
self#on_stop;
header_read <- false;
match status with
| `Status (Unix.WEXITED 0) -> restart
Expand Down

0 comments on commit c3cfb52

Please sign in to comment.