21 #include <aws/core/auth/AWSCredentialsProviderChain.h> 22 #include <kinesis-video-producer/Auth.h> 23 #include <kinesis-video-producer/ClientCallbackProvider.h> 24 #include <kinesis-video-producer/DefaultCallbackProvider.h> 25 #include <kinesis-video-producer/DefaultDeviceInfoProvider.h> 27 #define AWS_ACCESS_KEY_ENV_VAR "AWS_ACCESS_KEY_ID" 28 #define AWS_SECRET_KEY_ENV_VAR "AWS_SECRET_ACCESS_KEY" 29 #define AWS_SESSION_TOKEN_ENV_VAR "AWS_SESSION_TOKEN" 30 #define AWS_DEFAULT_CREDENTIAL_ROTATION_PERIOD_IN_SECONDS (2400) 51 default_aws_credentials_provider =
nullptr)
53 if (default_aws_credentials_provider) {
57 Aws::MakeShared<Auth::DefaultAWSCredentialsProviderChain>(__func__);
64 void updateCredentials(com::amazonaws::kinesis::video::Credentials & producer_sdk_credentials)
override 66 Auth::AWSCredentials aws_sdk_credentials =
67 default_aws_credentials_provider_->GetAWSCredentials();
68 producer_sdk_credentials.setAccessKey(aws_sdk_credentials.GetAWSAccessKeyId().c_str());
69 producer_sdk_credentials.setSecretKey(aws_sdk_credentials.GetAWSSecretKey().c_str());
70 producer_sdk_credentials.setSessionToken(aws_sdk_credentials.GetSessionToken().c_str());
71 auto now = std::chrono::duration_cast<std::chrono::seconds>(
72 std::chrono::system_clock::now().time_since_epoch());
73 auto refresh_interval = std::chrono::duration_cast<std::chrono::seconds>(
74 std::chrono::milliseconds(Auth::REFRESH_THRESHOLD));
75 producer_sdk_credentials.setExpiration(now + refresh_interval);
82 UINT64 getCallbackCustomData()
override;
83 StorageOverflowPressureFunc getStorageOverflowPressureCallback()
override;
84 static STATUS storageOverflowPressure(UINT64 custom_handle, UINT64 remaining_bytes);
90 UINT64 getCallbackCustomData()
override;
91 StreamConnectionStaleFunc getStreamConnectionStaleCallback()
override;
92 StreamErrorReportFunc getStreamErrorReportCallback()
override;
93 DroppedFrameReportFunc getDroppedFrameReportCallback()
override;
96 static STATUS streamConnectionStaleHandler(UINT64 custom_data, STREAM_HANDLE stream_handle,
97 UINT64 last_buffering_ack);
98 static STATUS streamErrorReportHandler(UINT64 custom_data, STREAM_HANDLE stream_handle,
99 UPLOAD_HANDLE upload_handle, UINT64 errored_timecode,
101 static STATUS droppedFrameReportHandler(UINT64 custom_data, STREAM_HANDLE stream_handle,
102 UINT64 dropped_frame_timecode);
void updateCredentials(com::amazonaws::kinesis::video::Credentials &producer_sdk_credentials) override
std::unique_ptr< com::amazonaws::kinesis::video::CredentialProvider > CreateDefaultCredentialProvider()
std::shared_ptr< Auth::DefaultAWSCredentialsProviderChain > default_aws_credentials_provider_
ProducerSdkAWSCredentialsProvider(std::shared_ptr< Auth::DefaultAWSCredentialsProviderChain > default_aws_credentials_provider=nullptr)