Support for video dimensions in publications (#36)
* send back video dimensions * Store video dimensions in MediaTrack and forward in TrackInfo * use committed protocol
This commit is contained in:
+24
-7
@@ -29,13 +29,14 @@ var (
|
||||
// MediaTrack represents a WebRTC track that needs to be forwarded
|
||||
// Implements the PublishedTrack interface
|
||||
type MediaTrack struct {
|
||||
params MediaTrackParams
|
||||
ssrc webrtc.SSRC
|
||||
name string
|
||||
streamID string
|
||||
kind livekit.TrackType
|
||||
codec webrtc.RTPCodecParameters
|
||||
muted utils.AtomicFlag
|
||||
params MediaTrackParams
|
||||
ssrc webrtc.SSRC
|
||||
name string
|
||||
streamID string
|
||||
kind livekit.TrackType
|
||||
codec webrtc.RTPCodecParameters
|
||||
muted utils.AtomicFlag
|
||||
simulcasted bool
|
||||
|
||||
// channel to send RTCP packets to the source
|
||||
lock sync.RWMutex
|
||||
@@ -57,6 +58,8 @@ type MediaTrackParams struct {
|
||||
ReceiverConfig ReceiverConfig
|
||||
AudioConfig config.AudioConfig
|
||||
Stats *RoomStatsReporter
|
||||
Width uint32
|
||||
Height uint32
|
||||
}
|
||||
|
||||
func NewMediaTrack(track *webrtc.TrackRemote, params MediaTrackParams) *MediaTrack {
|
||||
@@ -283,6 +286,8 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
|
||||
t.params.Stats.AddPublishedTrack(t.kind.String())
|
||||
}
|
||||
t.receiver.AddUpTrack(track, buff, true)
|
||||
// when RID is set, track is simulcasted
|
||||
t.simulcasted = track.RID() != ""
|
||||
|
||||
buff.Bind(receiver.GetParameters(), buffer.Options{
|
||||
MaxBitRate: t.params.ReceiverConfig.maxBitrate,
|
||||
@@ -310,6 +315,18 @@ func (t *MediaTrack) RemoveAllSubscribers() {
|
||||
t.subscribedTracks = make(map[string]*SubscribedTrack)
|
||||
}
|
||||
|
||||
func (t *MediaTrack) ToProto() *livekit.TrackInfo {
|
||||
return &livekit.TrackInfo{
|
||||
Sid: t.ID(),
|
||||
Type: t.Kind(),
|
||||
Name: t.Name(),
|
||||
Muted: t.IsMuted(),
|
||||
Width: t.params.Width,
|
||||
Height: t.params.Height,
|
||||
Simulcast: t.simulcasted,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: send for all downtracks from the source participant
|
||||
// https://tools.ietf.org/html/rfc7941
|
||||
func (t *MediaTrack) sendDownTrackBindingReports(sub types.Participant) {
|
||||
|
||||
Reference in New Issue
Block a user