-
Notifications
You must be signed in to change notification settings - Fork 83
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
ProcessHandler will terminate execution prematurely if a FrameConsumer is too slow #355
Comments
PR: #356 |
@marklassau this timeout is applied only when
Could you clarify? ffmpeg sends frames one by one (through TCP using NUT format). |
Could you describe what you are going to achieve in more details? Why handling audio samples takes so long? |
We read an audio file - and then output a video file that includes that audio. The processing time with a 1080p output in that particular environment is just slow enough to need more than the 10 seconds to finish off the last buffer load of audio frames. It is probably best if I post some simplified example code that will trigger the issue and you can see for yourself. |
Do you visualize audio wave? Do you use another ffmpeg/Jaffree instance to produce video frames and encode them as video file? |
Exactly
We already use a |
Here is a small sample code to replicate the problem:
You would have to add a Path to an existing audio file ... and put in your own ffmpeg path. Note that we use the |
When I run the above code I get logs like this:
Note that I should see 915 frames for test audio file I am using and we should see the null frame that signifies EOF. |
It looks like ffmpeg batches several audio frames and sends them to |
Last night I thought that
I tried the test code using
But you can see in the log times that it only just scrapes in before the 10 second timeout would activate - if I change the 100ms sleep to 200ms then it will timeout again. |
I see your point. And to be honest I'm not sure now that we need helper thread timeout at all. Also I don't remember why this functionality was added. May be at that time Jaffree had issues with threads. And AFAIK this is the first issue regarding executor timeout. |
That makes sense - 10 seconds should usually be more than enough for most use cases. We use Jaffree successfully for a bunch of different things (its a great library - thanks for your hard work and sharing it!) and it was only just now that we ran into the timeout for one particular use case. I think 99% of users will never know or need to know about the timeout. |
Fixed in #356 |
Describe the issue
Under certain conditions, my
FrameConsumer
is not able to finish processing frames within the 10 second timeout that is hard-coded inProcessHandler.EXECUTOR_TIMEOUT_MILLIS
To Reproduce
Steps to reproduce the behavior:
UrlInput
consume(Frame)
I was able to reproduce with
Thread.sleep(100)
, but this will depend on environment /Note that not all frames will be passed to your FrameConsumer.
Sample file
I was able to reproduce with various small audio files in various formats.
Expected behavior
There should be a way to allow for
FrameConsumer
implementations that require longer processing times.Logs
Additional context
I agree that the 10 second timeout is probably a fair amount for the majority of use cases, it's just that in some cases application developers will need more time to complete processing.
I suggest the simplest short term solution is simply to make the timeout configurable so developers can adjust depending on circumstances.
I plan to open a PR with a suggested fix sometime soon :)
In the long term it might be nice to have some smarter way to detect when processing is complete - eg if we could somehow know that not all frames have been passed to the FrameConsumer then we would know that processing is on-going.
The text was updated successfully, but these errors were encountered: