mirror of
https://github.com/livekit/livekit.git
synced 2026-08-27 02:39:44 +00:00
switch to RTPTrailerFeatures
This commit is contained in:
@@ -518,8 +518,8 @@ func (t *MediaTrackReceiver) IsEncrypted() bool {
|
||||
return t.TrackInfo().Encryption != livekit.Encryption_NONE
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) HasUserTimestamp() bool {
|
||||
return t.TrackInfo().GetHasUserTimestamp()
|
||||
func (t *MediaTrackReceiver) HasRTPTrailerFeature(feature livekit.RTPTrailerFeature) bool {
|
||||
return slices.Contains(t.TrackInfo().GetRtpTrailerFeatures(), feature)
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) AddOnClose(f func(isExpectedToResume bool)) {
|
||||
|
||||
+15
-14
@@ -2832,20 +2832,21 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
|
||||
}
|
||||
|
||||
ti := &livekit.TrackInfo{
|
||||
Type: req.Type,
|
||||
Name: req.Name,
|
||||
Width: req.Width,
|
||||
Height: req.Height,
|
||||
Muted: req.Muted,
|
||||
DisableDtx: req.DisableDtx,
|
||||
Source: req.Source,
|
||||
Layers: cloneLayers(req.Layers),
|
||||
DisableRed: req.DisableRed,
|
||||
Stereo: req.Stereo,
|
||||
Encryption: req.Encryption,
|
||||
Stream: req.Stream,
|
||||
BackupCodecPolicy: backupCodecPolicy,
|
||||
AudioFeatures: sutils.DedupeSlice(req.AudioFeatures),
|
||||
Type: req.Type,
|
||||
Name: req.Name,
|
||||
Width: req.Width,
|
||||
Height: req.Height,
|
||||
Muted: req.Muted,
|
||||
DisableDtx: req.DisableDtx,
|
||||
Source: req.Source,
|
||||
Layers: cloneLayers(req.Layers),
|
||||
DisableRed: req.DisableRed,
|
||||
Stereo: req.Stereo,
|
||||
Encryption: req.Encryption,
|
||||
Stream: req.Stream,
|
||||
BackupCodecPolicy: backupCodecPolicy,
|
||||
AudioFeatures: sutils.DedupeSlice(req.AudioFeatures),
|
||||
RtpTrailerFeatures: sutils.DedupeSlice(req.RtpTrailerFeatures),
|
||||
}
|
||||
if req.Stereo && !slices.Contains(ti.AudioFeatures, livekit.AudioTrackFeature_TF_STEREO) {
|
||||
ti.AudioFeatures = append(ti.AudioFeatures, livekit.AudioTrackFeature_TF_STEREO)
|
||||
|
||||
@@ -129,7 +129,7 @@ func NewSubscribedTrack(params SubscribedTrackParams) (*SubscribedTrack, error)
|
||||
if isEncrypted {
|
||||
trailer = params.Subscriber.GetTrailer()
|
||||
}
|
||||
stripUserTimestamp := params.MediaTrack.HasUserTimestamp() &&
|
||||
stripUserTimestamp := params.MediaTrack.HasRTPTrailerFeature(livekit.RTPTrailerFeature_USER_TIMESTAMP) &&
|
||||
!params.Subscriber.ProtocolVersion().SupportsUserTimestamp()
|
||||
downTrack, err := sfu.NewDownTrack(sfu.DownTrackParams{
|
||||
Codecs: codecs,
|
||||
|
||||
@@ -761,7 +761,7 @@ type MediaTrack interface {
|
||||
ClearAllReceivers(isExpectedToResume bool)
|
||||
|
||||
IsEncrypted() bool
|
||||
HasUserTimestamp() bool
|
||||
HasRTPTrailerFeature(livekit.RTPTrailerFeature) bool
|
||||
}
|
||||
|
||||
//counterfeiter:generate . LocalMediaTrack
|
||||
|
||||
@@ -124,6 +124,17 @@ type FakeLocalMediaTrack struct {
|
||||
getTrackStatsReturnsOnCall map[int]struct {
|
||||
result1 *livekit.RTPStats
|
||||
}
|
||||
HasRTPTrailerFeatureStub func(livekit.RTPTrailerFeature) bool
|
||||
hasRTPTrailerFeatureMutex sync.RWMutex
|
||||
hasRTPTrailerFeatureArgsForCall []struct {
|
||||
arg1 livekit.RTPTrailerFeature
|
||||
}
|
||||
hasRTPTrailerFeatureReturns struct {
|
||||
result1 bool
|
||||
}
|
||||
hasRTPTrailerFeatureReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
HasSdpCidStub func(string) bool
|
||||
hasSdpCidMutex sync.RWMutex
|
||||
hasSdpCidArgsForCall []struct {
|
||||
@@ -146,16 +157,6 @@ type FakeLocalMediaTrack struct {
|
||||
hasSignalCidReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
HasUserTimestampStub func() bool
|
||||
hasUserTimestampMutex sync.RWMutex
|
||||
hasUserTimestampArgsForCall []struct {
|
||||
}
|
||||
hasUserTimestampReturns struct {
|
||||
result1 bool
|
||||
}
|
||||
hasUserTimestampReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
IDStub func() livekit.TrackID
|
||||
iDMutex sync.RWMutex
|
||||
iDArgsForCall []struct {
|
||||
@@ -960,6 +961,67 @@ func (fake *FakeLocalMediaTrack) GetTrackStatsReturnsOnCall(i int, result1 *live
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasRTPTrailerFeature(arg1 livekit.RTPTrailerFeature) bool {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
ret, specificReturn := fake.hasRTPTrailerFeatureReturnsOnCall[len(fake.hasRTPTrailerFeatureArgsForCall)]
|
||||
fake.hasRTPTrailerFeatureArgsForCall = append(fake.hasRTPTrailerFeatureArgsForCall, struct {
|
||||
arg1 livekit.RTPTrailerFeature
|
||||
}{arg1})
|
||||
stub := fake.HasRTPTrailerFeatureStub
|
||||
fakeReturns := fake.hasRTPTrailerFeatureReturns
|
||||
fake.recordInvocation("HasRTPTrailerFeature", []interface{}{arg1})
|
||||
fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasRTPTrailerFeatureCallCount() int {
|
||||
fake.hasRTPTrailerFeatureMutex.RLock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.RUnlock()
|
||||
return len(fake.hasRTPTrailerFeatureArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasRTPTrailerFeatureCalls(stub func(livekit.RTPTrailerFeature) bool) {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
fake.HasRTPTrailerFeatureStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasRTPTrailerFeatureArgsForCall(i int) livekit.RTPTrailerFeature {
|
||||
fake.hasRTPTrailerFeatureMutex.RLock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.RUnlock()
|
||||
argsForCall := fake.hasRTPTrailerFeatureArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasRTPTrailerFeatureReturns(result1 bool) {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
fake.HasRTPTrailerFeatureStub = nil
|
||||
fake.hasRTPTrailerFeatureReturns = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasRTPTrailerFeatureReturnsOnCall(i int, result1 bool) {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
fake.HasRTPTrailerFeatureStub = nil
|
||||
if fake.hasRTPTrailerFeatureReturnsOnCall == nil {
|
||||
fake.hasRTPTrailerFeatureReturnsOnCall = make(map[int]struct {
|
||||
result1 bool
|
||||
})
|
||||
}
|
||||
fake.hasRTPTrailerFeatureReturnsOnCall[i] = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasSdpCid(arg1 string) bool {
|
||||
fake.hasSdpCidMutex.Lock()
|
||||
ret, specificReturn := fake.hasSdpCidReturnsOnCall[len(fake.hasSdpCidArgsForCall)]
|
||||
@@ -1082,59 +1144,6 @@ func (fake *FakeLocalMediaTrack) HasSignalCidReturnsOnCall(i int, result1 bool)
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasUserTimestamp() bool {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
ret, specificReturn := fake.hasUserTimestampReturnsOnCall[len(fake.hasUserTimestampArgsForCall)]
|
||||
fake.hasUserTimestampArgsForCall = append(fake.hasUserTimestampArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.HasUserTimestampStub
|
||||
fakeReturns := fake.hasUserTimestampReturns
|
||||
fake.recordInvocation("HasUserTimestamp", []interface{}{})
|
||||
fake.hasUserTimestampMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasUserTimestampCallCount() int {
|
||||
fake.hasUserTimestampMutex.RLock()
|
||||
defer fake.hasUserTimestampMutex.RUnlock()
|
||||
return len(fake.hasUserTimestampArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasUserTimestampCalls(stub func() bool) {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
defer fake.hasUserTimestampMutex.Unlock()
|
||||
fake.HasUserTimestampStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasUserTimestampReturns(result1 bool) {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
defer fake.hasUserTimestampMutex.Unlock()
|
||||
fake.HasUserTimestampStub = nil
|
||||
fake.hasUserTimestampReturns = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) HasUserTimestampReturnsOnCall(i int, result1 bool) {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
defer fake.hasUserTimestampMutex.Unlock()
|
||||
fake.HasUserTimestampStub = nil
|
||||
if fake.hasUserTimestampReturnsOnCall == nil {
|
||||
fake.hasUserTimestampReturnsOnCall = make(map[int]struct {
|
||||
result1 bool
|
||||
})
|
||||
}
|
||||
fake.hasUserTimestampReturnsOnCall[i] = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) ID() livekit.TrackID {
|
||||
fake.iDMutex.Lock()
|
||||
ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)]
|
||||
|
||||
@@ -98,14 +98,15 @@ type FakeMediaTrack struct {
|
||||
getTemporalLayerForSpatialFpsReturnsOnCall map[int]struct {
|
||||
result1 int32
|
||||
}
|
||||
HasUserTimestampStub func() bool
|
||||
hasUserTimestampMutex sync.RWMutex
|
||||
hasUserTimestampArgsForCall []struct {
|
||||
HasRTPTrailerFeatureStub func(livekit.RTPTrailerFeature) bool
|
||||
hasRTPTrailerFeatureMutex sync.RWMutex
|
||||
hasRTPTrailerFeatureArgsForCall []struct {
|
||||
arg1 livekit.RTPTrailerFeature
|
||||
}
|
||||
hasUserTimestampReturns struct {
|
||||
hasRTPTrailerFeatureReturns struct {
|
||||
result1 bool
|
||||
}
|
||||
hasUserTimestampReturnsOnCall map[int]struct {
|
||||
hasRTPTrailerFeatureReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
IDStub func() livekit.TrackID
|
||||
@@ -752,17 +753,18 @@ func (fake *FakeMediaTrack) GetTemporalLayerForSpatialFpsReturnsOnCall(i int, re
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) HasUserTimestamp() bool {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
ret, specificReturn := fake.hasUserTimestampReturnsOnCall[len(fake.hasUserTimestampArgsForCall)]
|
||||
fake.hasUserTimestampArgsForCall = append(fake.hasUserTimestampArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.HasUserTimestampStub
|
||||
fakeReturns := fake.hasUserTimestampReturns
|
||||
fake.recordInvocation("HasUserTimestamp", []interface{}{})
|
||||
fake.hasUserTimestampMutex.Unlock()
|
||||
func (fake *FakeMediaTrack) HasRTPTrailerFeature(arg1 livekit.RTPTrailerFeature) bool {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
ret, specificReturn := fake.hasRTPTrailerFeatureReturnsOnCall[len(fake.hasRTPTrailerFeatureArgsForCall)]
|
||||
fake.hasRTPTrailerFeatureArgsForCall = append(fake.hasRTPTrailerFeatureArgsForCall, struct {
|
||||
arg1 livekit.RTPTrailerFeature
|
||||
}{arg1})
|
||||
stub := fake.HasRTPTrailerFeatureStub
|
||||
fakeReturns := fake.hasRTPTrailerFeatureReturns
|
||||
fake.recordInvocation("HasRTPTrailerFeature", []interface{}{arg1})
|
||||
fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
@@ -770,37 +772,44 @@ func (fake *FakeMediaTrack) HasUserTimestamp() bool {
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) HasUserTimestampCallCount() int {
|
||||
fake.hasUserTimestampMutex.RLock()
|
||||
defer fake.hasUserTimestampMutex.RUnlock()
|
||||
return len(fake.hasUserTimestampArgsForCall)
|
||||
func (fake *FakeMediaTrack) HasRTPTrailerFeatureCallCount() int {
|
||||
fake.hasRTPTrailerFeatureMutex.RLock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.RUnlock()
|
||||
return len(fake.hasRTPTrailerFeatureArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) HasUserTimestampCalls(stub func() bool) {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
defer fake.hasUserTimestampMutex.Unlock()
|
||||
fake.HasUserTimestampStub = stub
|
||||
func (fake *FakeMediaTrack) HasRTPTrailerFeatureCalls(stub func(livekit.RTPTrailerFeature) bool) {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
fake.HasRTPTrailerFeatureStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) HasUserTimestampReturns(result1 bool) {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
defer fake.hasUserTimestampMutex.Unlock()
|
||||
fake.HasUserTimestampStub = nil
|
||||
fake.hasUserTimestampReturns = struct {
|
||||
func (fake *FakeMediaTrack) HasRTPTrailerFeatureArgsForCall(i int) livekit.RTPTrailerFeature {
|
||||
fake.hasRTPTrailerFeatureMutex.RLock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.RUnlock()
|
||||
argsForCall := fake.hasRTPTrailerFeatureArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) HasRTPTrailerFeatureReturns(result1 bool) {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
fake.HasRTPTrailerFeatureStub = nil
|
||||
fake.hasRTPTrailerFeatureReturns = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) HasUserTimestampReturnsOnCall(i int, result1 bool) {
|
||||
fake.hasUserTimestampMutex.Lock()
|
||||
defer fake.hasUserTimestampMutex.Unlock()
|
||||
fake.HasUserTimestampStub = nil
|
||||
if fake.hasUserTimestampReturnsOnCall == nil {
|
||||
fake.hasUserTimestampReturnsOnCall = make(map[int]struct {
|
||||
func (fake *FakeMediaTrack) HasRTPTrailerFeatureReturnsOnCall(i int, result1 bool) {
|
||||
fake.hasRTPTrailerFeatureMutex.Lock()
|
||||
defer fake.hasRTPTrailerFeatureMutex.Unlock()
|
||||
fake.HasRTPTrailerFeatureStub = nil
|
||||
if fake.hasRTPTrailerFeatureReturnsOnCall == nil {
|
||||
fake.hasRTPTrailerFeatureReturnsOnCall = make(map[int]struct {
|
||||
result1 bool
|
||||
})
|
||||
}
|
||||
fake.hasUserTimestampReturnsOnCall[i] = struct {
|
||||
fake.hasRTPTrailerFeatureReturnsOnCall[i] = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user