Skip to content

Commit 4cf3ce1

Browse files
authored
allow muting via setting the direction a channel (#1179)
* allow muting via setting the direction a channel supported for audio only, currently * update JMT version
1 parent a31bd71 commit 4cf3ce1

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<dependency>
114114
<groupId>${project.groupId}</groupId>
115115
<artifactId>jitsi-media-transform</artifactId>
116-
<version>1.0-139-g33e0a49</version>
116+
<version>1.0-142-g94e1c26</version>
117117
</dependency>
118118
<dependency>
119119
<groupId>${project.groupId}</groupId>

src/main/java/org/jitsi/videobridge/Endpoint.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,27 @@ public void updateAcceptedMediaTypes()
14631463
this.acceptVideo = acceptVideo;
14641464
}
14651465

1466+
public void updateForceMute()
1467+
{
1468+
boolean audioForcedMuted = false;
1469+
for (ChannelShim channelShim : channelShims)
1470+
{
1471+
if (!channelShim.allowIncomingMedia())
1472+
{
1473+
switch (channelShim.getMediaType())
1474+
{
1475+
case AUDIO:
1476+
audioForcedMuted = true;
1477+
break;
1478+
case VIDEO:
1479+
logger.warn(() -> "Tried to mute the incoming video stream, but that is not currently supported");
1480+
break;
1481+
}
1482+
}
1483+
}
1484+
transceiver.forceMuteAudio(audioForcedMuted);
1485+
}
1486+
14661487
/**
14671488
* @return this {@link Endpoint}'s transceiver.
14681489
*/

src/main/java/org/jitsi/videobridge/shim/ChannelShim.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,19 @@ public boolean allowsSendingMedia()
382382
"sendonly".equalsIgnoreCase(direction);
383383
}
384384

385+
/**
386+
* Checks if incoming media (from the endpoint to the bridge) is being
387+
* forcibly "muted"
388+
* @return true if media for this channel is allowed, false if it should
389+
* be forcibly "muted" (dropped)
390+
*/
391+
public boolean allowIncomingMedia()
392+
{
393+
return "sendrecv".equalsIgnoreCase(direction) ||
394+
"recvonly".equalsIgnoreCase(direction);
395+
396+
}
397+
385398
/**
386399
* Sets the media direction of this channel.
387400
* @param direction the direction to set.
@@ -392,6 +405,7 @@ public void setDirection(String direction)
392405
{
393406
this.direction = direction;
394407
this.endpoint.updateAcceptedMediaTypes();
408+
this.endpoint.updateForceMute();
395409
}
396410
}
397411

0 commit comments

Comments
 (0)