Skip to content

Commit a1953f1

Browse files
authored
Release 1.12.1 (#167)
* Expose streaming flags in java with jni (#160) * expose streaming flags in java with jni * remove set method from clientinfo * add enum * rename vars; create new constructor * change case for enum name * Add store pressure policy (#162) * change stream info def version, add storePressurePolicy * use updated dylib * update .so file for changed JNI * fix constructor calls and retention in streaminfo * remove windows build from ci * update windows dll for 1.12.0 * update cpp jni libs from release 3.3.1 * update version in pom and readme
1 parent 6ac3f9c commit a1953f1

File tree

12 files changed

+114
-20
lines changed

12 files changed

+114
-20
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
contents: read
1919
strategy:
2020
matrix:
21-
os: [ macos-10.15, ubuntu-18.04, windows-2019 ]
21+
os: [ macos-10.15, ubuntu-18.04, windows-2019]
2222
java: [ 8, 11, 16 ]
2323
steps:
2424
- name: Checkout the repository

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $ mvn clean compile assembly:single
6666

6767
Start the demo app
6868
```
69-
$ java -classpath target/amazon-kinesis-video-streams-producer-sdk-java-1.12.0-jar-with-dependencies.jar -Daws.accessKeyId=<ACCESS_KEY> -Daws.secretKey=<SECRET_KEY> -Dkvs-stream=<KINESIS_VIDEO_STREAM_NAME> -Djava.library.path=<NativeLibraryPath> -Dlog4j.configurationFile=log4j2.xml com.amazonaws.kinesisvideo.demoapp.DemoAppMain
69+
$ java -classpath target/amazon-kinesis-video-streams-producer-sdk-java-1.12.1-jar-with-dependencies.jar -Daws.accessKeyId=<ACCESS_KEY> -Daws.secretKey=<SECRET_KEY> -Dkvs-stream=<KINESIS_VIDEO_STREAM_NAME> -Djava.library.path=<NativeLibraryPath> -Dlog4j.configurationFile=log4j2.xml com.amazonaws.kinesisvideo.demoapp.DemoAppMain
7070
7171
```
7272
##### Run API and functionality tests
@@ -134,6 +134,10 @@ The repository is using `develop` branch as the aggregation and all of the featu
134134

135135
## Release Notes
136136

137+
### Release 1.12.1 (May 2022)
138+
* Allow updating automaticStreamingFlags (default: AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER) in ClientInfo
139+
* Allow updating storePressurePolicy (default: CONTENT_STORE_PRESSURE_POLICY_DROP_TAIL_ITEM) in StreamInfo
140+
137141
### Release 1.12.0 (February 2022)
138142
* Update guice from 4.2.3 to 5.1.0
139143
* Update junit from 4.13.1 to 4.13.2

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<groupId>com.amazonaws</groupId>
1616
<artifactId>amazon-kinesis-video-streams-producer-sdk-java</artifactId>
1717
<name>Amazon Kinesis Video Streams Producer SDK Java</name>
18-
<version>1.12.0</version>
18+
<version>1.12.1</version>
1919
<description>The Amazon Kinesis Video Streams Producer SDK for Java enables Java developers to ingest data into
2020
Amazon Kinesis Video.
2121
</description>

src/main/java/com/amazonaws/kinesisvideo/java/mediasource/file/ImageFileMediaSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.REQUEST_FRAGMENT_ACKS;
1919
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.RETENTION_ONE_HOUR;
2020
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.USE_FRAME_TIMECODES;
21-
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.VERSION_ZERO;
21+
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.VERSION_TWO;
2222

2323
import javax.annotation.Nonnull;
2424
import javax.annotation.Nullable;
@@ -83,7 +83,7 @@ public MediaSourceConfiguration getConfiguration() {
8383

8484
@Override
8585
public StreamInfo getStreamInfo() throws KinesisVideoException {
86-
return new StreamInfo(VERSION_ZERO,
86+
return new StreamInfo(VERSION_TWO,
8787
streamName,
8888
StreamInfo.StreamingType.STREAMING_TYPE_REALTIME,
8989
imageFileMediaSourceConfiguration.getContentType(),

src/main/java/com/amazonaws/kinesisvideo/producer/ClientInfo.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,31 @@ public class ClientInfo {
1111
/**
1212
* Current version for the structure as defined in the native code
1313
*/
14-
public static final int CLIENT_INFO_CURRENT_VERSION = 0;
14+
public static final int CLIENT_INFO_CURRENT_VERSION = 2;
1515
public static final int DEFAULT_LOG_LEVEL = 4;
1616

17+
public static enum AutomaticStreamingFlags {
18+
AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER(0), AUTOMATIC_STREAMING_ALWAYS_CONTINUOUS(256);
19+
private final int streamingFlagValue;
20+
21+
private AutomaticStreamingFlags(int streamingFlagValue) {
22+
this.streamingFlagValue = streamingFlagValue;
23+
}
24+
25+
public int getStreamingFlagValue() {
26+
return streamingFlagValue;
27+
}
28+
29+
}
30+
1731
private final int mVersion;
1832
private final long mCreateClientTimeout;
1933
private final long mCreateStreamTimeout;
2034
private final long mStopStreamTimeout;
2135
private final long mOfflineBufferAvailabilityTimeout;
2236
private final int mLogLevel;
2337
private final boolean mLogMetric;
38+
private final AutomaticStreamingFlags mAutomaticStreamingFlags;
2439

2540
public ClientInfo() {
2641
mVersion = CLIENT_INFO_CURRENT_VERSION;
@@ -30,18 +45,27 @@ public ClientInfo() {
3045
mOfflineBufferAvailabilityTimeout = 0L;
3146
mLogLevel = DEFAULT_LOG_LEVEL;
3247
mLogMetric = true;
48+
mAutomaticStreamingFlags = AutomaticStreamingFlags.AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER;
3349
}
3450

3551
public ClientInfo(final long createClientTimeout, final long createStreamTimeout, final long stopStreamTimeout,
36-
final long offlineBufferAvailabilityTimeout,
37-
final int logLevel, final boolean logMetric) {
52+
final long offlineBufferAvailabilityTimeout, final int logLevel,
53+
final boolean logMetric) {
54+
this(createClientTimeout, createStreamTimeout, stopStreamTimeout, offlineBufferAvailabilityTimeout,
55+
logLevel, logMetric, AutomaticStreamingFlags.AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER);
56+
}
57+
58+
public ClientInfo(final long createClientTimeout, final long createStreamTimeout, final long stopStreamTimeout,
59+
final long offlineBufferAvailabilityTimeout, final int logLevel,
60+
final boolean logMetric, final AutomaticStreamingFlags flag) {
3861
mVersion = CLIENT_INFO_CURRENT_VERSION;
3962
mCreateClientTimeout = createClientTimeout;
4063
mCreateStreamTimeout = createStreamTimeout;
4164
mStopStreamTimeout = stopStreamTimeout;
4265
mOfflineBufferAvailabilityTimeout = offlineBufferAvailabilityTimeout;
43-
mLogLevel = DEFAULT_LOG_LEVEL;
66+
mLogLevel = logLevel;
4467
mLogMetric = logMetric;
68+
mAutomaticStreamingFlags = flag;
4569
}
4670

4771
public int getVersion() {
@@ -71,4 +95,8 @@ public int getLoggerLogLevel() {
7195
public boolean getLogMetric() {
7296
return mLogMetric;
7397
}
98+
99+
public int getAutomaticStreamingFlags() {
100+
return mAutomaticStreamingFlags.getStreamingFlagValue();
101+
}
74102
}

src/main/java/com/amazonaws/kinesisvideo/producer/StreamInfo.java

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class StreamInfo {
2929
* StreamInfo structure current version.
3030
* IMPORTANT: Must be kept in sync with the native counterpart.
3131
*/
32-
public static final int STREAM_INFO_CURRENT_VERSION = 1;
32+
public static final int STREAM_INFO_CURRENT_VERSION = 2;
3333

3434
/**
3535
* Streaming types that must correspond to the native counterparts
@@ -113,6 +113,34 @@ public int getIntValue() {
113113
}
114114
}
115115

116+
/**
117+
* Storage pressure policy that must correspond to the native counterparts
118+
*/
119+
public static enum StorePressurePolicy {
120+
/**
121+
* Return an error STATUS_STORE_OUT_OF_MEMORY when we have no available storage when putting frame.
122+
* The value of 0 is the default.
123+
*/
124+
CONTENT_STORE_PRESSURE_POLICY_OOM(0),
125+
126+
/**
127+
* Evict the earliest frames to make space for the new frame being put.
128+
* Might result in dropped frame callbacks fired.
129+
*/
130+
CONTENT_STORE_PRESSURE_POLICY_DROP_TAIL_ITEM(1);
131+
132+
private int value;
133+
134+
private StorePressurePolicy(final int i) {
135+
value = i;
136+
}
137+
138+
public int getIntValue() {
139+
return value;
140+
}
141+
}
142+
143+
116144
private final int mVersion;
117145
private final String mName;
118146
private final StreamingType mStreamingType;
@@ -139,6 +167,7 @@ public int getIntValue() {
139167
private final TrackInfo[] mTrackInfoList;
140168
private final UUID mSegmentUuid;
141169
private final FrameOrderMode mFrameOrderMode;
170+
private final StorePressurePolicy mStorePressurePolicy;
142171

143172
/**
144173
* Generates a track name from a content type
@@ -262,6 +291,26 @@ public StreamInfo(final int version, @Nullable final String name, @Nonnull final
262291
@Nullable final UUID segmentUuid,
263292
@Nonnull final TrackInfo[] trackInfoList,
264293
FrameOrderMode frameOrderMode) {
294+
this(version, name, streamingType, contentType, kmsKeyId, retentionPeriod, adaptive, maxLatency,
295+
fragmentDuration, keyFrameFragmentation, frameTimecodes, absoluteFragmentTimes, fragmentAcks,
296+
recoverOnError, avgBandwidthBps, frameRate, bufferDuration, replayDuration,
297+
connectionStalenessDuration, timecodeScale, recalculateMetrics, tags,
298+
nalAdaptationFlags, segmentUuid, trackInfoList, frameOrderMode,
299+
StorePressurePolicy.CONTENT_STORE_PRESSURE_POLICY_DROP_TAIL_ITEM);
300+
}
301+
302+
public StreamInfo(final int version, @Nullable final String name, @Nonnull final StreamingType streamingType,
303+
@Nonnull final String contentType, @Nullable final String kmsKeyId, final long retentionPeriod,
304+
final boolean adaptive, final long maxLatency, final long fragmentDuration,
305+
final boolean keyFrameFragmentation, final boolean frameTimecodes,
306+
final boolean absoluteFragmentTimes, final boolean fragmentAcks, final boolean recoverOnError,
307+
final int avgBandwidthBps, final int frameRate, final long bufferDuration,
308+
final long replayDuration, final long connectionStalenessDuration, final long timecodeScale,
309+
final boolean recalculateMetrics, @Nullable final Tag[] tags,
310+
@Nonnull final NalAdaptationFlags nalAdaptationFlags,
311+
@Nullable final UUID segmentUuid,
312+
@Nonnull final TrackInfo[] trackInfoList,
313+
FrameOrderMode frameOrderMode, StorePressurePolicy storePressurePolicy) {
265314
mVersion = version;
266315
mName = name;
267316
mStreamingType = streamingType;
@@ -288,6 +337,7 @@ public StreamInfo(final int version, @Nullable final String name, @Nonnull final
288337
mSegmentUuid = segmentUuid;
289338
mTrackInfoList = trackInfoList;
290339
mFrameOrderMode = frameOrderMode;
340+
mStorePressurePolicy = storePressurePolicy;
291341
}
292342

293343
public int getVersion() {
@@ -466,4 +516,8 @@ public int getNalAdaptationFlags() {
466516
public int getFrameOrderMode() {
467517
return mFrameOrderMode.intValue();
468518
}
519+
520+
public int getStorePressurePolicy() {
521+
return mStorePressurePolicy.getIntValue();
522+
}
469523
}

src/main/java/com/amazonaws/kinesisvideo/util/StreamInfoConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public final class StreamInfoConstants {
2222
public static final boolean RELATIVE_FRAGMENT_TIMECODES = false;
2323
public static final String NO_KMS_KEY_ID = null;
2424
public static final int VERSION_ZERO = 0;
25+
public static final int VERSION_ONE = 1;
26+
public static final int VERSION_TWO = 2;
2527
public static final long MAX_LATENCY_ZERO = 0L; // latency set to 0 will never trigger latency pressure callback
2628
public static final long MAX_LATENCY = 120L * HUNDREDS_OF_NANOS_IN_A_SECOND;
2729
public static final long NO_RETENTION = 0L;
18.6 KB
Binary file not shown.
23.2 KB
Binary file not shown.
311 KB
Binary file not shown.

0 commit comments

Comments
 (0)