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
efb298f0
Commit
efb298f0
authored
Aug 01, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sendonly transceiver for down tracks, embed receiver in track.
parent
63cfce9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
rtpconn/rtpconn.go
rtpconn/rtpconn.go
+14
-12
rtpconn/webclient.go
rtpconn/webclient.go
+8
-4
No files found.
rtpconn/rtpconn.go
View file @
efb298f0
...
...
@@ -353,12 +353,13 @@ func (down *rtpDownConnection) flushICECandidates() error {
}
type
rtpUpTrack
struct
{
track
*
webrtc
.
TrackRemote
conn
*
rtpUpConnection
rate
*
estimator
.
Estimator
cache
*
packetcache
.
Cache
jitter
*
jitter
.
Estimator
cname
atomic
.
Value
track
*
webrtc
.
TrackRemote
receiver
*
webrtc
.
RTPReceiver
conn
*
rtpUpConnection
rate
*
estimator
.
Estimator
cache
*
packetcache
.
Cache
jitter
*
jitter
.
Estimator
cname
atomic
.
Value
actionCh
chan
struct
{}
readerDone
chan
struct
{}
...
...
@@ -630,6 +631,7 @@ func newUpConn(c group.Client, id string, label string, offer string) (*rtpUpCon
track
:=
&
rtpUpTrack
{
track
:
remote
,
receiver
:
receiver
,
conn
:
up
,
cache
:
packetcache
.
New
(
minPacketCache
(
remote
)),
rate
:
estimator
.
New
(
time
.
Second
),
...
...
@@ -642,7 +644,7 @@ func newUpConn(c group.Client, id string, label string, offer string) (*rtpUpCon
go
readLoop
(
track
)
go
rtcpUpListener
(
up
,
track
,
receiver
)
go
rtcpUpListener
(
track
)
up
.
mu
.
Unlock
()
...
...
@@ -769,12 +771,12 @@ func (track *rtpUpTrack) GetPacket(seqno uint16, result []byte, nack bool) uint1
return
0
}
func
rtcpUpListener
(
conn
*
rtpUpConnection
,
track
*
rtpUpTrack
,
r
*
webrtc
.
RTPReceiver
)
{
func
rtcpUpListener
(
track
*
rtpUpTrack
)
{
buf
:=
make
([]
byte
,
1500
)
for
{
firstSR
:=
false
n
,
_
,
err
:=
r
.
ReadSimulcast
(
buf
,
track
.
track
.
RID
())
n
,
_
,
err
:=
track
.
receive
r
.
ReadSimulcast
(
buf
,
track
.
track
.
RID
())
if
err
!=
nil
{
if
err
!=
io
.
EOF
&&
err
!=
io
.
ErrClosedPipe
{
log
.
Printf
(
"Read RTCP: %v"
,
err
)
...
...
@@ -825,7 +827,7 @@ func rtcpUpListener(conn *rtpUpConnection, track *rtpUpTrack, r *webrtc.RTPRecei
if
firstSR
{
// this is the first SR we got for at least one track,
// quickly propagate the time offsets downstream
local
:=
conn
.
getLocal
()
local
:=
track
.
conn
.
getLocal
()
for
_
,
l
:=
range
local
{
l
,
ok
:=
l
.
(
*
rtpDownConnection
)
if
ok
{
...
...
@@ -1093,13 +1095,13 @@ func (track *rtpDownTrack) updateRate(loss uint8, now uint64) {
track
.
maxBitrate
.
Set
(
rate
,
now
)
}
func
rtcpDownListener
(
track
*
rtpDownTrack
,
s
*
webrtc
.
RTPSender
)
{
func
rtcpDownListener
(
track
*
rtpDownTrack
)
{
lastFirSeqno
:=
uint8
(
0
)
buf
:=
make
([]
byte
,
1500
)
for
{
n
,
_
,
err
:=
s
.
Read
(
buf
)
n
,
_
,
err
:=
track
.
sender
.
Read
(
buf
)
if
err
!=
nil
{
if
err
!=
io
.
EOF
&&
err
!=
io
.
ErrClosedPipe
{
log
.
Printf
(
"Read RTCP: %v"
,
err
)
...
...
rtpconn/webclient.go
View file @
efb298f0
...
...
@@ -380,19 +380,23 @@ func addDownTrackUnlocked(conn *rtpDownConnection, remoteTrack *rtpUpTrack, remo
return
err
}
sender
,
err
:=
conn
.
pc
.
AddTrack
(
local
)
transceiver
,
err
:=
conn
.
pc
.
AddTransceiverFromTrack
(
local
,
webrtc
.
RTPTransceiverInit
{
Direction
:
webrtc
.
RTPTransceiverDirectionSendonly
,
},
)
if
err
!=
nil
{
return
err
}
parms
:=
sender
.
GetParameters
()
parms
:=
transceiver
.
Sender
()
.
GetParameters
()
if
len
(
parms
.
Encodings
)
!=
1
{
return
errors
.
New
(
"got multiple encodings"
)
}
track
:=
&
rtpDownTrack
{
track
:
local
,
sender
:
sender
,
sender
:
transceiver
.
Sender
()
,
ssrc
:
parms
.
Encodings
[
0
]
.
SSRC
,
conn
:
conn
,
remote
:
remoteTrack
,
...
...
@@ -405,7 +409,7 @@ func addDownTrackUnlocked(conn *rtpDownConnection, remoteTrack *rtpUpTrack, remo
conn
.
tracks
=
append
(
conn
.
tracks
,
track
)
go
rtcpDownListener
(
track
,
sender
)
go
rtcpDownListener
(
track
)
return
nil
}
...
...
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