Merge pull request #221 from danxuliu/fix-media-type-not-updated-after-publisher-renegotiations

Fix mediaType not updated after publisher renegotiations
This commit is contained in:
Joachim Bauch 2022-04-07 08:24:57 +02:00 committed by GitHub
commit 156a8a2086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View file

@ -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

View file

@ -90,6 +90,7 @@ type McuPublisher interface {
McuClient
HasMedia(MediaType) bool
SetMedia(MediaType)
}
type McuSubscriber interface {

View file

@ -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)

View file

@ -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)

View file

@ -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() {