mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 00:42:25 +02:00
Merge pull request #191 from danxuliu/add-support-for-request-offers-to-update-subscriber-connections
Add support for request offers to update subscriber connections
This commit is contained in:
commit
135df8c50d
28
mcu_janus.go
28
mcu_janus.go
|
@ -1245,6 +1245,26 @@ retry:
|
||||||
callback(nil, join_response.Jsep)
|
callback(nil, join_response.Jsep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *mcuJanusSubscriber) update(ctx context.Context, callback func(error, map[string]interface{})) {
|
||||||
|
handle := p.handle
|
||||||
|
if handle == nil {
|
||||||
|
callback(ErrNotConnected, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_msg := map[string]interface{}{
|
||||||
|
"request": "configure",
|
||||||
|
"update": true,
|
||||||
|
}
|
||||||
|
configure_response, err := handle.Message(ctx, configure_msg, nil)
|
||||||
|
if err != nil {
|
||||||
|
callback(err, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(nil, configure_response.Jsep)
|
||||||
|
}
|
||||||
|
|
||||||
func (p *mcuJanusSubscriber) SendMessage(ctx context.Context, message *MessageClientMessage, data *MessageClientMessageData, callback func(error, map[string]interface{})) {
|
func (p *mcuJanusSubscriber) SendMessage(ctx context.Context, message *MessageClientMessage, data *MessageClientMessageData, callback func(error, map[string]interface{})) {
|
||||||
statsMcuMessagesTotal.WithLabelValues(data.Type).Inc()
|
statsMcuMessagesTotal.WithLabelValues(data.Type).Inc()
|
||||||
jsep_msg := data.Payload
|
jsep_msg := data.Payload
|
||||||
|
@ -1256,9 +1276,11 @@ func (p *mcuJanusSubscriber) SendMessage(ctx context.Context, message *MessageCl
|
||||||
msgctx, cancel := context.WithTimeout(context.Background(), p.mcu.mcuTimeout)
|
msgctx, cancel := context.WithTimeout(context.Background(), p.mcu.mcuTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// TODO Only join the room if there is no sid or it does not match
|
if data.Sid == "" || data.Sid != p.Sid() {
|
||||||
// the subscriber sid; otherwise configure/update the subscriber.
|
p.joinRoom(msgctx, callback)
|
||||||
p.joinRoom(msgctx, callback)
|
} else {
|
||||||
|
p.update(msgctx, callback)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "answer":
|
case "answer":
|
||||||
p.deferred <- func() {
|
p.deferred <- func() {
|
||||||
|
|
Loading…
Reference in a new issue