GithubHelp home page GithubHelp logo

Bridge rooms about livekit HOT 7 CLOSED

livekit avatar livekit commented on May 12, 2024
Bridge rooms

from livekit.

Comments (7)

davidzhao avatar davidzhao commented on May 12, 2024

We do have plans to support really large rooms. Though if I'm understanding your use correctly, you should be able to join multiple rooms as a publisher, and publish your track to each room separately.

from livekit.

lukasIO avatar lukasIO commented on May 12, 2024

edit: misread the reply...
joining multiple rooms on the client side would however introduce a significant overhead esp. in simulcast scenarios, what i meant was a solution within the server, basically what mediasoup does with pipeToRouter https://mediasoup.org/documentation/v3/mediasoup/api/#router-pipeToRouter

from livekit.

davidzhao avatar davidzhao commented on May 12, 2024

pipeToRouter would only work with rooms on the same host. LiveKit is a distributed service, so we likely wouldn't introduce features that rely on the location of two different rooms.

Though, you could implement a version of bridging feature yourself by using the Go server SDK. You could do something like:

  1. Connect to the source room as a hidden participant (will be supported in 0.11.1+)
  2. Connect to the destination room as normal participant
  3. Read tracks from source room and republish to destination

This would work well for audio and non-simulcast video tracks. With simulcast, however, only a single layer will be forwarded on.

from livekit.

lukasIO avatar lukasIO commented on May 12, 2024

thanks for the suggestion!

pipeToRouter would only work with rooms on the same host. LiveKit is a distributed service, so we likely wouldn't introduce features that rely on the location of two different rooms.

just fyi, it is possible to make the pipeToRouter approach work across hosts, but the signalling between hosts is just not part of mediasoup.

from livekit.

davidzhao avatar davidzhao commented on May 12, 2024

gotcha, that makes sense. we'll definitely take it into consideration.

from livekit.

xprgv avatar xprgv commented on May 12, 2024

@davidzhao Hi. I'm trying to implement bridge (proxy) between two livekit rooms in this way:

  1. Connect to the source room
  2. Connect to the destination room
  3. Read tracks from source room and republish to destination
    and find out that my video stream isn't stable and have regular interruptions.
    Code is here
func (proxy *LivekitProxy) proxyH264SampleTrackWithPliReport(
	incomingWebrtcTrack *webrtc.TrackRemote,
	incomingPublication *lksdk.RemoteTrackPublication,
	remoteParticipant *lksdk.RemoteParticipant,
) error {
	outcomingTrack, err := lksdk.NewLocalSampleTrack(
		webrtc.RTPCodecCapability{
			MimeType: incomingPublication.MimeType(),
		},
	)
	if err != nil {
		log.Fatal(err)
	}

	if _, err := proxy.publisherRoom.LocalParticipant.PublishTrack(outcomingTrack, &lksdk.TrackPublicationOptions{
		Name: incomingPublication.Name(),
	}); err != nil {
		log.Fatal(err)
	}

	go func() {
		sb := livekitsamplebuilder.New(
			1000,
			&codecs.H264Packet{},
			incomingWebrtcTrack.Codec().ClockRate,
			livekitsamplebuilder.WithPacketDroppedHandler(func() {
				log.Println("pli from proxy")
				remoteParticipant.WritePLI(incomingWebrtcTrack.SSRC())
			}),
		)

		for {
			rtpPacket, _, err := incomingWebrtcTrack.ReadRTP()
			if err != nil {
				log.Fatal(err)
			}

			sb.Push(rtpPacket.Clone())
			for {
				sample, _ := sb.PopWithTimestamp()
				if sample == nil {
					break
				}
				if err := outcomingTrack.WriteSample(*sample, nil); err != nil {
					log.Fatal(err)
				}
			}
		}
	}()

	return nil
}

Am I to understand that for working this way I need to implement something like rtp buffer in my application for forward error correction tasks via RTCP??

from livekit.

davidzhao avatar davidzhao commented on May 12, 2024

buffering is built into our Go SDK, (when you use samplebuilder, it's buffering for you). What do you mean by and find out that my video stream isn't stable and have regular interruptions ? Can you describe these in more detail?

also I see you are handling packet loss from the original publisher, but not PLI packets coming from the destination (if the forward destination dropped frames, you'll need to signal to the original room too).

from livekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.