fix dh-ipc sdp error

pull/132/head
macbookpro 6 years ago
parent c1bc466bba
commit f5d20ed57e

@ -247,11 +247,8 @@ func (d *Decoder) origin(v string) (*Origin, error) {
return nil, errFormat
}
o := new(Origin)
o.Username, o.Network, o.Type, o.Address = p[0], p[3], p[4], p[5]
o.Username, o.SessionID, o.Network, o.Type, o.Address = p[0], p[1], p[3], p[4], p[5]
var err error
if o.SessionID, err = d.int(p[1]); err != nil {
return nil, err
}
if o.SessionVersion, err = d.int(p[2]); err != nil {
return nil, err
}

@ -203,7 +203,7 @@ func (e *Encoder) key(k *Key) *Encoder {
}
func (e *Encoder) origin(o *Origin) *Encoder {
return e.str(strd(o.Username, "-")).sp().int(o.SessionID).sp().int(o.SessionVersion).sp().transport(o.Network, o.Type, o.Address)
return e.str(strd(o.Username, "-")).sp().str(o.SessionID).sp().int(o.SessionVersion).sp().transport(o.Network, o.Type, o.Address)
}
func (e *Encoder) connection(c *Connection) *Encoder {

@ -40,8 +40,18 @@ func (s *Session) Bytes() []byte {
// Origin represents an originator of the session.
type Origin struct {
Username string
SessionID int64
Username string
/**
<sess-id> is a numeric string such that the tuple of <username>,
<sess-id>, <nettype>, <addrtype>, and <unicast-address> forms a
globally unique identifier for the session. The method of
<sess-id> allocation is up to the creating tool, but it has been
suggested that a Network Time Protocol (NTP) format timestamp be
used to ensure uniqueness [13].
some IPC do is a string. ie. o=RTSP Session 0 0 IN IP4 0.0.0.0
*/
SessionID string
SessionVersion int64
Network string
Type string
@ -137,7 +147,7 @@ func NegotiateMode(local, remote string) string {
}
// DeleteAttr removes all elements with name from attrs.
func DeleteAttr(attrs Attributes, name ... string) Attributes {
func DeleteAttr(attrs Attributes, name ...string) Attributes {
n := 0
loop:
for _, it := range attrs {

Loading…
Cancel
Save