Skip to content

Commit 0e7086d

Browse files
committed
Remove RTC prefix from all names
Let's pull off the bandaid! * Reduces studdering: webrtc.RTCTrack -> webrtc.Track * Makes it easier to find types by editor autocomplete * Makes code read more fluently (less repetition) Since we're breaking the API in 2.0, our only chance to do this is now. Relates to #408
1 parent b711ec2 commit 0e7086d

File tree

112 files changed

+2093
-2093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2093
-2093
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Check out the **[contributing wiki](https://github.com/pions/webrtc/wiki/Contrib
7474
* [Tobias Fridén](https://github.com/tobiasfriden) *SRTP authentication verification*
7575
* [Yutaka Takeda](https://github.com/enobufs) *Fix ICE connection timeout*
7676
* [Hugo Arregui](https://github.com/hugoArregui) *Fix connection timeout*
77-
* [Rob Deutsch](https://github.com/rob-deutsch) *RTCRtpReceiver graceful shutdown*
77+
* [Rob Deutsch](https://github.com/rob-deutsch) *RTPReceiver graceful shutdown*
7878
* [Jin Lei](https://github.com/jinleileiking) - *SFU example use http*
7979

8080
### License

api.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func SetConnectionTimeout(connectionTimeout, keepAlive time.Duration) {
7777

7878
// RegisterCodec on the default API.
7979
// See MediaEngine for details.
80-
func RegisterCodec(codec *RTCRtpCodec) {
80+
func RegisterCodec(codec *RTPCodec) {
8181
defaultAPI.mediaEngine.RegisterCodec(codec)
8282
}
8383

@@ -89,8 +89,8 @@ func RegisterDefaultCodecs() {
8989

9090
// PeerConnection API
9191

92-
// NewRTCPeerConnection using the default API.
92+
// NewPeerConnection using the default API.
9393
// See API.NewRTCPeerConnection for details.
94-
func NewRTCPeerConnection(configuration RTCConfiguration) (*RTCPeerConnection, error) {
95-
return defaultAPI.NewRTCPeerConnection(configuration)
94+
func NewPeerConnection(configuration Configuration) (*PeerConnection, error) {
95+
return defaultAPI.NewPeerConnection(configuration)
9696
}

errors.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@ var (
3535
ErrPrivateKeyType = errors.New("private key type not supported")
3636

3737
// ErrModifyingPeerIdentity indicates that an attempt to modify
38-
// PeerIdentity was made after RTCPeerConnection has been initialized.
38+
// PeerIdentity was made after PeerConnection has been initialized.
3939
ErrModifyingPeerIdentity = errors.New("peerIdentity cannot be modified")
4040

4141
// ErrModifyingCertificates indicates that an attempt to modify
42-
// Certificates was made after RTCPeerConnection has been initialized.
42+
// Certificates was made after PeerConnection has been initialized.
4343
ErrModifyingCertificates = errors.New("certificates cannot be modified")
4444

4545
// ErrModifyingBundlePolicy indicates that an attempt to modify
46-
// BundlePolicy was made after RTCPeerConnection has been initialized.
46+
// BundlePolicy was made after PeerConnection has been initialized.
4747
ErrModifyingBundlePolicy = errors.New("bundle policy cannot be modified")
4848

49-
// ErrModifyingRtcpMuxPolicy indicates that an attempt to modify
50-
// RtcpMuxPolicy was made after RTCPeerConnection has been initialized.
51-
ErrModifyingRtcpMuxPolicy = errors.New("rtcp mux policy cannot be modified")
49+
// ErrModifyingRTCPMuxPolicy indicates that an attempt to modify
50+
// RTCPMuxPolicy was made after PeerConnection has been initialized.
51+
ErrModifyingRTCPMuxPolicy = errors.New("rtcp mux policy cannot be modified")
5252

53-
// ErrModifyingIceCandidatePoolSize indicates that an attempt to modify
54-
// IceCandidatePoolSize was made after RTCPeerConnection has been initialized.
55-
ErrModifyingIceCandidatePoolSize = errors.New("ice candidate pool size cannot be modified")
53+
// ErrModifyingICECandidatePoolSize indicates that an attempt to modify
54+
// ICECandidatePoolSize was made after PeerConnection has been initialized.
55+
ErrModifyingICECandidatePoolSize = errors.New("ice candidate pool size cannot be modified")
5656

5757
// ErrStringSizeLimit indicates that the character size limit of string is
5858
// exceeded. The limit is hardcoded to 65535 according to specifications.

examples/data-channels-close/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ func main() {
1818
// Everything below is the pion-WebRTC API! Thanks for using it ❤️.
1919

2020
// Prepare the configuration
21-
config := webrtc.RTCConfiguration{
22-
IceServers: []webrtc.RTCIceServer{
21+
config := webrtc.Configuration{
22+
ICEServers: []webrtc.ICEServer{
2323
{
2424
URLs: []string{"stun:stun.l.google.com:19302"},
2525
},
2626
},
2727
}
2828

2929
// Create a new RTCPeerConnection
30-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
30+
peerConnection, err := webrtc.NewPeerConnection(config)
3131
util.Check(err)
3232

3333
// Set the handler for ICE connection state
@@ -37,7 +37,7 @@ func main() {
3737
})
3838

3939
// Register data channel creation handling
40-
peerConnection.OnDataChannel(func(d *webrtc.RTCDataChannel) {
40+
peerConnection.OnDataChannel(func(d *webrtc.DataChannel) {
4141
fmt.Printf("New DataChannel %s %d\n", d.Label, d.ID)
4242

4343
// Register channel opening handling
@@ -83,7 +83,7 @@ func main() {
8383
})
8484

8585
// Wait for the offer to be pasted
86-
offer := webrtc.RTCSessionDescription{}
86+
offer := webrtc.SessionDescription{}
8787
util.Decode(util.MustReadStdin(), &offer)
8888

8989
// Set the remote SessionDescription

examples/data-channels-create/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ func main() {
1414
// Everything below is the pion-WebRTC API! Thanks for using it ❤️.
1515

1616
// Prepare the configuration
17-
config := webrtc.RTCConfiguration{
18-
IceServers: []webrtc.RTCIceServer{
17+
config := webrtc.Configuration{
18+
ICEServers: []webrtc.ICEServer{
1919
{
2020
URLs: []string{"stun:stun.l.google.com:19302"},
2121
},
2222
},
2323
}
2424

2525
// Create a new RTCPeerConnection
26-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
26+
peerConnection, err := webrtc.NewPeerConnection(config)
2727
util.Check(err)
2828

2929
// Create a datachannel with label 'data'
@@ -73,7 +73,7 @@ func main() {
7373
fmt.Println(util.Encode(offer))
7474

7575
// Wait for the answer to be pasted
76-
answer := webrtc.RTCSessionDescription{}
76+
answer := webrtc.SessionDescription{}
7777
util.Decode(util.MustReadStdin(), &answer)
7878

7979
// Apply the answer as the remote description

examples/data-channels-detach-create/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ func main() {
2121
// Everything below is the pion-WebRTC API! Thanks for using it ❤️.
2222

2323
// Prepare the configuration
24-
config := webrtc.RTCConfiguration{
25-
IceServers: []webrtc.RTCIceServer{
24+
config := webrtc.Configuration{
25+
ICEServers: []webrtc.ICEServer{
2626
{
2727
URLs: []string{"stun:stun.l.google.com:19302"},
2828
},
2929
},
3030
}
3131

3232
// Create a new RTCPeerConnection
33-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
33+
peerConnection, err := webrtc.NewPeerConnection(config)
3434
util.Check(err)
3535

3636
// Create a datachannel with label 'data'
@@ -70,7 +70,7 @@ func main() {
7070
fmt.Println(util.Encode(offer))
7171

7272
// Wait for the answer to be pasted
73-
answer := webrtc.RTCSessionDescription{}
73+
answer := webrtc.SessionDescription{}
7474
util.Decode(util.MustReadStdin(), answer)
7575

7676
// Apply the answer as the remote description

examples/data-channels-detach/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ func main() {
2121
// Everything below is the pion-WebRTC API! Thanks for using it ❤️.
2222

2323
// Prepare the configuration
24-
config := webrtc.RTCConfiguration{
25-
IceServers: []webrtc.RTCIceServer{
24+
config := webrtc.Configuration{
25+
ICEServers: []webrtc.ICEServer{
2626
{
2727
URLs: []string{"stun:stun.l.google.com:19302"},
2828
},
2929
},
3030
}
3131

3232
// Create a new RTCPeerConnection
33-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
33+
peerConnection, err := webrtc.NewPeerConnection(config)
3434
util.Check(err)
3535

3636
// Set the handler for ICE connection state
@@ -40,7 +40,7 @@ func main() {
4040
})
4141

4242
// Register data channel creation handling
43-
peerConnection.OnDataChannel(func(d *webrtc.RTCDataChannel) {
43+
peerConnection.OnDataChannel(func(d *webrtc.DataChannel) {
4444
fmt.Printf("New DataChannel %s %d\n", d.Label, d.ID)
4545

4646
// Register channel opening handling
@@ -60,7 +60,7 @@ func main() {
6060
})
6161

6262
// Wait for the offer to be pasted
63-
offer := webrtc.RTCSessionDescription{}
63+
offer := webrtc.SessionDescription{}
6464
util.Decode(util.MustReadStdin(), offer)
6565

6666
// Set the remote SessionDescription

examples/data-channels/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ func main() {
1414
// Everything below is the pion-WebRTC API! Thanks for using it ❤️.
1515

1616
// Prepare the configuration
17-
config := webrtc.RTCConfiguration{
18-
IceServers: []webrtc.RTCIceServer{
17+
config := webrtc.Configuration{
18+
ICEServers: []webrtc.ICEServer{
1919
{
2020
URLs: []string{"stun:stun.l.google.com:19302"},
2121
},
2222
},
2323
}
2424

2525
// Create a new RTCPeerConnection
26-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
26+
peerConnection, err := webrtc.NewPeerConnection(config)
2727
util.Check(err)
2828

2929
// Set the handler for ICE connection state
@@ -33,7 +33,7 @@ func main() {
3333
})
3434

3535
// Register data channel creation handling
36-
peerConnection.OnDataChannel(func(d *webrtc.RTCDataChannel) {
36+
peerConnection.OnDataChannel(func(d *webrtc.DataChannel) {
3737
fmt.Printf("New DataChannel %s %d\n", d.Label, d.ID)
3838

3939
// Register channel opening handling
@@ -63,7 +63,7 @@ func main() {
6363
})
6464

6565
// Wait for the offer to be pasted
66-
offer := webrtc.RTCSessionDescription{}
66+
offer := webrtc.SessionDescription{}
6767
util.Decode(util.MustReadStdin(), &offer)
6868

6969
// Set the remote SessionDescription

examples/gstreamer-receive/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ func gstreamerReceiveMain() {
2222
webrtc.RegisterDefaultCodecs()
2323

2424
// Prepare the configuration
25-
config := webrtc.RTCConfiguration{
26-
IceServers: []webrtc.RTCIceServer{
25+
config := webrtc.Configuration{
26+
ICEServers: []webrtc.ICEServer{
2727
{
2828
URLs: []string{"stun:stun.l.google.com:19302"},
2929
},
3030
},
3131
}
3232

3333
// Create a new RTCPeerConnection
34-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
34+
peerConnection, err := webrtc.NewPeerConnection(config)
3535
util.Check(err)
3636

3737
// Set a handler for when a new remote track starts, this handler creates a gstreamer pipeline
3838
// for the given codec
39-
peerConnection.OnTrack(func(track *webrtc.RTCTrack) {
39+
peerConnection.OnTrack(func(track *webrtc.Track) {
4040
// Send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval
4141
// This is a temporary fix until we implement incoming RTCP events, then we would push a PLI only when a viewer requests it
4242
go func() {
@@ -66,7 +66,7 @@ func gstreamerReceiveMain() {
6666
})
6767

6868
// Wait for the offer to be pasted
69-
offer := webrtc.RTCSessionDescription{}
69+
offer := webrtc.SessionDescription{}
7070
util.Decode(util.MustReadStdin(), &offer)
7171

7272
// Set the remote SessionDescription

examples/gstreamer-send-offer/main.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ func main() {
1717
webrtc.RegisterDefaultCodecs()
1818

1919
// Prepare the configuration
20-
config := webrtc.RTCConfiguration{
21-
IceServers: []webrtc.RTCIceServer{
20+
config := webrtc.Configuration{
21+
ICEServers: []webrtc.ICEServer{
2222
{
2323
URLs: []string{"stun:stun.l.google.com:19302"},
2424
},
2525
},
2626
}
2727

2828
// Create a new RTCPeerConnection
29-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
29+
peerConnection, err := webrtc.NewPeerConnection(config)
3030
util.Check(err)
3131

3232
// Set the handler for ICE connection state
@@ -36,13 +36,13 @@ func main() {
3636
})
3737

3838
// Create a audio track
39-
opusTrack, err := peerConnection.NewRTCSampleTrack(webrtc.DefaultPayloadTypeOpus, "audio", "pion1")
39+
opusTrack, err := peerConnection.NewSampleTrack(webrtc.DefaultPayloadTypeOpus, "audio", "pion1")
4040
util.Check(err)
4141
_, err = peerConnection.AddTrack(opusTrack)
4242
util.Check(err)
4343

4444
// Create a video track
45-
vp8Track, err := peerConnection.NewRTCSampleTrack(webrtc.DefaultPayloadTypeVP8, "video", "pion2")
45+
vp8Track, err := peerConnection.NewSampleTrack(webrtc.DefaultPayloadTypeVP8, "video", "pion2")
4646
util.Check(err)
4747
_, err = peerConnection.AddTrack(vp8Track)
4848
util.Check(err)
@@ -59,7 +59,7 @@ func main() {
5959
fmt.Println(util.Encode(offer))
6060

6161
// Wait for the answer to be pasted
62-
answer := webrtc.RTCSessionDescription{}
62+
answer := webrtc.SessionDescription{}
6363
util.Decode(util.MustReadStdin(), &answer)
6464

6565
// Set the remote SessionDescription

examples/gstreamer-send/main.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ func main() {
2222
webrtc.RegisterDefaultCodecs()
2323

2424
// Prepare the configuration
25-
config := webrtc.RTCConfiguration{
26-
IceServers: []webrtc.RTCIceServer{
25+
config := webrtc.Configuration{
26+
ICEServers: []webrtc.ICEServer{
2727
{
2828
URLs: []string{"stun:stun.l.google.com:19302"},
2929
},
3030
},
3131
}
3232

3333
// Create a new RTCPeerConnection
34-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
34+
peerConnection, err := webrtc.NewPeerConnection(config)
3535
util.Check(err)
3636

3737
// Set the handler for ICE connection state
@@ -41,19 +41,19 @@ func main() {
4141
})
4242

4343
// Create a audio track
44-
opusTrack, err := peerConnection.NewRTCSampleTrack(webrtc.DefaultPayloadTypeOpus, "audio", "pion1")
44+
opusTrack, err := peerConnection.NewSampleTrack(webrtc.DefaultPayloadTypeOpus, "audio", "pion1")
4545
util.Check(err)
4646
_, err = peerConnection.AddTrack(opusTrack)
4747
util.Check(err)
4848

4949
// Create a video track
50-
vp8Track, err := peerConnection.NewRTCSampleTrack(webrtc.DefaultPayloadTypeVP8, "video", "pion2")
50+
vp8Track, err := peerConnection.NewSampleTrack(webrtc.DefaultPayloadTypeVP8, "video", "pion2")
5151
util.Check(err)
5252
_, err = peerConnection.AddTrack(vp8Track)
5353
util.Check(err)
5454

5555
// Wait for the offer to be pasted
56-
offer := webrtc.RTCSessionDescription{}
56+
offer := webrtc.SessionDescription{}
5757
util.Decode(util.MustReadStdin(), &offer)
5858

5959
// Set the remote SessionDescription

examples/janus-gateway/streaming/main.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ func main() {
4040
webrtc.RegisterDefaultCodecs()
4141

4242
// Prepare the configuration
43-
config := webrtc.RTCConfiguration{
44-
IceServers: []webrtc.RTCIceServer{
43+
config := webrtc.Configuration{
44+
ICEServers: []webrtc.ICEServer{
4545
{
4646
URLs: []string{"stun:stun.l.google.com:19302"},
4747
},
4848
},
4949
}
5050

5151
// Create a new RTCPeerConnection
52-
peerConnection, err := webrtc.NewRTCPeerConnection(config)
52+
peerConnection, err := webrtc.NewPeerConnection(config)
5353
util.Check(err)
5454

5555
peerConnection.OnICEConnectionStateChange(func(connectionState ice.ConnectionState) {
5656
fmt.Printf("Connection State has changed %s \n", connectionState.String())
5757
})
5858

59-
peerConnection.OnTrack(func(track *webrtc.RTCTrack) {
59+
peerConnection.OnTrack(func(track *webrtc.Track) {
6060
if track.Codec.Name == webrtc.Opus {
6161
return
6262
}
@@ -98,8 +98,8 @@ func main() {
9898
util.Check(err)
9999

100100
if msg.Jsep != nil {
101-
err = peerConnection.SetRemoteDescription(webrtc.RTCSessionDescription{
102-
Type: webrtc.RTCSdpTypeOffer,
101+
err = peerConnection.SetRemoteDescription(webrtc.SessionDescription{
102+
Type: webrtc.SDPTypeOffer,
103103
Sdp: msg.Jsep["sdp"].(string),
104104
})
105105
util.Check(err)

0 commit comments

Comments
 (0)