sessiondescription.go 555 B

123456789101112131415161718192021
  1. package webrtc
  2. import (
  3. "github.com/pion/sdp/v3"
  4. )
  5. // SessionDescription is used to expose local and remote session descriptions.
  6. type SessionDescription struct {
  7. Type SDPType `json:"type"`
  8. SDP string `json:"sdp"`
  9. // This will never be initialized by callers, internal use only
  10. parsed *sdp.SessionDescription
  11. }
  12. // Unmarshal is a helper to deserialize the sdp
  13. func (sd *SessionDescription) Unmarshal() (*sdp.SessionDescription, error) {
  14. sd.parsed = &sdp.SessionDescription{}
  15. err := sd.parsed.Unmarshal([]byte(sd.SDP))
  16. return sd.parsed, err
  17. }