Skip to content

Commit d799c25

Browse files
sirknightjpoojamat
andauthored
Kinesis Video Update (#2581)
* Update KVS ABIs and interfaces to latest * Remove unused import androidx.annotation.AnyThread * Fix class header comment * Fix logging statement * Update logging statements again Co-authored-by: poojamat <[email protected]>
1 parent c9b3caa commit d799c25

26 files changed

+943
-602
lines changed

aws-android-sdk-kinesisvideo/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies {
2323
implementation project(path: ':aws-android-sdk-mobile-client')
2424
//noinspection DuplicatePlatformClasses
2525
compileOnly 'org.apache.httpcomponents:httpclient:4.5.12'
26+
compileOnly 'com.github.spotbugs:spotbugs-annotations:3.1.3'
2627
testImplementation 'junit:junit:4.13.1'
2728
}
2829

aws-android-sdk-kinesisvideo/src/main/java/com/amazonaws/kinesisvideo/internal/client/mediasource/MediaSourceSink.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public interface MediaSourceSink {
2020

2121
void onCodecPrivateData(final @Nullable byte[] codecPrivateData) throws KinesisVideoException;
2222

23+
void onCodecPrivateData(final @Nullable byte[] codecPrivateData, final int trackId) throws KinesisVideoException;
24+
2325
void onFragmentMetadata(final @NonNull String metadataName, final @NonNull String metadataValue, final boolean persistent)
2426
throws KinesisVideoException;
2527

aws-android-sdk-kinesisvideo/src/main/java/com/amazonaws/kinesisvideo/internal/mediasource/ProducerStreamSink.java

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
1-
/**
2-
* Copyright 2017-2018 Amazon.com,
3-
* Inc. or its affiliates. All Rights Reserved.
4-
*
5-
* Licensed under the Amazon Software License (the "License").
6-
* You may not use this file except in compliance with the
7-
* License. A copy of the License is located at
8-
*
9-
* http://aws.amazon.com/asl/
10-
*
11-
* or in the "license" file accompanying this file. This file is
12-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13-
* CONDITIONS OF ANY KIND, express or implied. See the License
14-
* for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
17-
181
package com.amazonaws.kinesisvideo.internal.mediasource;
192

203
import static com.amazonaws.kinesisvideo.common.preconditions.Preconditions.checkNotNull;
4+
import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.DEFAULT_TRACK_ID;
215

226
import androidx.annotation.NonNull;
237
import androidx.annotation.Nullable;
@@ -53,8 +37,13 @@ public void onFrame(@NonNull final KinesisVideoFrame kinesisVideoFrame) throws K
5337
}
5438

5539
@Override
56-
public void onCodecPrivateData(@Nullable final byte[] bytes) throws KinesisVideoException {
57-
producerStream.streamFormatChanged(bytes);
40+
public void onCodecPrivateData(@Nullable final byte[] codecPrivateData) throws KinesisVideoException {
41+
onCodecPrivateData(codecPrivateData, DEFAULT_TRACK_ID);
42+
}
43+
44+
@Override
45+
public void onCodecPrivateData(@Nullable final byte[] bytes, int trackId) throws KinesisVideoException {
46+
producerStream.streamFormatChanged(bytes, trackId);
5847
}
5948

6049
@Override

aws-android-sdk-kinesisvideo/src/main/java/com/amazonaws/kinesisvideo/internal/producer/KinesisVideoProducer.java

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
/**
2-
* Copyright 2017-2018 Amazon.com,
3-
* Inc. or its affiliates. All Rights Reserved.
4-
*
5-
* Licensed under the Amazon Software License (the "License").
6-
* You may not use this file except in compliance with the
7-
* License. A copy of the License is located at
8-
*
9-
* http://aws.amazon.com/asl/
10-
*
11-
* or in the "license" file accompanying this file. This file is
12-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13-
* CONDITIONS OF ANY KIND, express or implied. See the License
14-
* for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
17-
181
package com.amazonaws.kinesisvideo.internal.producer;
192

203
import com.amazonaws.kinesisvideo.producer.DeviceInfo;
@@ -121,58 +104,69 @@ KinesisVideoProducerStream createStreamSync(final @NonNull StreamInfo streamInfo
121104
/**
122105
* DescribeStream result event
123106
*
124-
* @param customData Custom data that should be passed to the engine
107+
* @param stream Stream object for the result event callback
108+
* @param streamHandle Stream handle returned by PIC
125109
* @param streamDescription Stream description object
126110
* @param httpStatusCode HTTP status code
127111
* @throws ProducerException
128112
*/
129-
void describeStreamResult(final long customData,
113+
void describeStreamResult(final KinesisVideoProducerStream stream,
114+
final long streamHandle,
130115
final @Nullable StreamDescription streamDescription,
131116
int httpStatusCode) throws ProducerException;
132117

133118
/**
134119
* GetStreamingEndpoint result event
135120
*
136-
* @param customData Custom data that should be passed to the engine
121+
* @param stream Stream object for the result event callback
122+
* @param streamHandle Stream handle returned by PIC
137123
* @param endpoint Streaming endpoint if successful
138124
* @param httpStatusCode HTTP status code
139125
* @throws ProducerException
140126
*/
141-
void getStreamingEndpointResult(final long customData, final @Nullable String endpoint,
127+
void getStreamingEndpointResult(final KinesisVideoProducerStream stream,
128+
final long streamHandle,
129+
final @Nullable String endpoint,
142130
int httpStatusCode)
143131
throws ProducerException;
144132

145133
/**
146134
* GetStreamingToken result event
147135
*
148-
* @param customData Custom data that should be passed to the engine
136+
* @param stream Stream object for the result event callback
137+
* @param streamHandle Stream handle returned by PIC
149138
* @param token Streaming token if successful
150139
* @param expiration Streaming token expiration in absolute time in 100ns
151140
* @param httpStatusCode HTTP status code
152141
* @throws ProducerException
153142
*/
154-
void getStreamingTokenResult(final long customData, final @Nullable byte[] token, long expiration, int httpStatusCode)
143+
void getStreamingTokenResult(final KinesisVideoProducerStream stream,
144+
final long streamHandle,
145+
final @Nullable byte[] token, long expiration,
146+
int httpStatusCode)
155147
throws ProducerException;
156148

157149
/**
158150
* PutStream result event
159151
*
160-
* @param customData Custom data that should be passed to the engine
161-
* @param clientStreamHandle A stream handle identifier from the client side
152+
* @param stream Stream object for the result event callback
153+
* @param uploadHandle A stream upload handle identifier from the client side
162154
* @param httpStatusCode HTTP status code
163155
* @throws ProducerException
164156
*/
165-
void putStreamResult(final long customData, long clientStreamHandle, int httpStatusCode)
157+
void putStreamResult(final KinesisVideoProducerStream stream, long uploadHandle, int httpStatusCode)
166158
throws ProducerException;
167159

168160
/**
169161
* TagResource result event
170162
*
171-
* @param customData Custom data that should be passed to the engine
163+
* @param stream Stream object for the result event callback
164+
* @param streamHandle Stream handle returned by PIC
172165
* @param httpStatusCode HTTP status code
173166
* @throws ProducerException
174167
*/
175-
void tagResourceResult(final long customData, int httpStatusCode)
168+
void tagResourceResult(final KinesisVideoProducerStream stream,
169+
final long streamHandle, int httpStatusCode)
176170
throws ProducerException;
177171

178172
/**
@@ -201,4 +195,4 @@ void deviceCertToTokenResult(final long customData, final @Nullable byte[] token
201195
@NonNull
202196
KinesisVideoMetrics getMetrics()
203197
throws ProducerException;
204-
}
198+
}

aws-android-sdk-kinesisvideo/src/main/java/com/amazonaws/kinesisvideo/internal/producer/KinesisVideoProducerStream.java

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
/**
2-
* Copyright 2017-2018 Amazon.com,
3-
* Inc. or its affiliates. All Rights Reserved.
4-
*
5-
* Licensed under the Amazon Software License (the "License").
6-
* You may not use this file except in compliance with the
7-
* License. A copy of the License is located at
8-
*
9-
* http://aws.amazon.com/asl/
10-
*
11-
* or in the "license" file accompanying this file. This file is
12-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13-
* CONDITIONS OF ANY KIND, express or implied. See the License
14-
* for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
17-
181
package com.amazonaws.kinesisvideo.internal.producer;
192

203
import com.amazonaws.kinesisvideo.producer.KinesisVideoFragmentAck;
@@ -62,17 +45,15 @@ public interface KinesisVideoProducerStream extends StreamCallbacks {
6245
/**
6346
* Get stream data from the buffer.
6447
*
65-
* @param fillBuffer
66-
* The buffer to fill
67-
* @param offset
68-
* The start of the buffer
69-
* @param length
70-
* The number of bytes to fill
71-
* @param readResult
72-
* The result of the read
48+
* @param uploadHandle Client stream upload handle.
49+
* @param fillBuffer The buffer to fill
50+
* @param offset The start of the buffer
51+
* @param length The number of bytes to fill
52+
* @param readResult The result of the read
7353
* @throws ProducerException
7454
*/
75-
void getStreamData(final @NonNull byte[] fillBuffer, int offset, int length, @NonNull final ReadResult readResult)
55+
void getStreamData(final long uploadHandle, final @NonNull byte[] fillBuffer, int offset, int length,
56+
@NonNull final ReadResult readResult)
7657
throws ProducerException;
7758

7859
/**
@@ -108,7 +89,7 @@ void getStreamData(final @NonNull byte[] fillBuffer, int offset, int length, @No
10889
* NOTE: CPD is @Nullable - specifying a null will remove the CPD.
10990
* NOTE: currently, only Codec Private Data is supported while not streaming.
11091
*/
111-
void streamFormatChanged(final @Nullable byte[] codecPrivateData) throws ProducerException;
92+
void streamFormatChanged(final @Nullable byte[] codecPrivateData, final int trackId) throws ProducerException;
11293

11394
/**
11495
* Returns the underlying native stream handle
@@ -149,8 +130,13 @@ void getStreamData(final @NonNull byte[] fillBuffer, int offset, int length, @No
149130
@NonNull
150131
KinesisVideoStreamMetrics getMetrics() throws ProducerException;
151132

133+
/**
134+
* Free the Kinesis Video stream.
135+
*/
136+
void streamFreed() throws ProducerException;
137+
152138
/**
153139
* Reset current connection of producer stream
154140
*/
155141
void resetConnection() throws ProducerException;
156-
}
142+
}

aws-android-sdk-kinesisvideo/src/main/java/com/amazonaws/kinesisvideo/internal/producer/ServiceCallbacks.java

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
/**
2-
* Copyright 2017-2018 Amazon.com,
3-
* Inc. or its affiliates. All Rights Reserved.
4-
*
5-
* Licensed under the Amazon Software License (the "License").
6-
* You may not use this file except in compliance with the
7-
* License. A copy of the License is located at
8-
*
9-
* http://aws.amazon.com/asl/
10-
*
11-
* or in the "license" file accompanying this file. This file is
12-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13-
* CONDITIONS OF ANY KIND, express or implied. See the License
14-
* for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
17-
18-
191
package com.amazonaws.kinesisvideo.internal.producer;
202

213
import com.amazonaws.kinesisvideo.producer.ProducerException;
@@ -85,15 +67,17 @@ void createStream(final @NonNull String deviceName,
8567
* @param timeout - Time out for the call - 100ns
8668
* @param authData - Authentication bits
8769
* @param authType - Authentication type - this is the AUTH_INFO_TYPE defined in /src/client/Include.h
88-
* @param customData - Custom data to use to call the event functions
70+
* @param streamHandle - stream handle returned by PIC
71+
* @param stream - stream object for the result event callback
8972
* @throws ProducerException
9073
*/
9174
void describeStream(final @NonNull String streamName,
9275
long callAfter,
9376
long timeout,
9477
final @Nullable byte[] authData,
9578
int authType,
96-
long customData) throws ProducerException;
79+
long streamHandle,
80+
KinesisVideoProducerStream stream) throws ProducerException;
9781

9882
/**
9983
* Schedules a call to get streaming endpoint
@@ -103,16 +87,18 @@ void describeStream(final @NonNull String streamName,
10387
* @param timeout - Time out for the call - 100ns
10488
* @param authData - Authentication bits
10589
* @param authType - Authentication type - this is the AUTH_INFO_TYPE defined in /src/client/Include.h
106-
* @param customData - Custom data to use to call the event functions
90+
* @param streamHandle - stream handle returned by PIC
91+
* @param stream - stream object for the result event callback
10792
* @throws ProducerException
10893
*/
10994
void getStreamingEndpoint(final @NonNull String streamName,
110-
final @NonNull String apiName,
111-
long callAfter,
112-
long timeout,
113-
final @Nullable byte[] authData,
114-
int authType,
115-
long customData) throws ProducerException;
95+
final @NonNull String apiName,
96+
long callAfter,
97+
long timeout,
98+
final @Nullable byte[] authData,
99+
int authType,
100+
long streamHandle,
101+
KinesisVideoProducerStream stream) throws ProducerException;
116102

117103
/**
118104
* Schedules a call to get streaming token
@@ -121,15 +107,17 @@ void getStreamingEndpoint(final @NonNull String streamName,
121107
* @param timeout - Time out for the call - 100ns
122108
* @param authData - Authentication bits
123109
* @param authType - Authentication type - this is the AUTH_INFO_TYPE defined in /src/client/Include.h
124-
* @param customData - Custom data to use to call the event functions
110+
* @param streamHandle - stream handle returned by PIC
111+
* @param stream - stream object for the result event callback
125112
* @throws ProducerException
126113
*/
127114
void getStreamingToken(final @NonNull String streamName,
128-
long callAfter,
129-
long timeout,
130-
final @Nullable byte[] authData,
131-
int authType,
132-
long customData) throws ProducerException;
115+
long callAfter,
116+
long timeout,
117+
final @Nullable byte[] authData,
118+
int authType,
119+
long streamHandle,
120+
KinesisVideoProducerStream stream) throws ProducerException;
133121

134122
/**
135123
* Schedules a call to put stream API
@@ -143,7 +131,7 @@ void getStreamingToken(final @NonNull String streamName,
143131
* @param timeout - Time out for the call - 100ns
144132
* @param authData - Authentication bits
145133
* @param authType - Authentication type - this is the AUTH_INFO_TYPE defined in /src/client/Include.h
146-
* @param customData - Custom data to use to call the event functions
134+
* @param stream - stream object for the result event callback
147135
* @throws ProducerException
148136
*/
149137
void putStream(final @NonNull String streamName,
@@ -156,7 +144,7 @@ void putStream(final @NonNull String streamName,
156144
long timeout,
157145
final @Nullable byte[] authData,
158146
int authType,
159-
long customData) throws ProducerException;
147+
KinesisVideoProducerStream stream) throws ProducerException;
160148

161149
/**
162150
* Schedules a call to tag resource API
@@ -166,7 +154,8 @@ void putStream(final @NonNull String streamName,
166154
* @param timeout - Time out for the call - 100ns
167155
* @param authData - Authentication bits
168156
* @param authType - Authentication type - this is the AUTH_INFO_TYPE defined in /src/client/Include.h
169-
* @param customData - Custom data to use to call the event functions
157+
* @param streamHandle - stream handle returned by PIC
158+
* @param stream - stream object for the result event callback
170159
* @throws ProducerException
171160
*/
172161
void tagResource(final @NonNull String resourceArn,
@@ -175,7 +164,8 @@ void tagResource(final @NonNull String resourceArn,
175164
long timeout,
176165
final @Nullable byte[] authData,
177166
int authType,
178-
long customData) throws ProducerException;
167+
long streamHandle,
168+
KinesisVideoProducerStream stream) throws ProducerException;
179169

180170
/**
181171
* Schedules a call to create device

0 commit comments

Comments
 (0)