From aafb347079426f1fd5eb45ef0adfbc941f15d46b Mon Sep 17 00:00:00 2001 From: Paul Gregoire Date: Tue, 2 Aug 2022 10:20:35 -0700 Subject: [PATCH] Bumped version to 1.2.28. Added adapter method to allow scoped streams to be pulled easier --- client/pom.xml | 2 +- .../main/java/org/red5/client/Red5Client.java | 2 +- common/pom.xml | 2 +- .../MultiThreadedApplicationAdapter.java | 5 ++++ .../main/java/org/red5/server/api/Red5.java | 4 ++-- .../org/red5/server/api/scope/IScope.java | 8 +++++++ .../api/service/IBroadcastStreamService.java | 14 ++++++++--- .../java/org/red5/server/scope/Scope.java | 24 +++++++++++++++++++ io/pom.xml | 2 +- pom.xml | 2 +- server/pom.xml | 2 +- service/pom.xml | 2 +- 12 files changed, 57 insertions(+), 12 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index 257b13d82..5c46c9197 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -3,7 +3,7 @@ org.red5 red5-parent - 1.2.27 + 1.2.28 4.0.0 red5-client diff --git a/client/src/main/java/org/red5/client/Red5Client.java b/client/src/main/java/org/red5/client/Red5Client.java index bfde5cd10..d02988992 100644 --- a/client/src/main/java/org/red5/client/Red5Client.java +++ b/client/src/main/java/org/red5/client/Red5Client.java @@ -18,7 +18,7 @@ public final class Red5Client { /** * Current server version with revision */ - public static final String VERSION = "Red5 Client 1.2.27"; + public static final String VERSION = "Red5 Client 1.2.28"; /** * Create a new Red5Client object using the connection local to the current thread A bit of magic that lets you access the red5 scope diff --git a/common/pom.xml b/common/pom.xml index 9947723db..df9d1e7de 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -3,7 +3,7 @@ org.red5 red5-parent - 1.2.27 + 1.2.28 4.0.0 red5-server-common diff --git a/common/src/main/java/org/red5/server/adapter/MultiThreadedApplicationAdapter.java b/common/src/main/java/org/red5/server/adapter/MultiThreadedApplicationAdapter.java index 513ffd226..40345aca2 100644 --- a/common/src/main/java/org/red5/server/adapter/MultiThreadedApplicationAdapter.java +++ b/common/src/main/java/org/red5/server/adapter/MultiThreadedApplicationAdapter.java @@ -882,6 +882,11 @@ public IBroadcastStream getBroadcastStream(IScope scope, String name) { return null; } + /** {@inheritDoc} */ + public Set getBroadcastStreams(IScope scope) { + return scope.getBroadcastStreams(); + } + /** * Returns list of stream names broadcasted in scope. Broadcast stream name is somewhat different from server stream name. Server stream * name is just an ID assigned by Red5 to every created stream. Broadcast stream name is the name that is being used to subscribe to the diff --git a/common/src/main/java/org/red5/server/api/Red5.java b/common/src/main/java/org/red5/server/api/Red5.java index 82c7e45d4..9179d689b 100644 --- a/common/src/main/java/org/red5/server/api/Red5.java +++ b/common/src/main/java/org/red5/server/api/Red5.java @@ -55,12 +55,12 @@ public final class Red5 { /** * Server version with revision */ - public static final String VERSION = "Red5 Server 1.2.27"; + public static final String VERSION = "Red5 Server 1.2.28"; /** * Server version for fmsVer requests */ - public static final String FMS_VERSION = "RED5/1,2,27,0"; + public static final String FMS_VERSION = "RED5/1,2,28,0"; /** * Server capabilities diff --git a/common/src/main/java/org/red5/server/api/scope/IScope.java b/common/src/main/java/org/red5/server/api/scope/IScope.java index 711bd8aee..0f3ae5b93 100644 --- a/common/src/main/java/org/red5/server/api/scope/IScope.java +++ b/common/src/main/java/org/red5/server/api/scope/IScope.java @@ -16,6 +16,7 @@ import org.red5.server.api.IContext; import org.red5.server.api.service.IServiceHandlerProvider; import org.red5.server.api.statistics.IScopeStatistics; +import org.red5.server.api.stream.IBroadcastStream; import org.springframework.core.io.support.ResourcePatternResolver; /** @@ -273,4 +274,11 @@ public interface IScope extends IBasicScope, ResourcePatternResolver, IServiceHa */ public Map getAttributes(); + /** + * Returns all the broadcast streams in the current scope. + * + * @return set of IBroadcastStream if any exist or empty if none exist + */ + public Set getBroadcastStreams(); + } diff --git a/common/src/main/java/org/red5/server/api/service/IBroadcastStreamService.java b/common/src/main/java/org/red5/server/api/service/IBroadcastStreamService.java index e6f37e6e2..271dca78d 100644 --- a/common/src/main/java/org/red5/server/api/service/IBroadcastStreamService.java +++ b/common/src/main/java/org/red5/server/api/service/IBroadcastStreamService.java @@ -25,7 +25,7 @@ public interface IBroadcastStreamService { * name of the broadcast * @return true is a stream exists, otherwise false */ - public boolean hasBroadcastStream(IScope scope, String name); + boolean hasBroadcastStream(IScope scope, String name); /** * Get a broadcast stream by name @@ -36,7 +36,7 @@ public interface IBroadcastStreamService { * the name of the broadcast * @return broadcast stream object */ - public IBroadcastStream getBroadcastStream(IScope scope, String name); + IBroadcastStream getBroadcastStream(IScope scope, String name); /** * Get a set containing the names of all the broadcasts @@ -45,6 +45,14 @@ public interface IBroadcastStreamService { * the scope to search for streams * @return set containing all broadcast names */ - public Set getBroadcastStreamNames(IScope scope); + Set getBroadcastStreamNames(IScope scope); + + /** + * Returns broadcast streams registered on the scope. + * + * @param scope + * @return set of broadcast streams or empty if none exist + */ + Set getBroadcastStreams(IScope scope); } diff --git a/common/src/main/java/org/red5/server/scope/Scope.java b/common/src/main/java/org/red5/server/scope/Scope.java index b1d18f98f..ace25fd84 100644 --- a/common/src/main/java/org/red5/server/scope/Scope.java +++ b/common/src/main/java/org/red5/server/scope/Scope.java @@ -46,6 +46,7 @@ import org.red5.server.api.scope.ScopeType; import org.red5.server.api.statistics.IScopeStatistics; import org.red5.server.api.statistics.support.StatisticsCounter; +import org.red5.server.api.stream.IBroadcastStream; import org.red5.server.api.stream.IClientBroadcastStream; import org.red5.server.exception.ScopeException; import org.red5.server.jmx.mxbeans.ScopeMXBean; @@ -449,6 +450,18 @@ public IBroadcastScope getBroadcastScope(String name) { return (IBroadcastScope) children.getBasicScope(ScopeType.BROADCAST, name); } + /** + * Return the broadcast streams for this scope. + * + * @return broadcast streams or empty if not found + */ + @Override + public Set getBroadcastStreams() { + Set streams = new HashSet<>(); + children.getBasicScopes(ScopeType.BROADCAST).stream().filter(bs -> ((IBroadcastScope) bs).getClientBroadcastStream() != null).forEach(bs -> streams.add(((IBroadcastScope) bs).getClientBroadcastStream())); + return streams; + } + /** * Return base scope with given name. * @@ -1428,6 +1441,17 @@ public boolean hasName(String name) { return false; } + /** + * Returns child scopes for a given type. + * + * @param type + * Scope type + * @return set of scopes matching type + */ + public Set getBasicScopes(ScopeType type) { + return stream().filter(child -> child.getType().equals(type)).collect(Collectors.toUnmodifiableSet()); + } + /** * Returns a child scope for a given name and type. * diff --git a/io/pom.xml b/io/pom.xml index bfcd078c9..f94b5b9ec 100644 --- a/io/pom.xml +++ b/io/pom.xml @@ -3,7 +3,7 @@ org.red5 red5-parent - 1.2.27 + 1.2.28 4.0.0 red5-io diff --git a/pom.xml b/pom.xml index bbc06a9e0..1870f3d68 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ Red5 The Red5 server org.red5 - 1.2.27 + 1.2.28 https://github.com/Red5/red5-server 2005 diff --git a/server/pom.xml b/server/pom.xml index c3ca28e1f..7c98852d0 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -3,7 +3,7 @@ org.red5 red5-parent - 1.2.27 + 1.2.28 4.0.0 red5-server diff --git a/service/pom.xml b/service/pom.xml index 12252b4ab..73b13b6ad 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -3,7 +3,7 @@ org.red5 red5-parent - 1.2.27 + 1.2.28 4.0.0 red5-service