-
Couldn't load subscription status.
- Fork 79
Jni clientinfo #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Jni clientinfo #211
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |
| cm-file | ||
| .DS_Store | ||
| target | ||
| out/ | ||
| src/main/resources/META-INF/* | ||
| logs | ||
| hs_err_pid*.log | ||
|
|
||
| *.log | ||
| *.log.* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package com.amazonaws.kinesisvideo.producer; | ||
|
|
||
| /** | ||
| * Java model for native code in PIC. | ||
| * <p> | ||
| * In some streaming scenarios video is not constantly being produced, | ||
| * in this case special handling must take place to handle various streaming | ||
| * scenarios. | ||
| * | ||
| * @see <a href="https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/client/include/com/amazonaws/kinesis/video/client/Include.h">PIC</a> | ||
| */ | ||
| public enum AutomaticStreamingFlags { | ||
| /** | ||
| * With this option we'll create a timer (burns a thread) and periodically check | ||
| * if there are any streams which haven't had any PutFrame calls | ||
| * over fixed period of time, in which case we'll close out the fragment | ||
| * to prevent back-end from timing out and closing the session | ||
| */ | ||
| AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER(0), | ||
|
|
||
| /** | ||
| * This option indicates a desire to do continuous recording with no gaps | ||
| * this doesn't mean we can't have dropped packets, this mode should NOT | ||
| * be used if for example only motion or event based video is to be recorded | ||
| */ | ||
| AUTOMATIC_STREAMING_ALWAYS_CONTINUOUS((1 << 8)); | ||
|
|
||
| private final int streamingFlagValue; | ||
|
|
||
| AutomaticStreamingFlags(final int streamingFlagValue) { | ||
| this.streamingFlagValue = streamingFlagValue; | ||
| } | ||
|
|
||
| public int getStreamingFlagValue() { | ||
| return streamingFlagValue; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,45 +11,49 @@ public class ClientInfo { | |
| /** | ||
| * Current version for the structure as defined in the native code | ||
| */ | ||
|
|
||
| public static final int CLIENT_INFO_CURRENT_VERSION = 3; | ||
| public static final int DEFAULT_LOG_LEVEL = 4; | ||
|
|
||
| public static enum AutomaticStreamingFlags { | ||
| AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER(0), AUTOMATIC_STREAMING_ALWAYS_CONTINUOUS(256); | ||
| private final int streamingFlagValue; | ||
|
|
||
| private AutomaticStreamingFlags(int streamingFlagValue) { | ||
| this.streamingFlagValue = streamingFlagValue; | ||
| } | ||
|
|
||
| public int getStreamingFlagValue() { | ||
| return streamingFlagValue; | ||
| } | ||
|
|
||
| } | ||
|
|
||
| private final int mVersion; | ||
| private final long mCreateClientTimeout; | ||
| private final long mCreateStreamTimeout; | ||
| private final long mStopStreamTimeout; | ||
| private final long mOfflineBufferAvailabilityTimeout; | ||
| private final int mLogLevel; | ||
|
|
||
| private final int mLoggerLogLevel; | ||
| private final boolean mLogMetric; | ||
| private final AutomaticStreamingFlags mAutomaticStreamingFlags; | ||
|
|
||
| private final long mServiceCallCompletionTimeout; | ||
| private final long mServiceCallConnectionTimeout; | ||
|
|
||
| /** | ||
| * NOTE: The below members are not supported for setting/getting in Java. These will be set to | ||
| * default values in the JNI and C layers. | ||
| */ | ||
| private final long mMetricLoggingPeriod; | ||
| private final long mReservedCallbackPeriod; | ||
| private final KvsRetryStrategy mKvsRetryStrategy; | ||
| private final KvsRetryStrategyCallbacks mKvsRetryStrategyCallbacks; | ||
|
|
||
|
|
||
| public ClientInfo() { | ||
| mVersion = CLIENT_INFO_CURRENT_VERSION; | ||
| mCreateClientTimeout = 0L; | ||
| mCreateStreamTimeout = 0L; | ||
| mStopStreamTimeout = 0L; | ||
| mOfflineBufferAvailabilityTimeout = 0L; | ||
| mLogLevel = DEFAULT_LOG_LEVEL; | ||
| mLoggerLogLevel = DEFAULT_LOG_LEVEL; | ||
| mLogMetric = true; | ||
| mAutomaticStreamingFlags = AutomaticStreamingFlags.AUTOMATIC_STREAMING_INTERMITTENT_PRODUCER; | ||
| mServiceCallCompletionTimeout = 0L; | ||
| mServiceCallConnectionTimeout = 0L; | ||
| mMetricLoggingPeriod = 0; | ||
| mReservedCallbackPeriod = 0; | ||
| mKvsRetryStrategyCallbacks = new DefaultKvsRetryStrategyCallbacks(); | ||
| mKvsRetryStrategy = new KvsRetryStrategy(); | ||
| } | ||
|
|
||
| public ClientInfo(final long createClientTimeout, final long createStreamTimeout, final long stopStreamTimeout, | ||
|
|
@@ -68,11 +72,34 @@ public ClientInfo(final long createClientTimeout, final long createStreamTimeout | |
| mCreateStreamTimeout = createStreamTimeout; | ||
| mStopStreamTimeout = stopStreamTimeout; | ||
| mOfflineBufferAvailabilityTimeout = offlineBufferAvailabilityTimeout; | ||
| mLogLevel = logLevel; | ||
| mLoggerLogLevel = logLevel; | ||
| mLogMetric = logMetric; | ||
| mAutomaticStreamingFlags = flag; | ||
| mServiceCallCompletionTimeout = 0L; | ||
| mServiceCallConnectionTimeout = 0L; | ||
| mMetricLoggingPeriod = 0; | ||
| mReservedCallbackPeriod = 0; | ||
| mKvsRetryStrategyCallbacks = new DefaultKvsRetryStrategyCallbacks(); | ||
| mKvsRetryStrategy = new KvsRetryStrategy(); } | ||
|
|
||
| public ClientInfo(final long createClientTimeout, final long createStreamTimeout, final long stopStreamTimeout, | ||
| final long offlineBufferAvailabilityTimeout, final long serviceCallConnectionTimeou, | ||
| final long serviceCallCompletionTimeout, final int logLevel, | ||
| final boolean logMetric, final AutomaticStreamingFlags flag) { | ||
| mVersion = CLIENT_INFO_CURRENT_VERSION; | ||
| mCreateClientTimeout = createClientTimeout; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be consistent with the native with suffix as ms? or seconds? |
||
| mCreateStreamTimeout = createStreamTimeout; | ||
| mStopStreamTimeout = stopStreamTimeout; | ||
| mOfflineBufferAvailabilityTimeout = offlineBufferAvailabilityTimeout; | ||
| mLoggerLogLevel = logLevel; | ||
| mLogMetric = logMetric; | ||
| mAutomaticStreamingFlags = flag; | ||
| mServiceCallCompletionTimeout = serviceCallCompletionTimeout; | ||
| mServiceCallConnectionTimeout = serviceCallConnectionTimeout; | ||
| mServiceCallConnectionTimeout = serviceCallConnectionTimeou; | ||
| mMetricLoggingPeriod = 0; | ||
| mReservedCallbackPeriod = 0; | ||
| mKvsRetryStrategyCallbacks = new DefaultKvsRetryStrategyCallbacks(); | ||
| mKvsRetryStrategy = new KvsRetryStrategy(); | ||
| } | ||
|
|
||
| public int getVersion() { | ||
|
|
@@ -95,8 +122,16 @@ public long getOfflineBufferAvailabilityTimeout() { | |
| return mOfflineBufferAvailabilityTimeout; | ||
| } | ||
|
|
||
| public long getServiceCallCompletionTimeout() { | ||
| return mServiceCallCompletionTimeout; | ||
| } | ||
|
|
||
| public long getServiceCallConnectionTimeout() { | ||
| return mServiceCallConnectionTimeout; | ||
| } | ||
|
|
||
| public int getLoggerLogLevel() { | ||
| return mLogLevel; | ||
| return mLoggerLogLevel; | ||
| } | ||
|
|
||
| public boolean getLogMetric() { | ||
|
|
@@ -107,11 +142,23 @@ public int getAutomaticStreamingFlags() { | |
| return mAutomaticStreamingFlags.getStreamingFlagValue(); | ||
| } | ||
|
|
||
| public long getServiceCompletionTimeout() { | ||
| return mServiceCallCompletionTimeout; | ||
| public long getMetricLoggingPeriod() { | ||
| return mMetricLoggingPeriod; | ||
| } | ||
|
|
||
| public long getServiceConnectionTimeout() { | ||
| return mServiceCallConnectionTimeout; | ||
| public long getReservedCallbackPeriod() { | ||
| return mReservedCallbackPeriod; | ||
| } | ||
|
|
||
| public KvsRetryStrategy getKvsRetryStrategy() { | ||
| return mKvsRetryStrategy; | ||
| } | ||
|
|
||
| /** | ||
| * NOTE: The below getters are not supported for setting/getting in Java. These will return | ||
| * null to be initialized to default/null values in the JNI and C layers. | ||
| */ | ||
| public KvsRetryStrategyCallbacks getKvsRetryStrategyCallbacks() { | ||
| return null; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.amazonaws.kinesisvideo.producer; | ||
|
|
||
| /** | ||
| * No-op implementation. | ||
| */ | ||
| public class DefaultKvsRetryStrategyCallbacks implements KvsRetryStrategyCallbacks { | ||
|
|
||
| @Override | ||
| public void createRetryStrategyFn(KvsRetryStrategy kvsRetryStrategy) throws ProducerException { | ||
| // no-op | ||
| } | ||
|
|
||
| @Override | ||
| public void getCurrentRetryAttemptNumberFn(KvsRetryStrategy kvsRetryStrategy, int retryCount) throws ProducerException { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't seem right |
||
| // no-op | ||
| } | ||
|
|
||
| @Override | ||
| public void freeRetryStrategyFn(KvsRetryStrategy kvsRetryStrategy) throws ProducerException { | ||
| // no-op | ||
| } | ||
|
|
||
| @Override | ||
| public void executeRetryStrategyFn(KvsRetryStrategy kvsRetryStrategy, long retryWaitTime) throws ProducerException { | ||
| // no-op | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package com.amazonaws.kinesisvideo.producer; | ||
|
|
||
| /** | ||
| * Java model for native code in PIC. | ||
| * <p> | ||
| * A generic retry strategy | ||
| * | ||
| * @see <a href="https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/utils/include/com/amazonaws/kinesis/video/utils/Include.h">PIC</a> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
| */ | ||
| public class KvsRetryStrategy { | ||
|
|
||
| // Pointer to metadata/state/details for the retry strategy. | ||
| // The actual data type is abstracted and will be inferred by | ||
| // the RetryHandlerFn | ||
| private final long mRetryStrategy; | ||
|
|
||
| // Optional configuration used to build the retry strategy. Once the retry strategy is created, | ||
| // any changes to the config will be useless. | ||
| private final long mRetryStrategyConfig; | ||
|
|
||
| // Retry strategy type | ||
| private final KvsRetryStrategyType mKvsRetryStrategyType; | ||
|
|
||
| public KvsRetryStrategy() { | ||
| mRetryStrategy = 0; | ||
| mRetryStrategyConfig = 0; | ||
| mKvsRetryStrategyType = KvsRetryStrategyType.EXPONENTIAL_BACKOFF_WAIT; | ||
| } | ||
|
|
||
| /** | ||
| * NOTE: The below getters are not supported for setting/getting in Java. These will return | ||
| * null to be initialized to default/null values in the JNI and C layers. | ||
| * <p> | ||
| * Check {@code setupDefaultKvsRetryStrategyParameters} in PIC for the default initialization. | ||
| * | ||
| * @see <a href="https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/client/src/Client.c">PIC</a> | ||
| */ | ||
| public long getRetryStrategy() { | ||
| return 0; | ||
| } | ||
|
|
||
| public long getRetryStrategyConfig() { | ||
| return 0; | ||
| } | ||
|
|
||
| public int getRetryStrategyType() { | ||
| return mKvsRetryStrategyType.getKvsRetryStrategyType(); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.