mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 11:32:19 +08:00
Remove RTCDataChannel priority
This has been removed from webrtc-pc[0] Relates to #748 [0] https://github.com/w3c/webrtc-pc/issues/2258
This commit is contained in:
@@ -30,7 +30,6 @@ type DataChannel struct {
|
||||
protocol string
|
||||
negotiated bool
|
||||
id *uint16
|
||||
priority PriorityType
|
||||
readyState DataChannelState
|
||||
bufferedAmountLowThreshold uint64
|
||||
|
||||
@@ -453,15 +452,6 @@ func (d *DataChannel) ID() *uint16 {
|
||||
return d.id
|
||||
}
|
||||
|
||||
// Priority represents the priority for this DataChannel. The priority is
|
||||
// assigned at channel creation time.
|
||||
func (d *DataChannel) Priority() PriorityType {
|
||||
d.mu.RLock()
|
||||
defer d.mu.RUnlock()
|
||||
|
||||
return d.priority
|
||||
}
|
||||
|
||||
// ReadyState represents the state of the DataChannel object.
|
||||
func (d *DataChannel) ReadyState() DataChannelState {
|
||||
d.mu.RLock()
|
||||
|
@@ -189,13 +189,11 @@ func TestDataChannelParamters_Go(t *testing.T) {
|
||||
dc.label = "mylabel"
|
||||
dc.protocol = "myprotocol"
|
||||
dc.negotiated = true
|
||||
dc.priority = PriorityTypeMedium
|
||||
|
||||
assert.Equal(t, dc.id, dc.ID(), "should match")
|
||||
assert.Equal(t, dc.label, dc.Label(), "should match")
|
||||
assert.Equal(t, dc.protocol, dc.Protocol(), "should match")
|
||||
assert.Equal(t, dc.negotiated, dc.Negotiated(), "should match")
|
||||
assert.Equal(t, dc.priority, dc.Priority(), "should match")
|
||||
assert.Equal(t, dc.readyState, dc.ReadyState(), "should match")
|
||||
assert.Equal(t, uint64(0), dc.BufferedAmount(), "should match")
|
||||
dc.SetBufferedAmountLowThreshold(1500)
|
||||
|
@@ -207,11 +207,6 @@ func (d *DataChannel) ID() *uint16 {
|
||||
return valueToUint16Pointer(d.underlying.Get("id"))
|
||||
}
|
||||
|
||||
// NOTE(albrow): Apparently not part of the JavaScript WebRTC API
|
||||
// // Priority represents the priority for this DataChannel. The priority is
|
||||
// // assigned at channel creation time.
|
||||
// Priority PriorityType
|
||||
|
||||
// ReadyState represents the state of the DataChannel object.
|
||||
func (d *DataChannel) ReadyState() DataChannelState {
|
||||
return newDataChannelState(d.underlying.Get("readyState").String())
|
||||
|
@@ -30,7 +30,4 @@ type DataChannelInit struct {
|
||||
|
||||
// ID overrides the default selection of ID for this channel.
|
||||
ID *uint16
|
||||
|
||||
// Priority describes the priority of this channel.
|
||||
Priority *PriorityType
|
||||
}
|
||||
|
@@ -1,71 +0,0 @@
|
||||
package webrtc
|
||||
|
||||
// PriorityType determines the priority type of a data channel.
|
||||
type PriorityType int
|
||||
|
||||
const (
|
||||
// PriorityTypeVeryLow corresponds to "below normal".
|
||||
PriorityTypeVeryLow PriorityType = iota + 1
|
||||
|
||||
// PriorityTypeLow corresponds to "normal".
|
||||
PriorityTypeLow
|
||||
|
||||
// PriorityTypeMedium corresponds to "high".
|
||||
PriorityTypeMedium
|
||||
|
||||
// PriorityTypeHigh corresponds to "extra high".
|
||||
PriorityTypeHigh
|
||||
)
|
||||
|
||||
// This is done this way because of a linter.
|
||||
const (
|
||||
priorityTypeVeryLowStr = "very-low"
|
||||
priorityTypeLowStr = "low"
|
||||
priorityTypeMediumStr = "medium"
|
||||
priorityTypeHighStr = "high"
|
||||
)
|
||||
|
||||
func newPriorityTypeFromString(raw string) PriorityType {
|
||||
switch raw {
|
||||
case priorityTypeVeryLowStr:
|
||||
return PriorityTypeVeryLow
|
||||
case priorityTypeLowStr:
|
||||
return PriorityTypeLow
|
||||
case priorityTypeMediumStr:
|
||||
return PriorityTypeMedium
|
||||
case priorityTypeHighStr:
|
||||
return PriorityTypeHigh
|
||||
default:
|
||||
return PriorityType(Unknown)
|
||||
}
|
||||
}
|
||||
|
||||
func newPriorityTypeFromUint16(raw uint16) PriorityType {
|
||||
switch {
|
||||
case raw <= 128:
|
||||
return PriorityTypeVeryLow
|
||||
case 129 <= raw && raw <= 256:
|
||||
return PriorityTypeLow
|
||||
case 257 <= raw && raw <= 512:
|
||||
return PriorityTypeMedium
|
||||
case 513 <= raw:
|
||||
return PriorityTypeHigh
|
||||
default:
|
||||
return PriorityType(Unknown)
|
||||
}
|
||||
}
|
||||
|
||||
func (p PriorityType) String() string {
|
||||
switch p {
|
||||
case PriorityTypeVeryLow:
|
||||
return priorityTypeVeryLowStr
|
||||
case PriorityTypeLow:
|
||||
return priorityTypeLowStr
|
||||
case PriorityTypeMedium:
|
||||
return priorityTypeMediumStr
|
||||
case PriorityTypeHigh:
|
||||
return priorityTypeHighStr
|
||||
default:
|
||||
return ErrUnknownType.Error()
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package webrtc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewPriorityType(t *testing.T) {
|
||||
testCases := []struct {
|
||||
priorityString string
|
||||
priorityUint16 uint16
|
||||
expectedPriority PriorityType
|
||||
}{
|
||||
{unknownStr, 0, PriorityType(Unknown)},
|
||||
{"very-low", 100, PriorityTypeVeryLow},
|
||||
{"low", 200, PriorityTypeLow},
|
||||
{"medium", 300, PriorityTypeMedium},
|
||||
{"high", 1000, PriorityTypeHigh},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
assert.Equal(t,
|
||||
testCase.expectedPriority,
|
||||
newPriorityTypeFromString(testCase.priorityString),
|
||||
"testCase: %d %v", i, testCase,
|
||||
)
|
||||
|
||||
// There is no uint that produces generate PriorityType(Unknown).
|
||||
if i == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
testCase.expectedPriority,
|
||||
newPriorityTypeFromUint16(testCase.priorityUint16),
|
||||
"testCase: %d %v", i, testCase,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPriorityType_String(t *testing.T) {
|
||||
testCases := []struct {
|
||||
priority PriorityType
|
||||
expectedString string
|
||||
}{
|
||||
{PriorityType(Unknown), unknownStr},
|
||||
{PriorityTypeVeryLow, "very-low"},
|
||||
{PriorityTypeLow, "low"},
|
||||
{PriorityTypeMedium, "medium"},
|
||||
{PriorityTypeHigh, "high"},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
assert.Equal(t,
|
||||
testCase.expectedString,
|
||||
testCase.priority.String(),
|
||||
"testCase: %d %v", i, testCase,
|
||||
)
|
||||
}
|
||||
}
|
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func TestNewRTPTransceiverDirection(t *testing.T) {
|
||||
testCases := []struct {
|
||||
priorityString string
|
||||
expectedPriority RTPTransceiverDirection
|
||||
directionString string
|
||||
expectedDirection RTPTransceiverDirection
|
||||
}{
|
||||
{unknownStr, RTPTransceiverDirection(Unknown)},
|
||||
{"sendrecv", RTPTransceiverDirectionSendrecv},
|
||||
@@ -20,8 +20,8 @@ func TestNewRTPTransceiverDirection(t *testing.T) {
|
||||
|
||||
for i, testCase := range testCases {
|
||||
assert.Equal(t,
|
||||
NewRTPTransceiverDirection(testCase.priorityString),
|
||||
testCase.expectedPriority,
|
||||
NewRTPTransceiverDirection(testCase.directionString),
|
||||
testCase.expectedDirection,
|
||||
"testCase: %d %v", i, testCase,
|
||||
)
|
||||
}
|
||||
@@ -29,7 +29,7 @@ func TestNewRTPTransceiverDirection(t *testing.T) {
|
||||
|
||||
func TestRTPTransceiverDirection_String(t *testing.T) {
|
||||
testCases := []struct {
|
||||
priority RTPTransceiverDirection
|
||||
direction RTPTransceiverDirection
|
||||
expectedString string
|
||||
}{
|
||||
{RTPTransceiverDirection(Unknown), unknownStr},
|
||||
@@ -41,7 +41,7 @@ func TestRTPTransceiverDirection_String(t *testing.T) {
|
||||
|
||||
for i, testCase := range testCases {
|
||||
assert.Equal(t,
|
||||
testCase.priority.String(),
|
||||
testCase.direction.String(),
|
||||
testCase.expectedString,
|
||||
"testCase: %d %v", i, testCase,
|
||||
)
|
||||
|
3
stats.go
3
stats.go
@@ -832,9 +832,6 @@ type AudioSenderStats struct {
|
||||
// Kind is either "audio" or "video". This reflects the "kind" attribute of the MediaStreamTrack.
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Priority indicates the priority set for the track.
|
||||
Priority PriorityType `json:"priority"`
|
||||
|
||||
// AudioLevel represents the output audio level of the track.
|
||||
//
|
||||
// The value is a value between 0..1 (linear), where 1.0 represents 0 dBov,
|
||||
|
Reference in New Issue
Block a user