Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove source.{dump, drop}, add request.{dump, process}. #4216

Merged
merged 9 commits into from
Nov 19, 2024
Merged

Conversation

toots
Copy link
Member

@toots toots commented Nov 19, 2024

This PR replaces the source.{dump, drop} mechanism with a safer one based on requests.

Now that these operators are being used more widely, via replaygain and autocue computations, it is clear that we need a better control over the potential for success before launching a CPU-burn clock on the underlying source.

With this PR, we introduce a new request.{dump, drop} set of operators that take a request and an optional processing function. From the request, a source is created using request.dynamic and passed to the process function.

Then, before starting, the request source checks if the request can produce a decoder for its given content-type. If not, the processing is aborted right away. If it can, chances are pretty high that processing will sucesfully begin and terminate.

This makes these operators fully synchronous with no need for a special queue. They can also be launched from the CLI and terminate right away.

Lastly, the old source.{dump, drop} is make possible via the export of clock.tick. In this case, advanced users can implement the behavior if they know what they are doing:

      clock.assign_new(sync="passive", [s])

      stopped = ref(false)
      output.file(
        fallible=true, on_stop={stopped.set(true)}, %wav, file, once(s)
      )

      c = clock(s.clock)
      c.start()
      while not stopped() do c.tick() end
      c.stop()

@toots toots force-pushed the request.process branch 3 times, most recently from 7f0e7b9 to ce389e5 Compare November 19, 2024 06:14
@toots toots requested a review from smimram November 19, 2024 14:36
@toots toots marked this pull request as ready for review November 19, 2024 14:36
@toots toots added this pull request to the merge queue Nov 19, 2024
Merged via the queue into main with commit ef2a2db Nov 19, 2024
25 checks passed
@toots toots deleted the request.process branch November 19, 2024 23:26
@Russsgithub
Copy link

@toots .
I have been running 2.3 on a stream that mixes 4 request dynamic sources dependent on metadata triggers and stream events, also uses sound touch and ladspa.
Just thought I'd report that all seems to be working and no longer collapsing to silence after a few songs ( which has been happening up until yesterday ).
:). 👍.

I'll report if anything unintended occurs.
Thanks.

@toots
Copy link
Member Author

toots commented Nov 21, 2024

@toots . I have been running 2.3 on a stream that mixes 4 request dynamic sources dependent on metadata triggers and stream events, also uses sound touch and ladspa. Just thought I'd report that all seems to be working and no longer collapsing to silence after a few songs ( which has been happening up until yesterday ). :). 👍.

I'll report if anything unintended occurs. Thanks.

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants