Skip to content

Commit 9da2019

Browse files
committed
4a5082f Release note for v1.4.0
* Fix for crash caused by latest Mac tool chain issue * Fix for callbacks returning incorrect custom data in gstreamer sample app * Support for custom logger * Fix for multiple callbacks when triggering connection staleness
1 parent f7bea92 commit 9da2019

File tree

30 files changed

+703
-128
lines changed

30 files changed

+703
-128
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ make install
341341

342342

343343
## Release Notes
344-
344+
#### Release 1.4.0 (25th April 2018)
345+
* Fix for crash caused by latest Mac tool chain issue
346+
* Fix for callbacks returning incorrect custom data in gstreamer sample app
347+
* Support for custom logger
348+
* Fix for multiple callbacks when triggering connection staleness
345349
#### Release 1.3.1 (5th April 2018)
346350
* Fixed video source negotiation error caused by camera with fractional fps
347351
* Docker suport for RTSP streaming

kinesis-video-gst-demo/kinesis_video_gstreamer_sample_app.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ namespace com { namespace amazonaws { namespace kinesis { namespace video {
3333
class SampleClientCallbackProvider : public ClientCallbackProvider {
3434
public:
3535

36+
UINT64 getCallbackCustomData() override {
37+
return reinterpret_cast<UINT64> (this);
38+
}
39+
3640
StorageOverflowPressureFunc getStorageOverflowPressureCallback() override {
3741
return storageOverflowPressure;
3842
}
@@ -43,6 +47,10 @@ class SampleClientCallbackProvider : public ClientCallbackProvider {
4347
class SampleStreamCallbackProvider : public StreamCallbackProvider {
4448
public:
4549

50+
UINT64 getCallbackCustomData() override {
51+
return reinterpret_cast<UINT64> (this);
52+
}
53+
4654
StreamConnectionStaleFunc getStreamConnectionStaleCallback() override {
4755
return streamConnectionStaleHandler;
4856
};

kinesis-video-gst-demo/kinesis_video_gstreamer_sample_rtsp_app.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ namespace com {
3535
class SampleClientCallbackProvider : public ClientCallbackProvider {
3636
public:
3737

38+
UINT64 getCallbackCustomData() override {
39+
return reinterpret_cast<UINT64> (this);
40+
}
41+
3842
StorageOverflowPressureFunc getStorageOverflowPressureCallback() override {
3943
return storageOverflowPressure;
4044
}
@@ -45,6 +49,10 @@ namespace com {
4549
class SampleStreamCallbackProvider : public StreamCallbackProvider {
4650
public:
4751

52+
UINT64 getCallbackCustomData() override {
53+
return reinterpret_cast<UINT64> (this);
54+
}
55+
4856
StreamConnectionStaleFunc getStreamConnectionStaleCallback() override {
4957
return streamConnectionStaleHandler;
5058
};

kinesis-video-native-build/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ set(PIC_SOURCE_FILES
125125
${KINESIS_VIDEO_PIC_SRC}/src/utils/src/String.cpp
126126
${KINESIS_VIDEO_PIC_SRC}/src/utils/src/Threads.cpp
127127
${KINESIS_VIDEO_PIC_SRC}/src/utils/src/Time.cpp
128+
${KINESIS_VIDEO_PIC_SRC}/src/utils/src/Logger.cpp
128129

129130
${KINESIS_VIDEO_PIC_SRC}/src/view/include/com/amazonaws/kinesis/video/view/Include.h
130131
${KINESIS_VIDEO_PIC_SRC}/src/view/src/ContentView.cpp
@@ -301,11 +302,11 @@ target_link_libraries(kinesis_video_gstreamer_sample_app
301302
glib-2.0)
302303

303304
target_link_libraries(kinesis_video_gstreamer_sample_rtsp_app
304-
producer
305-
pthread
306-
dl
307-
gstreamer-1.0
308-
gstapp-1.0
309-
gobject-2.0
305+
producer
306+
pthread
307+
dl
308+
gstreamer-1.0
309+
gstapp-1.0
310+
gobject-2.0
310311
glib-2.0)
311312

kinesis-video-pic/src/client/include/com/amazonaws/kinesis/video/client/Include.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,15 @@ typedef VOID (*FreeMutexFunc)(UINT64,
13521352
*/
13531353
typedef UINT32 (*GetRandomNumberFunc)(UINT64);
13541354

1355+
///////////////////////////////////////////////////////////////
1356+
// Logging callbacks
1357+
///////////////////////////////////////////////////////////////
1358+
1359+
/**
1360+
* Logs a line of text with the tag and the log level - see PlatformUtils.h for more info
1361+
*/
1362+
typedef logPrintFunc LogPrintFunc;
1363+
13551364
///////////////////////////////////////////////////////////////
13561365
// Service call callbacks
13571366
///////////////////////////////////////////////////////////////
@@ -1528,6 +1537,7 @@ struct __ClientCallbacks {
15281537
CreateDeviceFunc createDeviceFn;
15291538
DeviceCertToTokenFunc deviceCertToTokenFn;
15301539
ClientReadyFunc clientReadyFn;
1540+
LogPrintFunc logPrintFn;
15311541
};
15321542
typedef __ClientCallbacks* PClientCallbacks;
15331543

kinesis-video-pic/src/client/src/Client.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ STATUS createKinesisVideoClient(PDeviceInfo pDeviceInfo, PClientCallbacks pClien
2929
PCHAR pCurPnt;
3030
CLIENT_HANDLE clientHandle;
3131

32-
DLOGI("Creating Kinesis Video Client");
33-
3432
// Check the input params
3533
CHK(pDeviceInfo != NULL && pClientHandle != NULL, STATUS_NULL_ARG);
3634

@@ -39,8 +37,13 @@ STATUS createKinesisVideoClient(PDeviceInfo pDeviceInfo, PClientCallbacks pClien
3937

4038
// Validate the input structs
4139
CHK_STATUS(validateDeviceInfo(pDeviceInfo));
40+
41+
// Validate the callbacks. Set default callbacks.
4242
CHK_STATUS(validateClientCallbacks(pDeviceInfo, pClientCallbacks));
4343

44+
// Report the creation after the validation as we might have the overwritten logger.
45+
DLOGI("Creating Kinesis Video Client");
46+
4447
// Allocate the main struct with an array of stream pointers following the structure and the array of tags following it
4548
// NOTE: The calloc will Zero the fields
4649
allocationSize = SIZEOF(KinesisVideoClient) + pDeviceInfo->streamCount * SIZEOF(PKinesisVideoStream) + pDeviceInfo->tagCount * TAG_FULL_LENGTH;
@@ -720,7 +723,7 @@ VOID viewItemRemoved(PContentView pContentView, UINT64 customData, PViewItem pVi
720723
DLOGW("Reporting a dropped frame/fragment.");
721724

722725
// Invalidate the streams current view item
723-
MEMSET(&pKinesisVideoStream->curViewItem, 0x00, SIZEOF(ViewItem));
726+
MEMSET(&pKinesisVideoStream->curViewItem, 0x00, SIZEOF(CurrentViewItem));
724727
pKinesisVideoStream->curViewItem.viewItem.handle = INVALID_ALLOCATION_HANDLE_VALUE;
725728

726729
switch (pKinesisVideoStream->streamInfo.streamCaps.streamingType) {

kinesis-video-pic/src/client/src/InputValidator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ STATUS validateClientCallbacks(PDeviceInfo pDeviceInfo, PClientCallbacks pClient
7979
pClientCallbacks->getRandomNumberFn = defaultGetRandomNumber;
8080
}
8181

82+
if (pClientCallbacks->logPrintFn != NULL) {
83+
globalCustomLogPrintFn = pClientCallbacks->logPrintFn;
84+
}
85+
8286
CleanUp:
8387
return retStatus;
8488
}

kinesis-video-pic/src/client/src/Stream.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ STATUS checkForConnectionStaleness(PKinesisVideoStream pKinesisVideoStream, PVie
16471647

16481648
// Check if we need to do anything
16491649
CHK(pKinesisVideoStream->streamInfo.streamCaps.connectionStalenessDuration != CONNECTION_STALENESS_DETECTION_SENTINEL &&
1650-
!pKinesisVideoStream->streamInfo.streamCaps.fragmentAcks &&
1650+
pKinesisVideoStream->streamInfo.streamCaps.fragmentAcks &&
16511651
pKinesisVideoStream->pKinesisVideoClient->clientCallbacks.streamConnectionStaleFn != NULL,
16521652
retStatus);
16531653

@@ -1668,6 +1668,7 @@ STATUS checkForConnectionStaleness(PKinesisVideoStream pKinesisVideoStream, PVie
16681668
pKinesisVideoStream->pKinesisVideoClient->clientCallbacks.customData,
16691669
TO_STREAM_HANDLE(pKinesisVideoStream),
16701670
lastAckDuration));
1671+
break;
16711672
}
16721673

16731674
curIndex--;

kinesis-video-pic/src/client/tst/ClientTestFixture.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ UINT32 ClientTestBase::getRandomNumberFunc(UINT64 customData)
2929
return RAND();
3030
}
3131

32+
VOID ClientTestBase::logPrintFunc(UINT32 level, PCHAR tag, PCHAR fmt, ...)
33+
{
34+
// Temp scratch buffer = 10KB
35+
CHAR tempBuf[10 * 1024];
36+
snprintf(tempBuf, SIZEOF(tempBuf), "\n[0x%016llx] [level %u] %s %s", GETTID(), level, tag, fmt);
37+
va_list valist;
38+
va_start(valist, fmt);
39+
vprintf(tempBuf, valist);
40+
va_end(valist);
41+
}
42+
3243
STATUS ClientTestBase::getDeviceCertificateFunc(UINT64 customData, PBYTE* ppCert, PUINT32 pSize, PUINT64 pExpiration)
3344
{
3445
DLOGV("TID 0x%016llx getDeviceCertificateFunc called.", GETTID());

kinesis-video-pic/src/client/tst/ClientTestFixture.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class ClientTestBase : public ::testing::Test {
211211
mClientCallbacks.tagResourceFn = tagResourceFunc;
212212
mClientCallbacks.getCurrentTimeFn = getCurrentTimeFunc;
213213
mClientCallbacks.getRandomNumberFn = getRandomNumberFunc;
214+
mClientCallbacks.logPrintFn = logPrintFunc;
214215
mClientCallbacks.clientReadyFn = clientReadyFunc;
215216
mClientCallbacks.streamDataAvailableFn = streamDataAvailableFunc;
216217
mClientCallbacks.streamErrorReportFn = streamErrorReportFunc;
@@ -509,6 +510,7 @@ class ClientTestBase : public ::testing::Test {
509510
//////////////////////////////////////////////////////////////////////////////////////
510511
static UINT64 getCurrentTimeFunc(UINT64);
511512
static UINT32 getRandomNumberFunc(UINT64);
513+
static VOID logPrintFunc(UINT32, PCHAR, PCHAR, ...);
512514
static STATUS getDeviceCertificateFunc(UINT64, PBYTE*, PUINT32, PUINT64);
513515
static STATUS getSecurityTokenFunc(UINT64, PBYTE*, PUINT32, PUINT64);
514516
static STATUS getDeviceFingerprintFunc(UINT64, PCHAR*);

0 commit comments

Comments
 (0)