api: fix typos

This commit is contained in:
backkem
2018-07-16 18:47:55 +02:00
committed by Sean DuBois
parent 1bdd1af406
commit f7c5ecd57f
8 changed files with 30 additions and 30 deletions

View File

@@ -59,7 +59,7 @@ func main() {
// Set the remote SessionDescription // Set the remote SessionDescription
offer := webrtc.RTCSessionDescription{ offer := webrtc.RTCSessionDescription{
Typ: webrtc.RTCSdpTypeOffer, Type: webrtc.RTCSdpTypeOffer,
Sdp: string(sd), Sdp: string(sd),
} }
if err := peerConnection.SetRemoteDescription(offer); err != nil { if err := peerConnection.SetRemoteDescription(offer); err != nil {

View File

@@ -45,7 +45,7 @@ func main() {
} }
// Create a audio track // Create a audio track
opusTrack, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeOpus, "audio", "pions1") opusTrack, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeOpus, "audio", "pion1")
if err != nil { if err != nil {
panic(err) panic(err)
} }
@@ -55,7 +55,7 @@ func main() {
} }
// Create a video track // Create a video track
vp8Track, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeVP8, "video", "pions2") vp8Track, err := peerConnection.NewRTCTrack(webrtc.PayloadTypeVP8, "video", "pion2")
if err != nil { if err != nil {
panic(err) panic(err)
} }
@@ -66,7 +66,7 @@ func main() {
// Set the remote SessionDescription // Set the remote SessionDescription
offer := webrtc.RTCSessionDescription{ offer := webrtc.RTCSessionDescription{
Typ: webrtc.RTCSdpTypeOffer, Type: webrtc.RTCSdpTypeOffer,
Sdp: string(sd), Sdp: string(sd),
} }
if err := peerConnection.SetRemoteDescription(offer); err != nil { if err := peerConnection.SetRemoteDescription(offer); err != nil {

View File

@@ -61,7 +61,7 @@ func main() {
// Set the remote SessionDescription // Set the remote SessionDescription
offer := webrtc.RTCSessionDescription{ offer := webrtc.RTCSessionDescription{
Typ: webrtc.RTCSdpTypeOffer, Type: webrtc.RTCSdpTypeOffer,
Sdp: string(sd), Sdp: string(sd),
} }
if err := peerConnection.SetRemoteDescription(offer); err != nil { if err := peerConnection.SetRemoteDescription(offer); err != nil {

View File

@@ -52,7 +52,7 @@ func main() {
// Set the remote SessionDescription // Set the remote SessionDescription
offer := webrtc.RTCSessionDescription{ offer := webrtc.RTCSessionDescription{
Typ: webrtc.RTCSdpTypeOffer, Type: webrtc.RTCSdpTypeOffer,
Sdp: string(sd), Sdp: string(sd),
} }
if err := peerConnection.SetRemoteDescription(offer); err != nil { if err := peerConnection.SetRemoteDescription(offer); err != nil {

View File

@@ -75,10 +75,10 @@ func (d *SessionDescription) WithMedia(md *MediaDescription) *SessionDescription
// NewJSEPMediaDescription creates a new MediaDescription with // NewJSEPMediaDescription creates a new MediaDescription with
// some settings that are required by the JSEP spec. // 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 // TODO: handle codecPrefs
d := &MediaDescription{ 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", ConnectionData: "IN IP4 0.0.0.0",
Attributes: []string{}, Attributes: []string{},
} }

View File

@@ -164,7 +164,7 @@ type RTCRtpCodec struct {
// NewRTCRtpCodec is used to define a new codec // NewRTCRtpCodec is used to define a new codec
func NewRTCRtpCodec( func NewRTCRtpCodec(
typ RTCRtpCodecType, codecType RTCRtpCodecType,
name string, name string,
clockrate uint32, clockrate uint32,
channels uint16, channels uint16,
@@ -174,14 +174,14 @@ func NewRTCRtpCodec(
) *RTCRtpCodec { ) *RTCRtpCodec {
return &RTCRtpCodec{ return &RTCRtpCodec{
RTCRtpCodecCapability: RTCRtpCodecCapability{ RTCRtpCodecCapability: RTCRtpCodecCapability{
MimeType: typ.String() + "/" + name, MimeType: codecType.String() + "/" + name,
ClockRate: clockrate, ClockRate: clockrate,
Channels: channels, Channels: channels,
SdpFmtpLine: fmtp, SdpFmtpLine: fmtp,
}, },
PayloadType: payloadType, PayloadType: payloadType,
Payloader: payloader, Payloader: payloader,
Type: typ, Type: codecType,
Name: name, Name: name,
} }
} }

View File

@@ -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 URL struct {
Type ServerType Type ServerType
Secure bool Secure bool
@@ -83,7 +83,7 @@ type URL struct {
TransportType TransportType 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) { func NewURL(address string) (URL, error) {
var result URL var result URL

View File

@@ -131,7 +131,7 @@ func (t RTCSdpType) String() string {
// RTCSessionDescription is used to expose local and remote session descriptions. // RTCSessionDescription is used to expose local and remote session descriptions.
type RTCSessionDescription struct { type RTCSessionDescription struct {
Typ RTCSdpType Type RTCSdpType
Sdp string Sdp string
} }
@@ -179,8 +179,8 @@ func (r *RTCPeerConnection) CreateOffer(options *RTCOfferOptions) (RTCSessionDes
continue continue
} }
track := tranceiver.Sender.Track track := tranceiver.Sender.Track
cname := "poins" // TODO: Support RTP streams synchronisation cname := "pion" // TODO: Support RTP streams synchronisation
steamlabel := "poins" // TODO: Support steam labels steamlabel := "pion" // TODO: Support steam labels
codec, err := rtcMediaEngine.getCodec(track.PayloadType) codec, err := rtcMediaEngine.getCodec(track.PayloadType)
if err != nil { if err != nil {
return RTCSessionDescription{}, err return RTCSessionDescription{}, err
@@ -213,7 +213,7 @@ func (r *RTCPeerConnection) CreateOffer(options *RTCOfferOptions) (RTCSessionDes
d.WithValueAttribute(sdp.AttrKeyMsidSemantic, " "+sdp.SemanticTokenWebRTCMediaStreams+streamlabels) d.WithValueAttribute(sdp.AttrKeyMsidSemantic, " "+sdp.SemanticTokenWebRTCMediaStreams+streamlabels)
return RTCSessionDescription{ return RTCSessionDescription{
Typ: RTCSdpTypeOffer, Type: RTCSdpTypeOffer,
Sdp: d.Marshal(), Sdp: d.Marshal(),
}, nil }, nil
} }
@@ -255,19 +255,19 @@ func (r *RTCPeerConnection) CreateAnswer(options *RTCOfferOptions) (RTCSessionDe
d.WithValueAttribute(sdp.AttrKeyMsidSemantic, " "+sdp.SemanticTokenWebRTCMediaStreams+audioStreamLabels+videoStreamLabels) d.WithValueAttribute(sdp.AttrKeyMsidSemantic, " "+sdp.SemanticTokenWebRTCMediaStreams+audioStreamLabels+videoStreamLabels)
return RTCSessionDescription{ return RTCSessionDescription{
Typ: RTCSdpTypeAnswer, Type: RTCSdpTypeAnswer,
Sdp: d.Marshal(), Sdp: d.Marshal(),
}, nil }, 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 added := false
var streamlabels string var streamlabels string
for _, tranceiver := range r.rtpTransceivers { for _, tranceiver := range r.rtpTransceivers {
if tranceiver.Sender == nil || if tranceiver.Sender == nil ||
tranceiver.Sender.Track == nil || tranceiver.Sender.Track == nil ||
tranceiver.Sender.Track.Kind != typ { tranceiver.Sender.Track.Kind != codecType {
continue continue
} }
track := tranceiver.Sender.Track track := tranceiver.Sender.Track
@@ -305,16 +305,16 @@ func (r *RTCPeerConnection) addAnswerMedia(d *sdp.SessionDescription, typ RTCRtp
if !added { if !added {
// Add media line to advertise capabilities // 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.AttrKeyConnectionSetup, sdp.ConnectionRoleActive.String()). // TODO: Support other connection types
WithValueAttribute(sdp.AttrKeyMID, typ.String()). WithValueAttribute(sdp.AttrKeyMID, codecType.String()).
WithPropertyAttribute(RTCRtpTransceiverDirectionSendrecv.String()). WithPropertyAttribute(RTCRtpTransceiverDirectionSendrecv.String()).
WithICECredentials(r.iceAgent.Ufrag, r.iceAgent.Pwd). // TODO: get credendials form ICE agent 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.AttrKeyICELite). // TODO: get ICE type from ICE Agent (#23)
WithPropertyAttribute(sdp.AttrKeyRtcpMux). // TODO: support RTCP fallback WithPropertyAttribute(sdp.AttrKeyRtcpMux). // TODO: support RTCP fallback
WithPropertyAttribute(sdp.AttrKeyRtcpRsize) // TODO: Support Reduced-Size RTCP? WithPropertyAttribute(sdp.AttrKeyRtcpRsize) // TODO: Support Reduced-Size RTCP?
for _, codec := range rtcMediaEngine.getCodecsByKind(typ) { for _, codec := range rtcMediaEngine.getCodecsByKind(codecType) {
media.WithCodec( media.WithCodec(
codec.PayloadType, codec.PayloadType,
codec.Name, codec.Name,