diff --git a/docs/linux.md b/docs/linux.md index 91dded6d..a1e92a3e 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -12,7 +12,15 @@ Define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables with th export AWS_ACCESS_KEY_ID=YourAccessKeyId export AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ``` -optionally, set `AWS_SESSION_TOKEN` if integrating with temporary token and `AWS_DEFAULT_REGION` for the region other than `us-west-2` +optionally, set `AWS_SESSION_TOKEN` if integrating with temporary token. + +#### Setting region + +If using kvssink, the region can be set in 2 ways: +1. Set `AWS_DEFAULT_REGION` to the desired region, or, +2. Set the `aws-region` property. + +If `aws-region` and `AWS_DEFAULT_REGION` are set, the `aws-region` property would be used instead of the env. ###### Discovering audio and video devices available in your system. Run the `gst-device-monitor-1.0` command to identify available media devices in your system. An example output as follows: diff --git a/docs/macos.md b/docs/macos.md index 430a204b..297c9542 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -6,7 +6,14 @@ Define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables with th export AWS_ACCESS_KEY_ID=YourAccessKeyId export AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ``` -optionally, set `AWS_SESSION_TOKEN` if integrating with temporary token and `AWS_DEFAULT_REGION` for the region other than `us-west-2` + +#### Setting region + +If using kvssink, the region can be set in 2 ways: +1. Set `AWS_DEFAULT_REGION` to the desired region, or, +2. Set the `aws-region` property. + +If `aws-region` and `AWS_DEFAULT_REGION` are set, the `aws-region` property would be used instead of the env. ###### Discovering available devices. Run the `gst-device-monitor-1.0` command to identify available media devices in your system. An example output as follows: @@ -139,7 +146,7 @@ gst-launch-1.0 -v souphttpsrc location="https://.../playlist.m3u8" ! hlsdemux n Change your current working directory to `build`. Launch the sample application with a stream name and a path to the file and it will start streaming. ``` -AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./kvs_gstreamer_audio_video_sample +AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey AWS_DEFAULT_REGION=YourRegion ./kvs_gstreamer_audio_video_sample ``` ##### Running the GStreamer sample application to stream audio and video from live source diff --git a/docs/raspberry-pi.md b/docs/raspberry-pi.md index ff4aa960..5c27fc13 100644 --- a/docs/raspberry-pi.md +++ b/docs/raspberry-pi.md @@ -31,7 +31,14 @@ Define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables with th export AWS_ACCESS_KEY_ID=YourAccessKeyId export AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ``` -optionally, set `AWS_SESSION_TOKEN` if integrating with temporary token and `AWS_DEFAULT_REGION` for the region other than `us-west-2` + +#### Setting region + +If using kvssink, the region can be set in 2 ways: +1. Set `AWS_DEFAULT_REGION` to the desired region, or, +2. Set the `aws-region` property. + +If `aws-region` and `AWS_DEFAULT_REGION` are set, the `aws-region` property would be used instead of the env. ##### Set GST_PLUGIN_PATH in environment variables ``` diff --git a/docs/windows.md b/docs/windows.md index 8c710930..7f703ed9 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -53,6 +53,7 @@ Device found: wasapi.device.description = "Speakers\ \(Conexant\ ISST\ Audio\)" ``` + Start sample application to send video stream to KVS using gstreamer plugin by executing the following command: 1. Before running the demo applications, set the environment by following the instructions below. @@ -117,6 +118,12 @@ gst-launch-1.0 -v filesrc location="YourAudioVideo.ts" ! tsdemux name=demux ! q set AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ``` + * If using kvssink, the region can be set in 2 ways: + 1. Set `AWS_DEFAULT_REGION` to the desired region, or, + 2. Set the `aws-region` property. + + If `aws-region` and `AWS_DEFAULT_REGION` are set, the `aws-region` property would be used instead of the env. + * Run the demo * **Example**: * Run the sample demo application for sending **webcam video** by executing ` kvs_gstreamer_sample.exe my-test-stream ` or diff --git a/src/gstreamer/gstkvssink.cpp b/src/gstreamer/gstkvssink.cpp index c1d3b77a..7bd6cd17 100644 --- a/src/gstreamer/gstkvssink.cpp +++ b/src/gstreamer/gstkvssink.cpp @@ -105,7 +105,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_kvs_sink_debug); #define DEFAULT_ACCESS_KEY "access_key" #define DEFAULT_SECRET_KEY "secret_key" #define DEFAULT_SESSION_TOKEN "session_token" -#define DEFAULT_REGION "us-west-2" +#define DEFAULT_REGION "" #define DEFAULT_ROTATION_PERIOD_SECONDS 3600 #define DEFAULT_LOG_FILE_PATH "../kvs_log_configuration" #define DEFAULT_STORAGE_SIZE_MB 128 @@ -318,12 +318,15 @@ void kinesis_video_producer_init(GstKvsSink *kvssink) session_token_str = string(kvssink->session_token); } - if (nullptr == (default_region = getenv(DEFAULT_REGION_ENV_VAR))) { - region_str = string(kvssink->aws_region); + if (IS_EMPTY_STRING(kvssink->aws_region)) { + if (nullptr == (default_region = getenv(DEFAULT_REGION_ENV_VAR))) { + LOG_AND_THROW("No region set. Either set with env " << DEFAULT_REGION_ENV_VAR << " or set kvssink property aws-region"); + } else { + region_str = string(default_region); + } } else { - region_str = string(default_region); // Use env var if both property and env var are available. + region_str = string(kvssink->aws_region); } - unique_ptr credential_provider; if (kvssink->iot_certificate) {