Skip to content

Commit

Permalink
Don't accept broadcast without origin as local
Browse files Browse the repository at this point in the history
It delays the shutdown process and reconnect failures
  • Loading branch information
mekya committed Nov 24, 2024
1 parent 7b58d85 commit 39e5e3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/antmedia/datastore/db/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ public long getActiveBroadcastCount(Map<String, String> broadcastMap, Gson gson,
Broadcast broadcast = gson.fromJson(broadcastString, Broadcast.class);
String status = broadcast.getStatus();
if (IAntMediaStreamHandler.BROADCAST_STATUS_BROADCASTING.equals(status) &&
(StringUtils.isAnyBlank(hostAddress, broadcast.getOriginAdress()) || hostAddress.equals(broadcast.getOriginAdress())))
(StringUtils.isBlank(hostAddress) || hostAddress.equals(broadcast.getOriginAdress())))
{
activeBroadcastCount++;
}
Expand All @@ -688,7 +688,7 @@ public List<Broadcast> getActiveBroadcastList(Map<String, String> broadcastMap,

String status = broadcast.getStatus();
if (IAntMediaStreamHandler.BROADCAST_STATUS_BROADCASTING.equals(status) &&
(StringUtils.isAnyBlank(hostAddress, broadcast.getOriginAdress()) || hostAddress.equals(broadcast.getOriginAdress())))
(StringUtils.isBlank(hostAddress) || hostAddress.equals(broadcast.getOriginAdress())))
{
broadcastList.add(broadcast);
}
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/io/antmedia/datastore/db/MongoStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -1368,9 +1368,7 @@ public long getLocalLiveBroadcastCount(String hostAddress) {
return datastore.find(Broadcast.class)
.filter(Filters.and(
Filters.or(
Filters.eq(ORIGIN_ADDRESS, hostAddress),
Filters.exists(ORIGIN_ADDRESS).not()
),
Filters.eq(ORIGIN_ADDRESS, hostAddress) ),
Filters.eq(STATUS, IAntMediaStreamHandler.BROADCAST_STATUS_BROADCASTING)
)).count();
}
Expand All @@ -1383,9 +1381,7 @@ public List<Broadcast> getLocalLiveBroadcasts(String hostAddress)
return datastore.find(Broadcast.class)
.filter(Filters.and(
Filters.or(
Filters.eq(ORIGIN_ADDRESS, hostAddress),
Filters.exists(ORIGIN_ADDRESS).not()
),
Filters.eq(ORIGIN_ADDRESS, hostAddress) ),
Filters.eq(STATUS, IAntMediaStreamHandler.BROADCAST_STATUS_BROADCASTING)
)).iterator().toList();
}
Expand Down

0 comments on commit 39e5e3d

Please sign in to comment.