Beispiel #1
0
/*
CreateOffer prepares an SDP "offer" message, which should be set as the local
description, then sent to the remote peer over a signalling channel. This
should only be called by the peer initiating the connection.

This method is blocking, and should occur within a separate goroutine.
*/
func (pc *PeerConnection) CreateOffer() (*SessionDescription, error) {
	sdp := C.CGO_CreateOffer(pc.cgoPeer)
	if nil == sdp {
		return nil, errors.New("CreateOffer: could not prepare SDP offer.")
	}
	offer := NewSessionDescription("offer", sdp)
	if offer == nil {
		return nil, errors.New("CreateOffer: could not prepare SDP offer.")
	}
	return offer, nil
}
Beispiel #2
0
/*
CreateOffer prepares an SDP "offer" message, which should be set as the local
description, then sent to the remote peer over a signalling channel. This
should only be called by the peer initiating the connection.

This method is blocking, and should occur within a separate goroutine.
*/
func (pc *PeerConnection) CreateOffer() (*SessionDescription, error) {
	sdp := C.CGO_CreateOffer(pc.cgoPeer)
	if nil == sdp {
		return nil, errors.New("CreateOffer: could not prepare SDP offer.")
	}
	offer := new(SessionDescription)
	offer.cgoSdp = sdp
	offer.Type = "offer"
	offer.Sdp = C.GoString(C.CGO_SerializeSDP(sdp))
	return offer, nil
}