mixinnetwork / kraken Goto Github PK
View Code? Open in Web Editor NEW๐ High performance WebRTC SFU implemented with pure Go.
License: Apache License 2.0
๐ High performance WebRTC SFU implemented with pure Go.
License: Apache License 2.0
Following setup instructions, I get the following:
$ go build
main.go:11:2: cannot find package "github.com/MixinNetwork/kraken/engine" in any of:
/usr/lib/go-1.6/src/github.com/MixinNetwork/kraken/engine (from $GOROOT)
($GOPATH not set)
main.go:12:2: cannot find package "github.com/MixinNetwork/kraken/monitor" in any of:
/usr/lib/go-1.6/src/github.com/MixinNetwork/kraken/monitor (from $GOROOT)
($GOPATH not set)
main.go:13:2: cannot find package "github.com/MixinNetwork/mixin/logger" in any of:
/usr/lib/go-1.6/src/github.com/MixinNetwork/mixin/logger (from $GOROOT)
($GOPATH not set)
Why do I not see anyone? I checked in twice to make sure, but there is something wrong
look screen
https://prnt.sc/1281pou
I am using Kraken to build an application which requires some room participants to be listeners only (i.e. do not publish their audio to the room). I am trying to figure out the best way to go about this.
Happy to help on building this out and submitting a PR but quite frankly don't know where to start.
i have vps and all thing i have Is there a genius who can install this on the nginx?
anyone install this i give 20$
It might be more efficent to use server-sent events to push the SDP of remote peer connections to a participant instead of polling for them with subscribe requests using JavasScript setTimeout.
I am a Java developer and not a Go developer otherwise, I would have sent you a PR using one of the available Go implementations eventsource or go-sse
BTW, I am a fan of your work and I love your blogs. I appreciate your contributions to real-time communications even though WebRTC is not your main focus and English is probably not your only language of communication.
how change ip
Hi, Cedric.
After I checked the kraken system perfectly working on ec2 env, I found kraken using the opus codec and the setting has 48000 bandwidth.
But, that means to me, even if I send just a bit of data stream, there is sort of waste of data on time, I think.
Is it possible to change opus bandwidth a little lower than 48000?
Thank you again, Cedric.
I have some questions that are not covered by the documentation:
Is port 9000 used for anything? (it shows up in netstat)
Do I need coturn or does kraken also work without a turnserver?
https://github.com/MixinNetwork/kraken#quick-start doesn't mention a turnserver,
but https://vec.io/posts/deploy-a-group-audio-conferencing-service does.
I'm running kraken inside a container with a local IP and and a reverse proxy on the public IP. Do I have to configure any additional port forwards? (UDP ports?)
type pmap struct {
sync.RWMutex
id string
m map[string]*Peer
}
type rmap struct {
sync.RWMutex
m map[string]*pmap
}
I found the peer and room data in these 2 struct will never be deleted. I think this memory leak is a problem if the service running for a long time. What do you think?
https://vec.io/posts/kraken-high-performance-webrtc-sfu
This is a very disrespectful post. It's ok that you discard SFUs just because they are not written in Go (the only language valid for you) but at least do not write shit about them.
A "SFU just for audio" can be done in 15 minutes, so you have done nothing special.
And BTW:
In short: you should not write shit about others just because you want to promote your own solution on Go.
In Sean Dubois's broadcast example https://github.com/pion/webrtc/blob/master/examples/broadcast/main.go#L137 there's a loop to constantly read the sender (after AddTrack) using rtcpBuf := make([]byte, 1500)
Why don't we need to do the same with Kraken?
Is it because it's done somewhere else, like in the interceptor.Registry in router.go?
I saw your blog post, it stated each participants will consume 1 udp port on kraken, which means i could only have maximum of 48127 participants online simultaneously (common available udp port range 1024 to 49151), How to scale it up to allow more than that amount of users?
Here's the idea i got, make a daemon that actively monitor the usage of the kraken UDP port availability, and magically use a Load Balancing to distribute the traffic to others instance
Is it possible to get the list of rooms with the REST API?
It would be great to have a JSON with the list of rooms + participants in each room
Something like this:
{"rooms": [
{"name": "room1", users: 17},
{"name": "room2", users: 5},
{"name": "room3", users: 8},
...
]}
Also I noticed there is a quite long delay before a disconnected user is removed from the room, is this configurable?
Last point, the method "info" seems to be computed only once every 30 sec, is that also something that can be configured? if not could you give me a pointer about what part of the source code is responsible for this? :)
Thanks a lot for this great piece of OSS :)
ice can not connect
Line 336 in 221733d
Should this be next+uint32(gap) > 65535
instead of > 65536
?
Why do I not see anyone? I checked in twice to make sure, but there is something wrong
look screen
https://prnt.sc/1281pou
https://prnt.sc/1txvfi7
this another browsec
https://prnt.sc/1txvif7
When someone get connected and disconnected to the kraken server, the occupied memory usage seems still consuming the resources.
Is it due to nginx' cache problem or just time-consuming work to flush allocated memory?
I am trying to reuse this awesome audio only SFU to make it video only.
I replaced the registered codec to accept VP8 and accept 96 as PayloadType in peer.go
However, it seems that for video I have to send a PLI every 3 seconds inside the same peer.pc.OnTrack method.
Question: why don't we need to send these PLI for audio only?
Here's the code I've added:
peer.pc.OnTrack(func(rt *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
logger.Printf("HandlePeer(%s) OnTrack(%d, %d)\n", peer.id(), rt.PayloadType(), rt.SSRC())
if peer.track != nil || (111 != rt.PayloadType() && 109 != rt.PayloadType() && 96 != rt.PayloadType()) {
return
}
peer.connected <- true
peer.Lock()
lt, err := webrtc.NewTrackLocalStaticRTP(rt.Codec().RTPCodecCapability, peer.cid, peer.uid)
if err != nil {
panic(err)
}
peer.track = lt
peer.Unlock()
// NEW FUNCTION HERE TO REQUEST A PLI FROM THE REMOTE VIDEO TRACK
go func() {
ticker := time.NewTicker(rtcpPLIInterval)
for range ticker.C {
if rtcpSendErr := peer.pc.WriteRTCP([]rtcp.Packet{&rtcp.PictureLossIndication{MediaSSRC: uint32(rt.SSRC())}}); rtcpSendErr != nil {
fmt.Println(rtcpSendErr)
}
}
}()
The issue is how do I stop this function when the remote track ends or the connection closes?
Currently, my code displays the rtcpSendErr but I'd like to stop this go func.
I deployed a kraken service recently, only deployed in one machine. I found the rpc http api will always timeout with no response after running about 1 week. If I restart the service, the http api will work again.
Do you have similar issue in your cluster? Is there any diagnostic data I can collect when the service stuck?
How to use ssl certificates for the server?, we all knew that WEBRTC needs an HTPS protocol to work
Hi, Cedric. Thanks for your work on this! I've been troubleshooting my current setup pretty extensively. I was trying to mock up a production configuration for kraken while using the kraken.fm source code to test it out. I'm using the latest code from both projects, btw. And I'm using the "relay" option in the kraken.fm code. Could you embellish on a proper setup for coturn to get this working? Thanks!
Current status:
2020/09/21 14:18:16 HandlePeer(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:aa8888df-fc40-4c6f-8df1-7b34d2e593b8) OnSignalingStateChange(have-remote-offer)
2020/09/21 14:18:16 HandlePeer(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:aa8888df-fc40-4c6f-8df1-7b34d2e593b8) OnICEConnectionStateChange(checking)
2020/09/21 14:18:16 HandlePeer(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:aa8888df-fc40-4c6f-8df1-7b34d2e593b8) OnSignalingStateChange(stable)
2020/09/21 14:18:16 RPC.handle(id: 4d007d8a-76ee-4d0a-aa63-14f535455aa6, time: 0.026520s) OK
2020/09/21 14:18:16 RPC.handle(id: 6b2ecad7-4984-4c19-afcd-4b1fa2a38db6, method: subscribe, params: [testing ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D aa8888df-fc40-4c6f-8df1-7b34d2e593b8])
2020/09/21 14:18:16 RPC.handle(id: 6b2ecad7-4984-4c19-afcd-4b1fa2a38db6, time: 0.000125s) OK
2020/09/21 14:18:20 RPC.handle(id: a2b36796-57b2-4c80-89d7-70057c4535ff, method: subscribe, params: [testing ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D aa8888df-fc40-4c6f-8df1-7b34d2e593b8])
2020/09/21 14:18:20 RPC.handle(id: a2b36796-57b2-4c80-89d7-70057c4535ff, time: 0.000121s) OK
2020/09/21 14:18:23 RPC.handle(id: defe36ab-20ae-4cd5-ad70-7a2cecd0be9c, method: subscribe, params: [testing ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D aa8888df-fc40-4c6f-8df1-7b34d2e593b8])
2020/09/21 14:18:23 RPC.handle(id: defe36ab-20ae-4cd5-ad70-7a2cecd0be9c, time: 0.000090s) OK
2020/09/21 14:18:26 RPC.handle(id: fda56f2d-7f59-43bf-b77a-bdf86c8c9c2d, method: subscribe, params: [testing ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D aa8888df-fc40-4c6f-8df1-7b34d2e593b8])
2020/09/21 14:18:26 RPC.handle(id: fda56f2d-7f59-43bf-b77a-bdf86c8c9c2d, time: 0.000139s) OK
2020/09/21 14:18:26 HandlePeer(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:aa8888df-fc40-4c6f-8df1-7b34d2e593b8) OnTrackTimeout()
2020/09/21 14:18:26 PeerClose(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:aa8888df-fc40-4c6f-8df1-7b34d2e593b8) now
2020/09/21 14:18:26 PeerClose(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:CLOSED) with <nil>
2020/09/21 14:18:26 HandlePeer(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:CLOSED) OnConnectionStateChange(closed)
2020/09/21 14:18:26 HandlePeer(testing:ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D:CLOSED) OnICEConnectionStateChange(closed)
2020/09/21 14:18:29 RPC.handle(id: 72e68ef2-b410-4a91-9d30-92130868cd01, method: subscribe, params: [testing ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D aa8888df-fc40-4c6f-8df1-7b34d2e593b8])
2020/09/21 14:18:29 RPC.handle(id: 72e68ef2-b410-4a91-9d30-92130868cd01, time: 0.000090s) ERROR {"status":202,"code":5002002,"description":"peer ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D closed in testing"}
2020/09/21 14:18:32 RPC.handle(id: cde4f29a-df09-4606-87b4-229bf817e67b, method: subscribe, params: [testing ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D aa8888df-fc40-4c6f-8df1-7b34d2e593b8])
2020/09/21 14:18:32 RPC.handle(id: cde4f29a-df09-4606-87b4-229bf817e67b, time: 0.000089s) ERROR {"status":202,"code":5002002,"description":"peer ca5a8823-64e2-4b0f-9851-8fc9cd9cfb75%3ASGV5dGhlcmU%3D closed in testing"}```
My branch is 2 years old and merged fix: #33
Not sure if the panic is caused by the fix or if the latest code has fixed this. I will update the info here if I find the root cause.
Line 195 in 221733d
Given that this for loop executes on every packet, it is probably better to use NewTimer and Reset in this loop. See e.g. https://medium.com/@oboturov/golang-time-after-is-not-garbage-collected-4cbc94740082 for a bit of discussion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.