mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-26 17:31:12 +02:00
Merge pull request #669 from strukturag/janus-multistream
Improve support for Janus 1.x
This commit is contained in:
commit
0aed690463
15
mcu_janus.go
15
mcu_janus.go
|
@ -143,6 +143,7 @@ type mcuJanus struct {
|
||||||
gw *JanusGateway
|
gw *JanusGateway
|
||||||
session *JanusSession
|
session *JanusSession
|
||||||
handle *JanusHandle
|
handle *JanusHandle
|
||||||
|
version int
|
||||||
|
|
||||||
closeChan chan struct{}
|
closeChan chan struct{}
|
||||||
|
|
||||||
|
@ -283,6 +284,10 @@ func (m *mcuJanus) ConnectionInterrupted() {
|
||||||
m.notifyOnDisconnected()
|
m.notifyOnDisconnected()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mcuJanus) isMultistream() bool {
|
||||||
|
return m.version >= 1000
|
||||||
|
}
|
||||||
|
|
||||||
func (m *mcuJanus) Start() error {
|
func (m *mcuJanus) Start() error {
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
info, err := m.gw.Info(ctx)
|
info, err := m.gw.Info(ctx)
|
||||||
|
@ -296,6 +301,8 @@ func (m *mcuJanus) Start() error {
|
||||||
return fmt.Errorf("Plugin %s is not supported", pluginVideoRoom)
|
return fmt.Errorf("Plugin %s is not supported", pluginVideoRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.version = info.Version
|
||||||
|
|
||||||
log.Printf("Found %s %s by %s", plugin.Name, plugin.VersionString, plugin.Author)
|
log.Printf("Found %s %s by %s", plugin.Name, plugin.VersionString, plugin.Author)
|
||||||
if !info.DataChannels {
|
if !info.DataChannels {
|
||||||
return fmt.Errorf("Data channels are not supported")
|
return fmt.Errorf("Data channels are not supported")
|
||||||
|
@ -1175,7 +1182,15 @@ retry:
|
||||||
"request": "join",
|
"request": "join",
|
||||||
"ptype": "subscriber",
|
"ptype": "subscriber",
|
||||||
"room": p.roomId,
|
"room": p.roomId,
|
||||||
|
}
|
||||||
|
if p.mcu.isMultistream() {
|
||||||
|
join_msg["streams"] = []map[string]interface{}{
|
||||||
|
{
|
||||||
"feed": streamTypeUserIds[p.streamType],
|
"feed": streamTypeUserIds[p.streamType],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
join_msg["feed"] = streamTypeUserIds[p.streamType]
|
||||||
}
|
}
|
||||||
if stream != nil {
|
if stream != nil {
|
||||||
stream.AddToMessage(join_msg)
|
stream.AddToMessage(join_msg)
|
||||||
|
|
Loading…
Reference in a new issue