@@ -794,14 +794,13 @@ STATUS lookForSslCert(PSampleConfiguration* ppSampleConfiguration)
794
794
return retStatus ;
795
795
}
796
796
797
- STATUS createSampleConfiguration (PCHAR channelName , SIGNALING_CHANNEL_ROLE_TYPE roleType , BOOL trickleIce , BOOL useTurn , UINT32 logLevel ,
798
- PSampleConfiguration * ppSampleConfiguration )
797
+ STATUS createSampleConfiguration (PCreateSampleConfigurationParams pCreateSampleConfigurationParams , PSampleConfiguration * ppSampleConfiguration )
799
798
{
800
799
STATUS retStatus = STATUS_SUCCESS ;
801
800
PCHAR pAccessKey , pSecretKey , pSessionToken ;
802
801
PSampleConfiguration pSampleConfiguration = NULL ;
803
802
804
- CHK (ppSampleConfiguration != NULL , STATUS_NULL_ARG );
803
+ CHK (ppSampleConfiguration != NULL && pCreateSampleConfigurationParams != NULL , STATUS_NULL_ARG );
805
804
806
805
CHK (NULL != (pSampleConfiguration = (PSampleConfiguration ) MEMCALLOC (1 , SIZEOF (SampleConfiguration ))), STATUS_NOT_ENOUGH_MEMORY );
807
806
@@ -870,23 +869,39 @@ STATUS createSampleConfiguration(PCHAR channelName, SIGNALING_CHANNEL_ROLE_TYPE
870
869
pSampleConfiguration -> signalingSendMessageLock = MUTEX_CREATE (FALSE);
871
870
/* This is ignored for master. Master can extract the info from offer. Viewer has to know if peer can trickle or
872
871
* not ahead of time. */
873
- pSampleConfiguration -> trickleIce = trickleIce ;
874
- pSampleConfiguration -> useTurn = useTurn ;
872
+ pSampleConfiguration -> trickleIce = pCreateSampleConfigurationParams -> trickleIce ;
873
+ pSampleConfiguration -> useTurn = pCreateSampleConfigurationParams -> useTurn ;
875
874
pSampleConfiguration -> enableSendingMetricsToViewerViaDc = FALSE;
876
875
pSampleConfiguration -> receiveAudioVideoSource = NULL ;
877
876
878
877
pSampleConfiguration -> channelInfo .version = CHANNEL_INFO_CURRENT_VERSION ;
879
- pSampleConfiguration -> channelInfo .pChannelName = channelName ;
878
+ pSampleConfiguration -> channelInfo .pChannelName = pCreateSampleConfigurationParams -> channelName ;
880
879
#ifdef IOT_CORE_ENABLE_CREDENTIALS
881
880
if ((pIotCoreCertificateId = GETENV (IOT_CORE_CERTIFICATE_ID )) != NULL ) {
882
881
pSampleConfiguration -> channelInfo .pChannelName = pIotCoreCertificateId ;
883
882
}
884
883
#endif
884
+
885
+ if (pCreateSampleConfigurationParams -> useDualStackEndpoints ) {
886
+ // Create the custom fully qualified control plane endpoint, sans the legacy/dual-stack postfix.
887
+ SNPRINTF (pSampleConfiguration -> customControlPlaneEndpoint , MAX_CONTROL_PLANE_URI_CHAR_LEN , "%s%s.%s" , CONTROL_PLANE_URI_PREFIX , KINESIS_VIDEO_SERVICE_NAME , pSampleConfiguration -> channelInfo .pRegion );
888
+
889
+ if (STRSTR (pSampleConfiguration -> channelInfo .pRegion , "cn-" )) {
890
+ STRCAT (pSampleConfiguration -> customControlPlaneEndpoint , CONTROL_PLANE_URI_POSTFIX_CN_DUAL_STACK ); // Will use CN region dual-stack endpoint.
891
+ } else {
892
+ STRCAT (pSampleConfiguration -> customControlPlaneEndpoint , CONTROL_PLANE_URI_POSTFIX_DUAL_STACK ); // Will use Dual-stack endpoint.
893
+ }
894
+
895
+ pSampleConfiguration -> channelInfo .pControlPlaneUrl = pSampleConfiguration -> customControlPlaneEndpoint ;
896
+ } else {
897
+ pSampleConfiguration -> channelInfo .pControlPlaneUrl = NULL ; // Will use default legacy endpoints.
898
+ }
899
+
885
900
pSampleConfiguration -> channelInfo .pKmsKeyId = NULL ;
886
901
pSampleConfiguration -> channelInfo .tagCount = 0 ;
887
902
pSampleConfiguration -> channelInfo .pTags = NULL ;
888
903
pSampleConfiguration -> channelInfo .channelType = SIGNALING_CHANNEL_TYPE_SINGLE_MASTER ;
889
- pSampleConfiguration -> channelInfo .channelRoleType = roleType ;
904
+ pSampleConfiguration -> channelInfo .channelRoleType = pCreateSampleConfigurationParams -> roleType ;
890
905
pSampleConfiguration -> channelInfo .cachingPolicy = SIGNALING_API_CALL_CACHE_TYPE_FILE ;
891
906
pSampleConfiguration -> channelInfo .cachingPeriod = SIGNALING_API_CALL_CACHE_TTL_SENTINEL_VALUE ;
892
907
pSampleConfiguration -> channelInfo .asyncIceServerConfig = TRUE; // has no effect
@@ -901,7 +916,7 @@ STATUS createSampleConfiguration(PCHAR channelName, SIGNALING_CHANNEL_ROLE_TYPE
901
916
pSampleConfiguration -> signalingClientCallbacks .customData = (UINT64 ) pSampleConfiguration ;
902
917
903
918
pSampleConfiguration -> clientInfo .version = SIGNALING_CLIENT_INFO_CURRENT_VERSION ;
904
- pSampleConfiguration -> clientInfo .loggingLevel = logLevel ;
919
+ pSampleConfiguration -> clientInfo .loggingLevel = pCreateSampleConfigurationParams -> logLevel ;
905
920
pSampleConfiguration -> clientInfo .cacheFilePath = NULL ; // Use the default path
906
921
pSampleConfiguration -> clientInfo .signalingClientCreationMaxRetryAttempts = CREATE_SIGNALING_CLIENT_RETRY_ATTEMPTS_SENTINEL_VALUE ;
907
922
pSampleConfiguration -> iceCandidatePairStatsTimerId = MAX_UINT32 ;
0 commit comments