mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 08:52:27 +02:00
Fix mediaType not updated after publisher renegotiations
The "mediaTypes" attribute is checked to know if a publisher needs to be closed when the permissions are updated. However, that attribute was set only when the publisher was initially created; due to this if a publisher then used a renegotiation to add media not included in the original offer the publisher would not be closed if the publishing permission for that media was later revoked. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
b98a00ec10
commit
b9d671ab2f
|
@ -895,6 +895,8 @@ func (s *ClientSession) GetOrCreatePublisher(ctx context.Context, mcu Mcu, strea
|
|||
s.publishers[streamType] = publisher
|
||||
}
|
||||
log.Printf("Publishing %s as %s for session %s", streamType, publisher.Id(), s.PublicId())
|
||||
} else {
|
||||
publisher.SetMedia(mediaTypes)
|
||||
}
|
||||
|
||||
return publisher, nil
|
||||
|
|
|
@ -90,6 +90,7 @@ type McuPublisher interface {
|
|||
McuClient
|
||||
|
||||
HasMedia(MediaType) bool
|
||||
SetMedia(MediaType)
|
||||
}
|
||||
|
||||
type McuSubscriber interface {
|
||||
|
|
|
@ -883,6 +883,10 @@ func (p *mcuJanusPublisher) HasMedia(mt MediaType) bool {
|
|||
return (p.mediaTypes & mt) == mt
|
||||
}
|
||||
|
||||
func (p *mcuJanusPublisher) SetMedia(mt MediaType) {
|
||||
p.mediaTypes = mt
|
||||
}
|
||||
|
||||
func (p *mcuJanusPublisher) NotifyReconnected() {
|
||||
ctx := context.TODO()
|
||||
handle, session, roomId, err := p.mcu.getOrCreatePublisherHandle(ctx, p.id, p.streamType, p.bitrate)
|
||||
|
|
|
@ -144,6 +144,11 @@ func (p *mcuProxyPublisher) HasMedia(mt MediaType) bool {
|
|||
return (p.mediaTypes & mt) == mt
|
||||
}
|
||||
|
||||
func (p *mcuProxyPublisher) SetMedia(mt MediaType) {
|
||||
// TODO: Also update mediaTypes on proxy.
|
||||
p.mediaTypes = mt
|
||||
}
|
||||
|
||||
func (p *mcuProxyPublisher) NotifyClosed() {
|
||||
p.listener.PublisherClosed(p)
|
||||
p.conn.removePublisher(p)
|
||||
|
|
|
@ -153,6 +153,10 @@ func (p *TestMCUPublisher) HasMedia(mt MediaType) bool {
|
|||
return (p.mediaTypes & mt) == mt
|
||||
}
|
||||
|
||||
func (p *TestMCUPublisher) SetMedia(mt MediaType) {
|
||||
p.mediaTypes = mt
|
||||
}
|
||||
|
||||
func (p *TestMCUPublisher) SendMessage(ctx context.Context, message *MessageClientMessage, data *MessageClientMessageData, callback func(error, map[string]interface{})) {
|
||||
go func() {
|
||||
if p.isClosed() {
|
||||
|
|
Loading…
Reference in a new issue