Skip to content

Commit

Permalink
Producer time fix and install script update
Browse files Browse the repository at this point in the history
  • Loading branch information
hu committed Feb 23, 2018
1 parent 0c746ab commit d556a41
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ $ sudo reboot


## Release Notes
### Release 1.2.1 (February 2018)
* Bug fix for producer timestamp *video playback* in the console should be fixed if proper timestamp is provided to SDK. Current setting in sample app uses Gstreamer frame timecode and relative timestamp (used by SDK).
* install-script is updated to automatically detect OS version and avoid dependency issue on Mac High Sierra and Ubuntu 17.10.
* Known issue: Producer timestamp mode *video playback in console* will not work if GStreamer demoapp is configured to use frame timecode and absolute timestamp (used by SDK).
### Release 1.2.0 (February 2018)
* Bug fixes and performance enhancement
* Streaming error recovery improvements
Expand Down
16 changes: 8 additions & 8 deletions kinesis-video-gst-demo/kinesis_video_gstreamer_sample_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SampleCredentialProvider : public StaticCredentialProvider {

// Update only the expiration
auto now_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now().time_since_epoch());
std::chrono::system_clock::now().time_since_epoch());
auto expiration_seconds = now_time + ROTATION_PERIOD;
credentials.setExpiration(std::chrono::seconds(expiration_seconds.count()));
LOG_INFO("New credentials expiration is " << credentials.getExpiration().count());
Expand Down Expand Up @@ -150,7 +150,7 @@ void create_kinesis_video_frame(Frame *frame, const nanoseconds &pts, const nano
frame->flags = flags;
frame->decodingTs = static_cast<UINT64>(dts.count()) / DEFAULT_TIME_UNIT_IN_NANOS;
frame->presentationTs = static_cast<UINT64>(pts.count()) / DEFAULT_TIME_UNIT_IN_NANOS;
frame->duration = 20 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND;
frame->duration = 10 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND;
frame->size = static_cast<UINT32>(len);
frame->frameData = reinterpret_cast<PBYTE>(data);
}
Expand Down Expand Up @@ -296,12 +296,12 @@ void kinesis_video_init(CustomData *data, char *stream_name) {
milliseconds::zero(),
seconds(2),
milliseconds(1),
true,
true,
true,
true,
true,
true,
true,//Construct a fragment at each key frame
true,//Use provided frame timecode
false,//Relative timecode
true,//Ack on fragment is enabled
true,//SDK will restart when error happens
true,//recalculate_metrics
0,
30,
4 * 1024 * 1024,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace com {

// Update only the expiration
auto now_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now().time_since_epoch());
std::chrono::system_clock::now().time_since_epoch());
auto expiration_seconds = now_time + ROTATION_PERIOD;
credentials.setExpiration(std::chrono::seconds(expiration_seconds.count()));
LOG_INFO("New credentials expiration is " << credentials.getExpiration().count());
Expand Down
2 changes: 1 addition & 1 deletion kinesis-video-producer/src/Auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void CredentialProvider::getUpdatedCredentials(Credentials& credentials) {

void CredentialProvider::refreshCredentials(bool forceUpdate) {
auto now_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now().time_since_epoch());
std::chrono::system_clock::now().time_since_epoch());
// update if we've exceeded the refresh interval
if (now_time > next_rotation_time_ || forceUpdate) {
LOG_INFO("Refreshing credentials. Force refreshing: " << forceUpdate
Expand Down
12 changes: 6 additions & 6 deletions kinesis-video-producer/src/DefaultCallbackProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ STATUS DefaultCallbackProvider::getSecurityTokenHandler(UINT64 custom_data, PBYT

UINT64 DefaultCallbackProvider::getCurrentTimeHandler(UINT64 custom_data) {
UNUSED_PARAM(custom_data);
return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch())
return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch())
.count() / DEFAULT_TIME_UNIT_IN_NANOS;
}

Expand Down Expand Up @@ -136,7 +136,7 @@ STATUS DefaultCallbackProvider::createStreamHandler(

// Wait for the specified amount of time before calling
auto call_after_time = std::chrono::nanoseconds(service_call_ctx->callAfter * DEFAULT_TIME_UNIT_IN_NANOS);
auto time_point = std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> (call_after_time);
auto time_point = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> (call_after_time);
std::this_thread::sleep_until(time_point);

// Perform a sync call
Expand Down Expand Up @@ -222,7 +222,7 @@ STATUS DefaultCallbackProvider::tagResourceHandler(

// Wait for the specified amount of time before calling
auto call_after_time = std::chrono::nanoseconds(service_call_ctx->callAfter * DEFAULT_TIME_UNIT_IN_NANOS);
auto time_point = std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> (call_after_time);
auto time_point = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> (call_after_time);
std::this_thread::sleep_until(time_point);

// Perform a sync call
Expand Down Expand Up @@ -285,7 +285,7 @@ STATUS DefaultCallbackProvider::describeStreamHandler(

// Wait for the specified amount of time before calling
auto call_after_time = std::chrono::nanoseconds(service_call_ctx->callAfter * DEFAULT_TIME_UNIT_IN_NANOS);
auto time_point = std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> (call_after_time);
auto time_point = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> (call_after_time);
std::this_thread::sleep_until(time_point);

// Perform a sync call
Expand Down Expand Up @@ -411,7 +411,7 @@ STATUS DefaultCallbackProvider::streamingEndpointHandler(

// Wait for the specified amount of time before calling
auto call_after_time = std::chrono::nanoseconds(service_call_ctx->callAfter * DEFAULT_TIME_UNIT_IN_NANOS);
auto time_point = std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> (call_after_time);
auto time_point = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> (call_after_time);
std::this_thread::sleep_until(time_point);

// Perform a sync call
Expand Down Expand Up @@ -556,7 +556,7 @@ STATUS DefaultCallbackProvider::putStreamHandler(

// Wait for the specified amount of time before calling
auto call_after_time = std::chrono::nanoseconds(service_call_ctx->callAfter * DEFAULT_TIME_UNIT_IN_NANOS);
auto time_point = std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds>(call_after_time);
auto time_point = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>(call_after_time);
std::this_thread::sleep_until(time_point);

LOG_INFO("Creating new connection for Kinesis Video stream: " << stream_name_str);
Expand Down
1 change: 0 additions & 1 deletion kinesis-video-producer/src/KinesisVideoProducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ unique_ptr<KinesisVideoProducer> KinesisVideoProducer::create(
override_callbacks.clientReadyFn = KinesisVideoProducer::clientReadyFunc;
override_callbacks.streamReadyFn = KinesisVideoProducer::streamReadyFunc;


STATUS status = createKinesisVideoClient(&device_info, &override_callbacks, &client_handle);
if (STATUS_FAILED(status)) {
// Delete the producer on error
Expand Down
2 changes: 1 addition & 1 deletion kinesis-video-producer/tst/ProducerApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PVOID ProducerTestBase::basicProducerRoutine(KinesisVideoStream* kinesis_video_s
while (!stop_producer_) {
// Produce frames
timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now().time_since_epoch()).count() / DEFAULT_TIME_UNIT_IN_NANOS;
std::chrono::system_clock::now().time_since_epoch()).count() / DEFAULT_TIME_UNIT_IN_NANOS;
frame.index = index++;
frame.decodingTs = timestamp;
frame.presentationTs = timestamp;
Expand Down
2 changes: 1 addition & 1 deletion kinesis-video-producer/tst/ProducerTestFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class TestCredentialProvider : public StaticCredentialProvider {

// Update only the expiration
auto now_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now().time_since_epoch());
std::chrono::system_clock::now().time_since_epoch());
auto expiration_seconds = now_time + ROTATION_PERIOD;
credentials.setExpiration(std::chrono::seconds(expiration_seconds.count()));
LOG_INFO("New credentials expiration is " << credentials.getExpiration().count());
Expand Down

0 comments on commit d556a41

Please sign in to comment.