Skip to content

Commit

Permalink
Merge pull request #51 from aws-samples/develop
Browse files Browse the repository at this point in the history
SDK update
  • Loading branch information
codingspirit committed Mar 24, 2022
2 parents 895f6bb + efdf470 commit 895ed7f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion samples/kvs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ message(STATUS "EMBEDDED_MEDIA_LINK_DIR - ${EMBEDDED_MEDIA_LINK_DIR}")
include(ExternalProject)
ExternalProject_Add(kvs-producer
GIT_REPOSITORY https://github.com/aws-samples/amazon-kinesis-video-streams-producer-embedded-c.git
GIT_TAG ca1c73196e9ec18f5ab7f67933ae53ad313bfa53
GIT_TAG v1.0.0
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${AWS_DEPENDENCIES_DIR}/kvs/ -DCMAKE_BUILD_TYPE=Release
BUILD_ALWAYS TRUE
GIT_PROGRESS TRUE
Expand Down
4 changes: 4 additions & 0 deletions samples/kvs/source/kvsappcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ static int setKvsAppOptions(KvsAppHandle kvsAppHandle)
{
printf("Failed to set AWS_SECRET_KEY\n");
}
if (KvsApp_setoption(kvsAppHandle, OPTION_AWS_SESSION_TOKEN, OptCfg_getAwsSessionToken()) != 0)
{
printf("Failed to set AWS_SESSION_TOKEN\n");
}
#endif /* ENABLE_IOT_CREDENTIAL */

#if ENABLE_AUDIO_TRACK
Expand Down
19 changes: 18 additions & 1 deletion samples/kvs/source/option_configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "option_configuration.h"
#include "sample_config.h"

#define AWS_ACCESS_KEY_ENV_VAR "AWS_ACCESS_KEY_ID"
#define AWS_SECRET_KEY_ENV_VAR "AWS_SECRET_ACCESS_KEY"
#define AWS_DEFAULT_REGION_ENV_VAR "AWS_DEFAULT_REGION"
#define AWS_SESSION_TOKEN_ENV_VAR "AWS_SESSION_TOKEN"
#define AWS_DEFAULT_REGION_ENV_VAR "AWS_DEFAULT_REGION"

#define AWS_KINESIS_VIDEO_HOST_ENV_VAR "AWS_KVS_HOST"

Expand Down Expand Up @@ -58,6 +59,22 @@ const char *OptCfg_getAwsSecretAccessKey()
return pAwsSecretAccessKey;
}

const char *OptCfg_getAwsSessionToken()
{
char *pAwsSessionToken = NULL;

#ifdef SAMPLE_OPTIONS_FROM_ENV_VAR
pAwsSessionToken = getenv(AWS_SESSION_TOKEN_ENV_VAR);
#endif /* SAMPLE_OPTIONS_FROM_ENV_VAR */

if (pAwsSessionToken == NULL)
{
pAwsSessionToken = strcmp(AWS_SESSION_TOKEN, "") ? AWS_SESSION_TOKEN : NULL;
}

return pAwsSessionToken;
}

const char *OptCfg_getRegion()
{
char *pRegion = NULL;
Expand Down
11 changes: 11 additions & 0 deletions samples/kvs/source/option_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ const char *OptCfg_getAwsAccessKey();
*/
const char *OptCfg_getAwsSecretAccessKey();

/**
* @brief Get AWS session token
*
* It searches AWS secret access key with following order:
* 1. environment variable
* 2. sample_config.h
*
* @return AWS session token
*/
const char *OptCfg_getAwsSessionToken();

/**
* @brief Get AWS region
*
Expand Down
2 changes: 2 additions & 0 deletions samples/kvs/source/sample_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
/* KVS general configuration */
#define AWS_ACCESS_KEY "xxxxxxxxxxxxxxxxxxxx"
#define AWS_SECRET_KEY "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
/* Only for AK/SK + STS case */
#define AWS_SESSION_TOKEN ""

/* KVS stream configuration */
#define KVS_STREAM_NAME "kvs_example_camera_stream"
Expand Down
2 changes: 1 addition & 1 deletion samples/webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(WEBRTC_CMAKE_C_FLAGS "-fPIC -std=gnu99")
include(ExternalProject)
ExternalProject_Add(kvs-webrtc
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.git
GIT_TAG 111c253a0ebea9f4f774ee5896ab5f15c6a0ea12
GIT_TAG v1.7.2
CMAKE_ARGS -DADD_MUCLIBC=${USE_MUCLIBC}
-DUSE_OPENSSL=OFF -DUSE_MBEDTLS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_SAMPLE=OFF -DBUILD_LIBSRTP_DESTINATION_PLATFORM=${BOARD_DESTINATION_PLATFORM} -DCMAKE_INSTALL_PREFIX=${AWS_DEPENDENCIES_DIR}/webrtc/
-DCMAKE_BUILD_TYPE=Release -DOPEN_SRC_INSTALL_PREFIX=${AWS_DEPENDENCIES_DIR}/webrtc/
Expand Down

0 comments on commit 895ed7f

Please sign in to comment.