Is there any good way to only allow single client for a media factory?
test-record.c as example. Say I have a launch line
"decodebin name=depay0 ! xvimagesink". If I have multiple clients push to the same mount path, it is fine. The pipeline will start 2 player windows.
However, if I have
"rtph264depay name=depay0 ! h264parse ! mpegtsmux ! filesink location=/tmp/output.ts" which writes the output.ts file. If I have 2nd client push to the same mount path, then I end up a broken ts file. Because 2 pipeline writes to the same file.
One might suggest to dynamically change file path using media-configure signal. However, this is not what I want. I only want exactly single file per mount path. So I preferred if there is active session using that media factory, the new client need to get message about this mount path is not available.
In a very clumsy way, I can keep a dictionary about how many clients available for each mount path. Then I use
client-connected signal to connect an
options-request signal, where I can look for mount path from GstRTSPContext, then look for the dictionary to see if it is available. Then I send a message to client with
Is there more straightforward way put a restriction about how many clients can use certain mount path?