Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some logging #35

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gstawsapihandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Logger : public ::Aws::Utils::Logging::LogSystemInterface
using gst::aws::AwsApiHandle;

AwsApiHandle::AwsApiHandle() {
GST_CAT_DEBUG (gst_aws_s3_debug, "Initializing AWS API");
::Aws::Utils::Logging::InitializeAWSLogging(::std::make_shared<Logger>());
::Aws::SDKOptions options;
::Aws::InitAPI(options);
Expand All @@ -108,6 +109,9 @@ AwsApiHandle::~AwsApiHandle()
::std::shared_ptr<AwsApiHandle> AwsApiHandle::GetHandle()
{
static ::std::weak_ptr<AwsApiHandle> instance;
static ::std::mutex mutex;

const ::std::lock_guard<::std::mutex> lock(mutex);
if (auto ptr = instance.lock()) {
return ptr;
}
Expand Down
6 changes: 5 additions & 1 deletion src/gstawscredentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ _gst_aws_credentials_create_provider(const gchar * access_key_id, const gchar *
GST_ERROR ("Either both access-key-id and secret-access-key must be set or none of them.");
return NULL;
}
GST_DEBUG ("Using default AWS credentials provider chain");
return std::unique_ptr<AWSCredentialsProvider> (new DefaultAWSCredentialsProviderChain());
}
else
{
GST_DEBUG ("Using simple AWS credentials provider");
return std::unique_ptr<AWSCredentialsProvider> (
new SimpleAWSCredentialsProvider (AWSCredentials(access_key_id, secret_access_key, session_token ? session_token : "")));
}
Expand Down Expand Up @@ -160,8 +162,10 @@ _gst_aws_credentials_provider_from_string(const gchar * str)
return NULL;
}

if (!is_null_or_empty (iam_role))
if (!is_null_or_empty (iam_role)) {
GST_DEBUG ("Assuming role '%s'", iam_role);
provider = _gst_aws_credentials_assume_role(iam_role, std::move(provider));
}

g_strfreev (parameters);

Expand Down
5 changes: 4 additions & 1 deletion src/gsts3sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ gst_s3_sink_set_property (GObject * object, guint prop_id,
case PROP_CREDENTIALS:
if (sink->config.credentials)
gst_aws_credentials_free (sink->config.credentials);
GST_DEBUG ("Setting AWS credentials");
sink->config.credentials = gst_aws_credentials_copy (g_value_get_boxed (value));
break;
case PROP_AWS_SDK_ENDPOINT:
Expand Down Expand Up @@ -533,8 +534,10 @@ gst_s3_sink_start (GstBaseSink * basesink)
|| gst_s3_sink_is_null_or_empty (sink->config.key)))
goto no_destination;

if (!sink->config.credentials)
if (!sink->config.credentials) {
GST_DEBUG ("Using default AWS credentials");
sink->config.credentials = gst_aws_credentials_new_default ();
}

if (sink->uploader == NULL) {
sink->uploader = GST_S3_SINK_GET_CLASS((gpointer*) sink)->uploader_new (&sink->config);
Expand Down
Loading