mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-04 09:19:29 +02:00
major refactor.
This commit is contained in:
parent
5c92b75cf7
commit
5d906e0a8b
53 changed files with 1189 additions and 1133 deletions
|
@ -4,26 +4,25 @@ import (
|
|||
"github.com/pion/webrtc/v2"
|
||||
)
|
||||
|
||||
type Peer struct {
|
||||
id string
|
||||
type PeerCtx struct {
|
||||
api *webrtc.API
|
||||
engine *webrtc.MediaEngine
|
||||
manager *WebRTCManager
|
||||
settings *webrtc.SettingEngine
|
||||
connection *webrtc.PeerConnection
|
||||
configuration *webrtc.Configuration
|
||||
}
|
||||
|
||||
func (peer *Peer) SignalAnswer(sdp string) error {
|
||||
return peer.connection.SetRemoteDescription(webrtc.SessionDescription{SDP: sdp, Type: webrtc.SDPTypeAnswer})
|
||||
func (peer *PeerCtx) SignalAnswer(sdp string) error {
|
||||
return peer.connection.SetRemoteDescription(webrtc.SessionDescription{
|
||||
SDP: sdp,
|
||||
Type: webrtc.SDPTypeAnswer,
|
||||
})
|
||||
}
|
||||
|
||||
func (peer *Peer) Destroy() error {
|
||||
if peer.connection != nil && peer.connection.ConnectionState() == webrtc.PeerConnectionStateConnected {
|
||||
if err := peer.connection.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
func (peer *PeerCtx) Destroy() error {
|
||||
if peer.connection == nil || peer.connection.ConnectionState() != webrtc.PeerConnectionStateConnected {
|
||||
return nil
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
return peer.connection.Close()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue