TonyLikeSocks
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
This unblocked me. I also had a format issue I needed to resolve. My source was outputting
RawAudio
and the TrackReceiver
expects RTP packets to depayload. But that was straight forward.
Thanks @Feliks28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
Sorry. Life has been getting in the way. I need to try it.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
Ok. Dummy element 🙂 Thanks for the advice Feliks. I appreciate it.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
To be clear, everything works in prod. I'm just trying to add a test. It's a part of my code base that's a little gnarly, so some test coverage would be helpful
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
So just changing all my elements won't get me to a place where I can build a test pipeline that can exercise my endpoint. 🤔 I'm definitely a little stumped
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
Though the Membrane.Testing.Source, already has
flow_control: manual
which I think is the root of the issue.28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
Yeah, that's the repo.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
I appreciate the advice.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
@Feliks So now my issue is that the first element in my bin is
Membrane.RTC.Engine.Endpoint.WebRTC.TrackReceiver
which has it's input pad flow_control: :push
; but the output pad of the Membrane.Testing.DynamicSource
that I'm using has an output pad flow_control: :manual
, which is incompatible.
I perused the Engine code, and I assume it's doing something to mediate between the two flow controls, though looking at the code in membrane webrtc engine ( engine.ex
tee.ex
and filter_tee.ex
) it wasn't obvious to me how that was being done. What do you advise? Should I build a dummy element in my testing pipeline that just mediates between the Testing.Source element and one that expects a push?
Or I could make a copy of TrackReceiver that has the pad definitions set to :auto
and just roll with it. Though I don't fully understand the implications here, so I'm a little worried about doing that and producing some subtle bug in the future.28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
FWIW - i think the failure is silent because my test assertions were using the default timeout of 2_000, but that Engine.subscribe call has a timeout of 5_000. So I never tripped the timeout and saw the error message.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
I think I realized at least part of the problem. My element is silently dying. When I send send in the
:new_tracks
notification, I'm also trying to subscribe to the track published by the engine. I've got this line:
But the state.rtc_engine is the pid of my testing process, not an actual running RTC engine. So that call silently fails, and nothing else is executed, which is why my handle_pad_added calls weren't firing.
Adding this to my test, unblocked me. I'm successfully setting up the pipeline and mocking the RTC Engine pieces.
Thanks @Feliks !28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
We setup the whole spec in the
handle_pad_added
for the output pad. I omitted it for brevity earlier. I
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
I checked and the handle_setup isn't being called. It's one of the child elements of the bin.
My hunch is that I'm setting the spec up wrong in my test file. My conversation bin doesn't actually return the child spec until we get the
handle_pad_added
callbacks.
Here's the relevant code from the conversation.ex bin that I'm trying to test:
Since neither of those is tripped, I think I'm not setting my testing spec up correctly, or the Testing pipeline isn't correctly notifying the element that new pads have been added.28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
Though the children for this bin aren't spawned until we handle this callback:
And the assertions that are failing right now are prior to that in the lifecycle.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
I'm testing more, and the event returned from my
handle_init
I can assert on. But an event fired from this callback:
I can't assert on. Though I can see the IO.puts message in my logs, so I know the callback is being fired.28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
Yes.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
I assumed the notify_parent would trigger a notification to the test pipeline and I could assert on it.
28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 4/1/2025 in #membrane-help
Testing a Membrane Bin used in a WebRTC Engine Endpoint
This is the assertion that's failing
I'm expecting this callback to be called:
I've even got a
handle_pad_added
without the guard
And it's never called either.28 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 2/6/2025 in #membrane-help
Testing a filter with flow control :auto?
Ah ha! Thanks @Feliks That did the trick.
8 replies
SMSoftware Mansion
•Created by TonyLikeSocks on 2/6/2025 in #membrane-help
Testing a filter with flow control :auto?
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 pipeline
8 replies