server to support mutes

This commit is contained in:
David Zhao
2020-12-31 14:21:19 -08:00
parent be6086ce95
commit 313236e3d3
11 changed files with 231 additions and 150 deletions
+11 -1
View File
@@ -27,6 +27,7 @@ type MediaTrack struct {
ctx context.Context
id string
participantId string
muted bool
// source remoteTrack
remoteTrack *webrtc.TrackRemote
// channel to send RTCP packets to the source
@@ -82,11 +83,15 @@ func (t *MediaTrack) StreamID() string {
return t.remoteTrack.StreamID()
}
func (t *MediaTrack) IsMuted() bool {
return t.muted
}
// subscribes participant to current remoteTrack
// creates and add necessary forwarders and starts them
func (t *MediaTrack) AddSubscriber(participant Participant) error {
codec := t.remoteTrack.Codec()
// pack ID to identify all tracks
// pack ID to identify all publishedTracks
packedId := PackTrackId(t.participantId, t.id)
// using DownTrack from ion-sfu
@@ -191,6 +196,11 @@ func (t *MediaTrack) forwardRTPWorker() {
"track", t.id)
}
if t.muted {
// short circuit when track is muted
continue
}
//logger.GetLogger().Debugw("read packet from remoteTrack",
// "participantId", t.participantId,
// "remoteTrack", t.remoteTrack.ID())