Testing a filter with flow control :auto?
I'm trying to test a membrane filter where the flow control is set to :auto. I'm using
Membrane.Testing.Source
and passing in a custom generator function. Though it appears to be only called once. Am I setting this testing pipeline up incorrectly?4 Replies
The only output I see in my test:
So I found the error where I'm not returning the correct tuple
{[actions], new_state}
-- but even fixing that my generator is only getting called once.
I'm wondering if since my element is using auto flow control, my test isn't properly simulating the demand.
Backing up, I'm trying to simulate an audio pipeline where we pass a VAD speech event which starts transcription and then the stream of audio, and finally a VAD silence which ends transcription.
I assumed I had to use the generator to simulate the stream. Alternatively, I could so something like...
Which does the same thing, though it seems like the buffers are sent through all at once. I can't tell if it mimics what is happening in a normal pipelineAdd an action
redemand: :output
at the end of the list of actions returned in source_generator
and let me know, if it helpedAh ha! Thanks @Feliks That did the trick.
FYI action
redemand
checks, if the whole output demand has been already satisfied. If no, it triggers calling handle_demand
callback once again. In this case, it means that source_generator
is executed once again