github.com/pion/webrtc/v4@v4.0.1/sessiondescription.go (about) 1 // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> 2 // SPDX-License-Identifier: MIT 3 4 package webrtc 5 6 import ( 7 "github.com/pion/sdp/v3" 8 ) 9 10 // SessionDescription is used to expose local and remote session descriptions. 11 type SessionDescription struct { 12 Type SDPType `json:"type"` 13 SDP string `json:"sdp"` 14 15 // This will never be initialized by callers, internal use only 16 parsed *sdp.SessionDescription 17 } 18 19 // Unmarshal is a helper to deserialize the sdp 20 func (sd *SessionDescription) Unmarshal() (*sdp.SessionDescription, error) { 21 sd.parsed = &sdp.SessionDescription{} 22 err := sd.parsed.UnmarshalString(sd.SDP) 23 return sd.parsed, err 24 }