mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 15:16:52 +08:00
api: fix typos
This commit is contained in:
@@ -59,8 +59,8 @@ func main() {
|
||||
|
||||
// Set the remote SessionDescription
|
||||
offer := webrtc.RTCSessionDescription{
|
||||
Typ: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
Type: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
}
|
||||
if err := peerConnection.SetRemoteDescription(offer); err != nil {
|
||||
panic(err)
|
||||
|
@@ -45,7 +45,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Create a audio track
|
||||
opusTrack, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeOpus, "audio", "pions1")
|
||||
opusTrack, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeOpus, "audio", "pion1")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Create a video track
|
||||
vp8Track, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeVP8, "video", "pions2")
|
||||
vp8Track, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeVP8, "video", "pion2")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -66,8 +66,8 @@ func main() {
|
||||
|
||||
// Set the remote SessionDescription
|
||||
offer := webrtc.RTCSessionDescription{
|
||||
Typ: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
Type: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
}
|
||||
if err := peerConnection.SetRemoteDescription(offer); err != nil {
|
||||
panic(err)
|
||||
|
@@ -61,8 +61,8 @@ func main() {
|
||||
|
||||
// Set the remote SessionDescription
|
||||
offer := webrtc.RTCSessionDescription{
|
||||
Typ: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
Type: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
}
|
||||
if err := peerConnection.SetRemoteDescription(offer); err != nil {
|
||||
panic(err)
|
||||
|
@@ -52,8 +52,8 @@ func main() {
|
||||
|
||||
// Set the remote SessionDescription
|
||||
offer := webrtc.RTCSessionDescription{
|
||||
Typ: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
Type: webrtc.RTCSdpTypeOffer,
|
||||
Sdp: string(sd),
|
||||
}
|
||||
if err := peerConnection.SetRemoteDescription(offer); err != nil {
|
||||
panic(err)
|
||||
|
@@ -75,10 +75,10 @@ func (d *SessionDescription) WithMedia(md *MediaDescription) *SessionDescription
|
||||
|
||||
// NewJSEPMediaDescription creates a new MediaDescription with
|
||||
// some settings that are required by the JSEP spec.
|
||||
func NewJSEPMediaDescription(typ string, codecPrefs []string) *MediaDescription {
|
||||
func NewJSEPMediaDescription(codecType string, codecPrefs []string) *MediaDescription {
|
||||
// TODO: handle codecPrefs
|
||||
d := &MediaDescription{
|
||||
MediaName: fmt.Sprintf("%s 9 UDP/TLS/RTP/SAVPF", typ), // TODO: other transports?
|
||||
MediaName: fmt.Sprintf("%s 9 UDP/TLS/RTP/SAVPF", codecType), // TODO: other transports?
|
||||
ConnectionData: "IN IP4 0.0.0.0",
|
||||
Attributes: []string{},
|
||||
}
|
||||
|
@@ -164,7 +164,7 @@ type RTCRtpCodec struct {
|
||||
|
||||
// NewRTCRtpCodec is used to define a new codec
|
||||
func NewRTCRtpCodec(
|
||||
typ RTCRtpCodecType,
|
||||
codecType RTCRtpCodecType,
|
||||
name string,
|
||||
clockrate uint32,
|
||||
channels uint16,
|
||||
@@ -174,14 +174,14 @@ func NewRTCRtpCodec(
|
||||
) *RTCRtpCodec {
|
||||
return &RTCRtpCodec{
|
||||
RTCRtpCodecCapability: RTCRtpCodecCapability{
|
||||
MimeType: typ.String() + "/" + name,
|
||||
MimeType: codecType.String() + "/" + name,
|
||||
ClockRate: clockrate,
|
||||
Channels: channels,
|
||||
SdpFmtpLine: fmtp,
|
||||
},
|
||||
PayloadType: payloadType,
|
||||
Payloader: payloader,
|
||||
Type: typ,
|
||||
Type: codecType,
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ func (t TransportType) String() string {
|
||||
}
|
||||
}
|
||||
|
||||
// URL represents a STUN (rfc7064) or TRUN (rfc7065) URL
|
||||
// URL represents a STUN (rfc7064) or TURN (rfc7065) URL
|
||||
type URL struct {
|
||||
Type ServerType
|
||||
Secure bool
|
||||
@@ -83,7 +83,7 @@ type URL struct {
|
||||
TransportType TransportType
|
||||
}
|
||||
|
||||
// NewURL creates a new URL by parsing a STUN (rfc7064) or TRUN (rfc7065) uri string
|
||||
// NewURL creates a new URL by parsing a STUN (rfc7064) or TURN (rfc7065) uri string
|
||||
func NewURL(address string) (URL, error) {
|
||||
var result URL
|
||||
|
||||
|
26
signaling.go
26
signaling.go
@@ -131,8 +131,8 @@ func (t RTCSdpType) String() string {
|
||||
|
||||
// RTCSessionDescription is used to expose local and remote session descriptions.
|
||||
type RTCSessionDescription struct {
|
||||
Typ RTCSdpType
|
||||
Sdp string
|
||||
Type RTCSdpType
|
||||
Sdp string
|
||||
}
|
||||
|
||||
// SetRemoteDescription sets the SessionDescription of the remote peer
|
||||
@@ -179,8 +179,8 @@ func (r *RTCPeerConnection) CreateOffer(options *RTCOfferOptions) (RTCSessionDes
|
||||
continue
|
||||
}
|
||||
track := tranceiver.Sender.Track
|
||||
cname := "poins" // TODO: Support RTP streams synchronisation
|
||||
steamlabel := "poins" // TODO: Support steam labels
|
||||
cname := "pion" // TODO: Support RTP streams synchronisation
|
||||
steamlabel := "pion" // TODO: Support steam labels
|
||||
codec, err := rtcMediaEngine.getCodec(track.PayloadType)
|
||||
if err != nil {
|
||||
return RTCSessionDescription{}, err
|
||||
@@ -213,8 +213,8 @@ func (r *RTCPeerConnection) CreateOffer(options *RTCOfferOptions) (RTCSessionDes
|
||||
d.WithValueAttribute(sdp.AttrKeyMsidSemantic, " "+sdp.SemanticTokenWebRTCMediaStreams+streamlabels)
|
||||
|
||||
return RTCSessionDescription{
|
||||
Typ: RTCSdpTypeOffer,
|
||||
Sdp: d.Marshal(),
|
||||
Type: RTCSdpTypeOffer,
|
||||
Sdp: d.Marshal(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -255,19 +255,19 @@ func (r *RTCPeerConnection) CreateAnswer(options *RTCOfferOptions) (RTCSessionDe
|
||||
d.WithValueAttribute(sdp.AttrKeyMsidSemantic, " "+sdp.SemanticTokenWebRTCMediaStreams+audioStreamLabels+videoStreamLabels)
|
||||
|
||||
return RTCSessionDescription{
|
||||
Typ: RTCSdpTypeAnswer,
|
||||
Sdp: d.Marshal(),
|
||||
Type: RTCSdpTypeAnswer,
|
||||
Sdp: d.Marshal(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *RTCPeerConnection) addAnswerMedia(d *sdp.SessionDescription, typ RTCRtpCodecType) (string, error) {
|
||||
func (r *RTCPeerConnection) addAnswerMedia(d *sdp.SessionDescription, codecType RTCRtpCodecType) (string, error) {
|
||||
added := false
|
||||
|
||||
var streamlabels string
|
||||
for _, tranceiver := range r.rtpTransceivers {
|
||||
if tranceiver.Sender == nil ||
|
||||
tranceiver.Sender.Track == nil ||
|
||||
tranceiver.Sender.Track.Kind != typ {
|
||||
tranceiver.Sender.Track.Kind != codecType {
|
||||
continue
|
||||
}
|
||||
track := tranceiver.Sender.Track
|
||||
@@ -305,16 +305,16 @@ func (r *RTCPeerConnection) addAnswerMedia(d *sdp.SessionDescription, typ RTCRtp
|
||||
|
||||
if !added {
|
||||
// Add media line to advertise capabilities
|
||||
media := sdp.NewJSEPMediaDescription(typ.String(), []string{}).
|
||||
media := sdp.NewJSEPMediaDescription(codecType.String(), []string{}).
|
||||
WithValueAttribute(sdp.AttrKeyConnectionSetup, sdp.ConnectionRoleActive.String()). // TODO: Support other connection types
|
||||
WithValueAttribute(sdp.AttrKeyMID, typ.String()).
|
||||
WithValueAttribute(sdp.AttrKeyMID, codecType.String()).
|
||||
WithPropertyAttribute(RTCRtpTransceiverDirectionSendrecv.String()).
|
||||
WithICECredentials(r.iceAgent.Ufrag, r.iceAgent.Pwd). // TODO: get credendials form ICE agent
|
||||
WithPropertyAttribute(sdp.AttrKeyICELite). // TODO: get ICE type from ICE Agent (#23)
|
||||
WithPropertyAttribute(sdp.AttrKeyRtcpMux). // TODO: support RTCP fallback
|
||||
WithPropertyAttribute(sdp.AttrKeyRtcpRsize) // TODO: Support Reduced-Size RTCP?
|
||||
|
||||
for _, codec := range rtcMediaEngine.getCodecsByKind(typ) {
|
||||
for _, codec := range rtcMediaEngine.getCodecsByKind(codecType) {
|
||||
media.WithCodec(
|
||||
codec.PayloadType,
|
||||
codec.Name,
|
||||
|
Reference in New Issue
Block a user