Identifying mediaTrack in MultiStream

491 views
Skip to first unread message

Jake Jang

unread,
Mar 23, 2021, 1:24:14 AM3/23/21
to meetecho-janus

Hi.


Can I identify unique value(like ID) of remoteTrack?


What I want to identify is which track is screen captured video or webcam video.


At first, I tried to use label in MediaStreamTrack object.

(In localStreamTrack, the label is ‘screen or window or HD web cam…’)

But, the value of label has been changed with ‘janus0’, ‘janus1’ in subscribe peer.


Idk well, but seems like janus media server change the value of label when relaying data packet in ‘janus_videoroom_relay_data_pakcet()’ in janus_videoroom.c

Do I have to change code of Janus MediaServer??


Currently, I’m using index of appended streams array, and 'mid' to identifying which stream is cam or screen. But in my opinion, it wouldn’t work 100% correctly in all situations


The question is can I add some filed in MediaStreamTrack Object??

Or is there anything useful value already developed and I’ve been missing

Mirko Brankovic

unread,
Mar 23, 2021, 4:17:50 AM3/23/21
to meetecho-janus
Since, when subscribing, you are making a peer connection with janus and not the publisher, you are getting a completely new stream and tracks (just the same rtp payload), so it makes sense to have different stream/track ID.
But I agree this is something that my colleagues from the Frontend team have been complaining about, they need a unique remote track identifier, since in the Multistream branch it needs to be an object (publisher's feed + mid) to identify it.

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/9d14de49-8ba8-4126-8131-d37ec8780181n%40googlegroups.com.


--
Regards,
Mirko
Message has been deleted

Jake Jang

unread,
Mar 23, 2021, 5:33:52 AM3/23/21
to meetecho-janus
Thanks for kind reply



Yes. I need that kind of some unique value.



Using mid and setting the order of attaching tracks to localPeer, it works almost fine.

But I don't think it’s a perfect solution.

2021년 3월 23일 화요일 오후 5시 17분 50초 UTC+9에 mirkobr...@gmail.com님이 작성:

Mirko Brankovic

unread,
Mar 23, 2021, 7:10:50 AM3/23/21
to meetecho-janus
It is probably not an easy change, so we can just add it to wish list and hope Meetecho will pick it up from Wish-box :D

Or make a PR ourselves :D

On Tue, Mar 23, 2021 at 10:18 AM Jake Jang <jjjss...@gmail.com> wrote:

Thanks for kind reply


Yes. I need that kind of some unique value.


Using mid and setting the order of attachment tracks to localPeer, it works almost fine.

But I don't think it’s a perfect solution.

2021년 3월 23일 화요일 오후 5시 17분 50초 UTC+9에 mirkobr...@gmail.com님이 작성:
Since, when subscribing, you are making a peer connection with janus and not the publisher, you are getting a completely new stream and tracks (just the same rtp payload), so it makes sense to have different stream/track ID.


--
Regards,
Mirko

Lorenzo Miniero

unread,
Mar 23, 2021, 10:48:21 AM3/23/21
to meetecho-janus
Il giorno martedì 23 marzo 2021 alle 10:33:52 UTC+1 jjjss...@gmail.com ha scritto:
Yes. I need that kind of some unique value.

It needs to be unique per PeerConnection, and it is. The fact that different PeerConnections use the same values is legitimate.
For different PeerConnections, in Janus master you know which publisher/handle the media comes from, so it's easy to discriminate.

L.

 

Jesse Boyes

unread,
Mar 23, 2021, 2:07:01 PM3/23/21
to Jake Jang, meetecho-janus
On the multistream branch, when you get the onmessage callback with the streams array on your subscriber handle, this structure passed back will contain both the mid and the videoroom publisher data such as feed_display and feed_id -- you should be able to make an association from this. (In the mvideoroom.js sample code, this structure gets stored in subStreams array). 

Hope that helps!

Amnon Israely

unread,
Mar 23, 2021, 4:05:48 PM3/23/21
to meetecho-janus
I think it's not really possible to make unique id for track. Because it's may change many times.
In theory user may publish 2 video source. 
Or what happened if user unpublish and republish any stream? Does it need to come with same or another unique id?

вторник, 23 марта 2021 г. в 20:07:01 UTC+2, jesse...@gmail.com:

Jake Jang

unread,
Mar 23, 2021, 10:00:12 PM3/23/21
to meetecho-janus

Thanks guys.


Janus already provide what I want.

In subStreams, there was everything I wanted.

The only problem was, my poor skills.


Or what happened if user unpublish and republish any stream? Does it need to come with same or another unique id?

And yes. Making unique id per track was poor idea.


2021년 3월 24일 수요일 오전 5시 5분 48초 UTC+9에 amn...@gmail.com님이 작성:

Mirko Brankovic

unread,
Mar 24, 2021, 4:27:58 AM3/24/21
to meetecho-janus
indeed you can do it that way, but seems a bit overhead to identify track by struct/object of 2 elements.

full msid would be much more useful in this sense, even just by being added to responses.
so the group janus 
a=msid-semantic: WMS janus
then have 
a=msid:janus janusa0
a=msid:janus janusv0
a=msid:janus janusv1
 
but then adding msid: janus(a/v)X to the each track property might help, since that is the track_id on the "frontend" side if i'm not mistaking :D
Or even better, generating "unique" id for it just like browser:
a=msid-semantic: WMS 4aubqCvRBLMwXjBgSB22bZ0EmdiUxtML6m1J
a=msid:4aubqCvRBLMwXjBgSB22bZ0EmdiUxtML6m1J 6773980a-624f-4382-b7da-3f95cade7d21
a=msid:4aubqCvRBLMwXjBgSB22bZ0EmdiUxtML6m1J dfc67285-e59f-408f-a537-6f9a27062463






--
Regards,
Mirko

Lorenzo Miniero

unread,
Mar 24, 2021, 5:26:37 AM3/24/21
to meetecho-janus
Il giorno mercoledì 24 marzo 2021 alle 09:27:58 UTC+1 mirkobr...@gmail.com ha scritto:
indeed you can do it that way, but seems a bit overhead to identify track by struct/object of 2 elements.

full msid would be much more useful in this sense, even just by being added to responses.
so the group janus 
a=msid-semantic: WMS janus
then have 
a=msid:janus janusa0
a=msid:janus janusv0
a=msid:janus janusv1
 
but then adding msid: janus(a/v)X to the each track property might help, since that is the track_id on the "frontend" side if i'm not mistaking :D
Or even better, generating "unique" id for it just like browser:
a=msid-semantic: WMS 4aubqCvRBLMwXjBgSB22bZ0EmdiUxtML6m1J
a=msid:4aubqCvRBLMwXjBgSB22bZ0EmdiUxtML6m1J 6773980a-624f-4382-b7da-3f95cade7d21
a=msid:4aubqCvRBLMwXjBgSB22bZ0EmdiUxtML6m1J dfc67285-e59f-408f-a537-6f9a27062463

Not an option, because first of all as Amnon said the source or that m-line (and track) may change all the time, and then msid is added by the code and the VideoRoom knows nothing about it. This means you would still need something else to correlate them, which the mechanism introduced above does.

L.


Lorenzo Miniero

unread,
Mar 24, 2021, 5:26:59 AM3/24/21
to meetecho-janus
code=core...

Mirko Brankovic

unread,
Mar 24, 2021, 6:27:08 AM3/24/21
to meetecho-janus
aah thanks for the explanation, I figured it is like that.

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.


--
Regards,
Mirko
Reply all
Reply to author
Forward
0 new messages