mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-02 00:10:07 +02:00
WebRTC: add rtp consumer.
This commit is contained in:
parent
9dc96036ce
commit
b78132e6aa
1 changed files with 20 additions and 2 deletions
|
@ -215,12 +215,12 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
|||
return nil
|
||||
}
|
||||
|
||||
_, err = connection.AddTrack(manager.audioTrack)
|
||||
rtpAudio, err := connection.AddTrack(manager.audioTrack)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = connection.AddTrack(videoTrack)
|
||||
rtpVideo, err := connection.AddTrack(videoTrack)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -356,6 +356,24 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
|||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
rtcpBuf := make([]byte, 1500)
|
||||
for {
|
||||
if _, _, err := rtpAudio.Read(rtcpBuf); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
rtcpBuf := make([]byte, 1500)
|
||||
for {
|
||||
if _, _, err := rtpVideo.Read(rtcpBuf); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
session.SetWebRTCPeer(peer)
|
||||
return connection.LocalDescription(), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue