switch participant to interface

This commit is contained in:
David Zhao
2020-12-21 23:00:48 -08:00
parent c4cb29a3bb
commit 2a79bdb678
12 changed files with 681 additions and 138 deletions
-24
View File
@@ -1,25 +1 @@
package rtc
import (
"github.com/livekit/livekit-server/proto/livekit"
)
// PublishedTrack is the main interface representing a track published to the room
// it's responsible for managing subscribers and forwarding data from the input track to all subscribers
type PublishedTrack interface {
Start()
ID() string
Kind() livekit.TrackInfo_Type
StreamID() string
AddSubscriber(participant *Participant) error
RemoveSubscriber(participantId string)
RemoveAllSubscribers()
}
func TrackToProto(t PublishedTrack) *livekit.TrackInfo {
return &livekit.TrackInfo{
Sid: t.ID(),
Type: t.Kind(),
Name: t.StreamID(),
}
}