Skip to content

Commit 7eb7818

Browse files
authored
Merge branch 'master' into tokenBlacklist
2 parents 06b4627 + 630c5ed commit 7eb7818

36 files changed

+1116
-379
lines changed

pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,18 @@
600600
<version>${mockito-core.version}</version>
601601
<scope>test</scope>
602602
</dependency>
603+
<dependency>
604+
<groupId>org.powermock</groupId>
605+
<artifactId>powermock-module-junit4</artifactId>
606+
<version>2.0.9</version>
607+
<scope>test</scope>
608+
</dependency>
609+
<dependency>
610+
<groupId>org.powermock</groupId>
611+
<artifactId>powermock-api-mockito2</artifactId>
612+
<version>2.0.9</version>
613+
<scope>test</scope>
614+
</dependency>
603615
<dependency>
604616
<groupId>javax.websocket</groupId>
605617
<artifactId>javax.websocket-api</artifactId>

src/main/java/io/antmedia/AntMediaApplicationAdapter.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,14 @@
88
import java.lang.reflect.Modifier;
99
import java.nio.file.Files;
1010
import java.nio.file.Path;
11-
import java.util.ArrayList;
12-
import java.util.Collections;
13-
import java.util.HashMap;
14-
import java.util.Iterator;
15-
import java.util.List;
16-
import java.util.Map;
11+
import java.util.*;
1712
import java.util.Map.Entry;
13+
import java.util.concurrent.ConcurrentLinkedQueue;
1814
import java.util.regex.Pattern;
19-
import java.util.Queue;
20-
import java.util.Set;
2115

2216
import javax.validation.constraints.NotNull;
2317

18+
import io.antmedia.statistic.*;
2419
import org.apache.commons.io.FileUtils;
2520
import org.apache.commons.io.FilenameUtils;
2621
import org.apache.commons.lang3.RandomStringUtils;
@@ -72,9 +67,6 @@
7267
import io.antmedia.settings.ServerSettings;
7368
import io.antmedia.shutdown.AMSShutdownManager;
7469
import io.antmedia.shutdown.IShutdownListener;
75-
import io.antmedia.statistic.DashViewerStats;
76-
import io.antmedia.statistic.HlsViewerStats;
77-
import io.antmedia.statistic.ViewerStats;
7870
import io.antmedia.statistic.type.RTMPToWebRTCStats;
7971
import io.antmedia.statistic.type.WebRTCAudioReceiveStats;
8072
import io.antmedia.statistic.type.WebRTCAudioSendStats;
@@ -97,6 +89,7 @@ public class AntMediaApplicationAdapter extends MultiThreadedApplicationAdapter
9789
public static final String HOOK_ACTION_END_LIVE_STREAM = "liveStreamEnded";
9890
public static final String HOOK_ACTION_START_LIVE_STREAM = "liveStreamStarted";
9991
public static final String HOOK_ACTION_VOD_READY = "vodReady";
92+
10093
public static final String HOOK_ACTION_PUBLISH_TIMEOUT_ERROR = "publishTimeoutError";
10194
public static final String HOOK_ACTION_ENCODER_NOT_OPENED_ERROR = "encoderNotOpenedError";
10295
public static final String HOOK_ACTION_ENDPOINT_FAILED = "endpointFailed";
@@ -151,7 +144,7 @@ public class AntMediaApplicationAdapter extends MultiThreadedApplicationAdapter
151144

152145
protected StorageClient storageClient;
153146

154-
protected ArrayList<IStreamListener> streamListeners = new ArrayList<>();
147+
protected Queue<IStreamListener> streamListeners = new ConcurrentLinkedQueue<>();
155148

156149
IClusterStreamFetcher clusterStreamFetcher;
157150

@@ -176,6 +169,7 @@ public boolean appStart(IScope app) {
176169
if (!result.isSuccess()) {
177170
//Save App Setting
178171
this.shutdownProperly = false;
172+
179173
// Reset Broadcast Stats
180174
resetBroadcasts();
181175
}
@@ -241,7 +235,6 @@ else if (getServerSettings().getHostAddress().equals(storedSettings.getWarFileOr
241235

242236
setStorageclientSettings(appSettings);
243237

244-
245238
logger.info("{} started", app.getName());
246239

247240
return true;
@@ -357,7 +350,6 @@ public Result importVoDFolder(String vodFolderPath) {
357350
return result;
358351
}
359352

360-
361353
public Result unlinksVoD(String directory)
362354
{
363355
//check the directory exist
@@ -1616,6 +1608,7 @@ public void setStorageclientSettings(AppSettings settings) {
16161608
storageClient.setEnabled(settings.isS3RecordingEnabled());
16171609
storageClient.setPermission(settings.getS3Permission());
16181610
storageClient.setStorageClass(settings.getS3StorageClass());
1611+
storageClient.setCacheControl(settings.getS3CacheControl());
16191612
storageClient.reset();
16201613
}
16211614

src/main/java/io/antmedia/AppSettings.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ public class AppSettings implements Serializable{
309309
public static final String SETTINGS_S3_BUCKET_NAME = "settings.s3BucketName";
310310
public static final String SETTINGS_S3_ENDPOINT = "settings.s3Endpoint";
311311
public static final String SETTINGS_S3_PERMISSION = "settings.s3Permission";
312+
public static final String SETTINGS_S3_CACHE_CONTROL = "settings.s3CacheControl";
312313
public static final String SETTINGS_ENABLE_TIME_TOKEN_PLAY = "settings.enableTimeTokenForPlay";
313314
public static final String SETTINGS_ENABLE_TIME_TOKEN_PUBLISH = "settings.enableTimeTokenForPublish";
314315

@@ -1424,6 +1425,12 @@ public class AppSettings implements Serializable{
14241425
@Value( "${"+SETTINGS_S3_ENDPOINT+":#{null}}" )
14251426
private String s3Endpoint;
14261427

1428+
/**
1429+
* S3 Cache Control Metadata
1430+
*/
1431+
@Value( "${"+SETTINGS_S3_CACHE_CONTROL+":no-store, no-cache, must-revalidate, max-age=0}" )
1432+
private String s3CacheControl = "no-store, no-cache, must-revalidate, max-age=0";
1433+
14271434
/*
14281435
* The permission to use in uploading the files to the S3.
14291436
* Following values are accepted. Default value is public-read
@@ -1610,7 +1617,7 @@ public boolean isWriteStatsToDatastore() {
16101617
*
16111618
* In initialization no matter if spring or field definition is effective, the important thing is that having some random value
16121619
*/
1613-
@Value( "${"+SETTINGS_CLUSTER_COMMUNICATION_KEY+ ":+ #{ T(org.apache.commons.lang3.RandomStringUtils).randomAlphanumeric(32)}" )
1620+
@Value( "${"+SETTINGS_CLUSTER_COMMUNICATION_KEY+ ":#{ T(org.apache.commons.lang3.RandomStringUtils).randomAlphanumeric(32)}" )
16141621
private String clusterCommunicationKey = RandomStringUtils.randomAlphanumeric(32);
16151622

16161623
public void setWriteStatsToDatastore(boolean writeStatsToDatastore) {
@@ -2840,6 +2847,14 @@ public void setS3Endpoint(String s3Endpoint) {
28402847
this.s3Endpoint = s3Endpoint;
28412848
}
28422849

2850+
public String getS3CacheControl() {
2851+
return s3CacheControl;
2852+
}
2853+
2854+
public void setS3CacheControl(String s3CacheControl) {
2855+
this.s3CacheControl = s3CacheControl;
2856+
}
2857+
28432858
public void setDashHttpEndpoint(String dashHttpEndpoint) {
28442859
this.dashHttpEndpoint = dashHttpEndpoint;
28452860
}

0 commit comments

Comments
 (0)