Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
dad113c1
Commit
dad113c1
authored
Jan 11, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate transceivers from incoming SDP.
parent
1ca4c766
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
19 deletions
+20
-19
go.mod
go.mod
+1
-0
rtpconn/rtpconn.go
rtpconn/rtpconn.go
+16
-16
rtpconn/webclient.go
rtpconn/webclient.go
+3
-3
No files found.
go.mod
View file @
dad113c1
...
@@ -8,6 +8,7 @@ require (
...
@@ -8,6 +8,7 @@ require (
github.com/pion/ice/v2 v2.0.14
github.com/pion/ice/v2 v2.0.14
github.com/pion/rtcp v1.2.6
github.com/pion/rtcp v1.2.6
github.com/pion/rtp v1.6.2
github.com/pion/rtp v1.6.2
github.com/pion/sdp/v3 v3.0.3
github.com/pion/webrtc/v3 v3.0.2-0.20201230060242-921608c26b93
github.com/pion/webrtc/v3 v3.0.2-0.20201230060242-921608c26b93
golang.org/x/crypto v0.0.0-20201217014255-9d1352758620
golang.org/x/crypto v0.0.0-20201217014255-9d1352758620
)
)
rtpconn/rtpconn.go
View file @
dad113c1
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/pion/rtcp"
"github.com/pion/rtcp"
"github.com/pion/rtp"
"github.com/pion/rtp"
"github.com/pion/sdp/v3"
"github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v3"
"github.com/jech/galene/conn"
"github.com/jech/galene/conn"
...
@@ -458,23 +459,21 @@ func pushConn(up *rtpUpConnection, g *group.Group, cs []group.Client) {
...
@@ -458,23 +459,21 @@ func pushConn(up *rtpUpConnection, g *group.Group, cs []group.Client) {
}(
g
,
cs
)
}(
g
,
cs
)
}
}
func
newUpConn
(
c
group
.
Client
,
id
string
,
labels
map
[
string
]
string
)
(
*
rtpUpConnection
,
error
)
{
func
newUpConn
(
c
group
.
Client
,
id
string
,
labels
map
[
string
]
string
,
offer
string
)
(
*
rtpUpConnection
,
error
)
{
pc
,
err
:=
c
.
Group
()
.
API
()
.
NewPeerConnection
(
*
ice
.
ICEConfiguration
())
var
o
sdp
.
SessionDescription
err
:=
o
.
Unmarshal
([]
byte
(
offer
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
_
,
err
=
pc
.
AddTransceiverFromKind
(
webrtc
.
RTPCodecTypeAudio
,
pc
,
err
:=
c
.
Group
()
.
API
()
.
NewPeerConnection
(
*
ice
.
ICEConfiguration
())
webrtc
.
RtpTransceiverInit
{
Direction
:
webrtc
.
RTPTransceiverDirectionRecvonly
,
},
)
if
err
!=
nil
{
if
err
!=
nil
{
pc
.
Close
()
return
nil
,
err
return
nil
,
err
}
}
_
,
err
=
pc
.
AddTransceiverFromKind
(
webrtc
.
RTPCodecTypeVideo
,
for
_
,
m
:=
range
o
.
MediaDescriptions
{
_
,
err
=
pc
.
AddTransceiverFromKind
(
webrtc
.
NewRTPCodecType
(
m
.
MediaName
.
Media
),
webrtc
.
RtpTransceiverInit
{
webrtc
.
RtpTransceiverInit
{
Direction
:
webrtc
.
RTPTransceiverDirectionRecvonly
,
Direction
:
webrtc
.
RTPTransceiverDirectionRecvonly
,
},
},
...
@@ -483,6 +482,7 @@ func newUpConn(c group.Client, id string, labels map[string]string) (*rtpUpConne
...
@@ -483,6 +482,7 @@ func newUpConn(c group.Client, id string, labels map[string]string) (*rtpUpConne
pc
.
Close
()
pc
.
Close
()
return
nil
,
err
return
nil
,
err
}
}
}
up
:=
&
rtpUpConnection
{
id
:
id
,
pc
:
pc
,
labels
:
labels
}
up
:=
&
rtpUpConnection
{
id
:
id
,
pc
:
pc
,
labels
:
labels
}
...
...
rtpconn/webclient.go
View file @
dad113c1
...
@@ -206,7 +206,7 @@ func getUpConns(c *webClient) []*rtpUpConnection {
...
@@ -206,7 +206,7 @@ func getUpConns(c *webClient) []*rtpUpConnection {
return
up
return
up
}
}
func
addUpConn
(
c
*
webClient
,
id
string
,
labels
map
[
string
]
string
)
(
*
rtpUpConnection
,
bool
,
error
)
{
func
addUpConn
(
c
*
webClient
,
id
string
,
labels
map
[
string
]
string
,
offer
string
)
(
*
rtpUpConnection
,
bool
,
error
)
{
c
.
mu
.
Lock
()
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
defer
c
.
mu
.
Unlock
()
...
@@ -222,7 +222,7 @@ func addUpConn(c *webClient, id string, labels map[string]string) (*rtpUpConnect
...
@@ -222,7 +222,7 @@ func addUpConn(c *webClient, id string, labels map[string]string) (*rtpUpConnect
return
old
,
false
,
nil
return
old
,
false
,
nil
}
}
conn
,
err
:=
newUpConn
(
c
,
id
,
labels
)
conn
,
err
:=
newUpConn
(
c
,
id
,
labels
,
offer
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
...
@@ -488,7 +488,7 @@ func gotOffer(c *webClient, id string, sdp string, renegotiate bool, labels map[
...
@@ -488,7 +488,7 @@ func gotOffer(c *webClient, id string, sdp string, renegotiate bool, labels map[
delUpConn
(
c
,
id
)
delUpConn
(
c
,
id
)
}
}
up
,
isnew
,
err
:=
addUpConn
(
c
,
id
,
labels
)
up
,
isnew
,
err
:=
addUpConn
(
c
,
id
,
labels
,
sdp
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment