Skip to content

Commit 814a932

Browse files
committed
Updates for 1.0.10-M8
1 parent f755aea commit 814a932

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>1.0.10-M7</version>
6+
<version>1.0.10-M8</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-server</artifactId>

src/main/java/org/red5/server/stream/ServerStream.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.lang.ref.WeakReference;
2323
import java.util.Collection;
24+
import java.util.EnumSet;
2425
import java.util.HashMap;
2526
import java.util.Map;
2627
import java.util.concurrent.CopyOnWriteArrayList;
@@ -77,6 +78,8 @@ public class ServerStream extends AbstractStream implements IServerStream, IFilt
7778

7879
private static final long WAIT_THRESHOLD = 0;
7980

81+
private static EnumSet<StreamState> PLAYING_OR_PAUSED = EnumSet.of(StreamState.PLAYING, StreamState.PAUSED);
82+
8083
/**
8184
* Stream published name
8285
*/
@@ -424,7 +427,7 @@ public void setPublishedName(String name) {
424427
* Start this server-side stream
425428
*/
426429
public void start() {
427-
if (state != StreamState.UNINIT) {
430+
if (state.get() != StreamState.UNINIT) {
428431
throw new IllegalStateException("State " + state + " not valid to start");
429432
}
430433
if (items.size() == 0) {
@@ -452,7 +455,7 @@ public void start() {
452455
* Stop this server-side stream
453456
*/
454457
public void stop() {
455-
if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
458+
if (PLAYING_OR_PAUSED.contains(state.get())) {
456459
if (liveJobName != null) {
457460
scheduler.removeScheduledJob(liveJobName);
458461
liveJobName = null;
@@ -493,7 +496,7 @@ public void stopRecording() {
493496
/** {@inheritDoc} */
494497
@SuppressWarnings("incomplete-switch")
495498
public void pause() {
496-
switch (state) {
499+
switch (state.get()) {
497500
case PLAYING:
498501
setState(StreamState.PAUSED);
499502
break;
@@ -508,14 +511,14 @@ public void pause() {
508511
/** {@inheritDoc} */
509512
public void seek(int position) {
510513
// seek only allowed when playing or paused
511-
if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
514+
if (PLAYING_OR_PAUSED.contains(state.get())) {
512515
sendVODSeekCM(msgIn, position);
513516
}
514517
}
515518

516519
/** {@inheritDoc} */
517520
public void close() {
518-
if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
521+
if (PLAYING_OR_PAUSED.contains(state.get())) {
519522
stop();
520523
}
521524
if (msgOut != null) {
@@ -567,7 +570,7 @@ public void onPipeConnectionEvent(PipeConnectionEvent event) {
567570
*/
568571
protected void play(IPlayItem item) {
569572
// dont play unless we are stopped
570-
if (state == StreamState.STOPPED) {
573+
if (state.get() == StreamState.STOPPED) {
571574
// assume this is not live stream
572575
boolean isLive = false;
573576
if (providerService != null) {
@@ -738,7 +741,7 @@ protected void scheduleNextMessage() {
738741
delta = nextTS - vodStartTS - (System.currentTimeMillis() - serverStartTS);
739742
if (delta < WAIT_THRESHOLD) {
740743
if (doPushMessage()) {
741-
if (state != StreamState.PLAYING) {
744+
if (state.get() != StreamState.PLAYING) {
742745
// Stream is not playing, don't load more messages
743746
nextRTMPMessage = null;
744747
}
@@ -757,7 +760,7 @@ public void execute(ISchedulingService service) {
757760
if (vodJobName != null) {
758761
vodJobName = null;
759762
if (doPushMessage()) {
760-
if (state == StreamState.PLAYING) {
763+
if (state.get() == StreamState.PLAYING) {
761764
scheduleNextMessage();
762765
} else {
763766
// Stream is paused, don't load more messages

src/main/server/red5.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if NOT DEFINED JAVA_HOME goto err
88

99
REM JAVA options
1010
REM You can set JVM additional options here if you want
11-
if NOT DEFINED JVM_OPTS set JVM_OPTS=-Xms256m -Xmx1g -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true -XX:MaxMetaspaceSize=128m -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=2
11+
if NOT DEFINED JVM_OPTS set JVM_OPTS=-Xms256m -Xmx1g -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true -XX:MaxMetaspaceSize=128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=2
1212
REM Set up logging options
1313
set LOGGING_OPTS=-Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true
1414
REM Set up security options

src/main/server/red5.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ echo "Running on " $OS
3737
# JAVA options
3838
# You can set JVM additional options here if you want
3939
if [ -z "$JVM_OPTS" ]; then
40-
JVM_OPTS="-Xms256m -Xmx1g -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true -XX:MaxMetaspaceSize=128m -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=2"
40+
JVM_OPTS="-Xms256m -Xmx1g -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true -XX:MaxMetaspaceSize=128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=2"
4141
fi
4242
# Set up security options
4343
SECURITY_OPTS="-Djava.security.debug=failure"

0 commit comments

Comments
 (0)