TURN relay in python - nice transmitter
Olivier Crête
olivier.crete at collabora.com
Tue Jun 28 14:30:28 UTC 2022
Hi,
The GLib.PtrArray should just be translated from a Python list (a []).
That said, I'm not sure we can create this thing from Python. It feels
like I need to add an second property that is more introspection
friendly...
Olivier
On Mon, 2021-11-08 at 16:17 +0100, Skorpeo Skorpeo wrote:
> Hello,
>
> Thank you for the quick response! I spent more time this morning and
> got a little further and I had also tried that but it didn't work:/
>
> When I do stream.set_transmitter_ht('nice', {'relay-info':
> [relay_structure]}) I get error:
>
> gi.repository.GLib.Error: fs-error: Invalid type of argument relay-
> info for transmitter nice (100)
>
> I confirm that this is what I am passing in:
> {'relay-info': [<Gst.Structure object at 0x111fb5b80 (GstStructure at
> 0x7f9d58741bd0)>]}
>
> I was able to get the function to accept the following:
>
> {'relay-info': GLib.PtrArray()}
> {'relay-info': GObject.Value(GLib.PtrArray)}
>
> both of which are meaningless because I haven't figured out a way of
> putting values in there.
>
> {'relay-info': relay_structure} also doesn't work
>
> I also tried various things like:
>
> value = GObject.Value(GLib.PtrArray)
> value.set_value([relay_structure]) #also doesn't work
>
> value = GObject.Value(GLib.PtrArray)
> value.set_instance([relay_structure]) #also doesn't work
>
> I also tried other things none of which got me to the promised land.
>
> It seems I have to somehow instantiate a GLib.PtrArray in python but
> there appears to be no facility for that and the function doesn't
> seem to accept a python list as equivalent?
>
> Your input is greatly appreciated
> Many thanks
>
> On Mon, Nov 8, 2021 at 3:19 PM Olivier Crête
> <olivier.crete at collabora.com> wrote:
> > Hi,
> >
> > I believe you need to put it in an array in a dict. So something
> > like
> >
> > stream.set_transmitter_ht(trans, {'relay-info', [relay_structure]})
> >
> > You can put other parametes inside the dict.
> > You can also put multiple relays inside the array.
> >
> > Olivier
> >
> >
> > On Mon, 2021-11-08 at 00:01 +0100, Skorpeo Skorpeo wrote:
> > > Hi,
> > >
> > > How can I add TURN server info for a nice transmitter in python
> > > for
> > > Farstream? I have tried different things but to no avail. I am
> > > not
> > > sure how to get a hold of the transmitter itself or to pass it
> > > parameters initially. Right now local candidates generated are
> > > only
> > > of type "host".
> > >
> > > I use the function stream.set_transmitter("nice") which appears
> > > to
> > > also allow for a parameter argument. I can get as far as:
> > >
> > > relay_structure = Gst.Structure.new_empty("relay-info")
> > > relay_structure.set_value("ip", "123.45.678.999")
> > > relay_structure.set_value("port", 3478)
> > > relay_structure.set_value("username", "user1")
> > > relay_structure.set_value("password", "user1pwd")
> > > relay_structure.set_value("relay-type", "udp")
> > >
> > > but I am not sure how to pass this parameter to
> > > stream.set_transmitter() or stream.set_transmitter_ht().
> > >
> > > I also see the function nice_agent_set_relay_info in the source
> > > but I
> > > am not sure how to use it or access it in python.
> > >
> > > I would also like to add STUN but just trying to figure out TURN
> > > first...
> > >
> > > Any help would be massively appreciated!
> > >
> > > Thanks!
> > >
> > >
> >
--
Olivier Crête
olivier.crete at collabora.com
More information about the Farstream-devel
mailing list