Skip to content

Commit

Permalink
Reset alias default to disabled; placed random alias gen behind logge…
Browse files Browse the repository at this point in the history
…r debug flag
  • Loading branch information
mondain committed Apr 15, 2022
1 parent 2c13db0 commit ced8215
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/java/org/red5/server/stream/StreamService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public class StreamService implements IStreamService {
protected boolean stripTypePrefix = true;

/**
* Whether or not to enable stream name aliasing.
* Whether or not to enable stream name aliasing; defaulted to disabled.
*/
protected boolean nameAliasingEnabled = true;
protected boolean nameAliasingEnabled;

/**
* Use to determine playback type.
Expand Down Expand Up @@ -710,11 +710,16 @@ public void publish(String name, String mode) {
// comma separated
Stream.of(params.get("aliases").split(",")).forEach(alias -> bs.addAlias(alias));
} else {
// generate some random alpha/num aliases; based on cpu count x2
int aliasCount = Runtime.getRuntime().availableProcessors() * 2;
for (int i = 0; i < aliasCount; i++) {
// generate 8-16 long aliases
bs.addAlias(RandomStringUtils.randomAlphanumeric(8, 16));
// XXX this was used during testing or via means which didn't easily pass parameters it remains
// as an example, but will be blocked via the logger to prevent extra configuration options.
if (log.isDebugEnabled()) {
log.debug("Randomly generated playback aliases will be generated due to this class log setting");
// generate some random alpha/num aliases; based on cpu count x2
int aliasCount = Runtime.getRuntime().availableProcessors() * 2;
for (int i = 0; i < aliasCount; i++) {
// generate 8-16 long aliases
bs.addAlias(RandomStringUtils.randomAlphanumeric(8, 16));
}
}
}
// if aliasing, check for publish-side alias
Expand Down

0 comments on commit ced8215

Please sign in to comment.