Skip to content

Commit 2b627a1

Browse files
added kvs retention period arg (#1119)
1 parent 441c4fc commit 2b627a1

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

adapters/gst/sinks/multistream_kvs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def __init__(self):
7575
class Config:
7676
def __init__(self):
7777
self.allow_create_stream = opt_config('ALLOW_CREATE_STREAM', False, strtobool)
78+
self.retention_period_hours = opt_config('RETENTION_PERIOD_HOURS', 24, int)
7879
self.stream_name_prefix = opt_config('STREAM_NAME_PREFIX', '')
7980
self.kvssdk_loglevel = os.environ.get('KVSSDK_LOGLEVEL', 'INFO')
8081
self.zmq: ZmqConfig = ZmqConfig()
@@ -108,6 +109,7 @@ def __init__(
108109
round(Fraction(frame_params.framerate)),
109110
config.buffer.low_threshold,
110111
config.buffer.high_threshold,
112+
config.retention_period_hours,
111113
)
112114
self.stream_started = False
113115

libs/pykvssdk/pykvssdk/consts.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#define TIME_100NS_TO_1S (TIME_100NS_TO_1MS * 1000)
99

1010
// Defaults
11-
#define DEFAULT_RETENTION_PERIOD std::chrono::hours(24)
1211
#define DEFAULT_MAX_LATENCY std::chrono::seconds(10)
1312
#define DEFAULT_FRAGMENT_DURATION std::chrono::seconds(20)
1413
#define DEFAULT_TIMECODE_SCALE std::chrono::milliseconds(1)

libs/pykvssdk/pykvssdk/kvs_wrapper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ KvsWrapper::KvsWrapper(
2121
bool allow_stream_creation,
2222
uint32_t framerate,
2323
uint32_t low_threshold,
24-
uint32_t high_threshold
24+
uint32_t high_threshold,
25+
uint32_t retention_period_hours
2526
) {
2627
std::string content_type, codec_id;
2728
if (codec == "h264") {
@@ -69,7 +70,7 @@ KvsWrapper::KvsWrapper(
6970
std::unique_ptr<video::StreamDefinition> stream_definition(
7071
new video::StreamDefinition(
7172
stream_name,
72-
DEFAULT_RETENTION_PERIOD,
73+
std::chrono::hours(retention_period_hours),
7374
nullptr, // tags
7475
"", // kms_key_id
7576
STREAMING_TYPE_OFFLINE,

libs/pykvssdk/pykvssdk/kvs_wrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class KvsWrapper {
2121
bool allow_stream_creation,
2222
uint32_t framerate,
2323
uint32_t low_threshold,
24-
uint32_t high_threshold
24+
uint32_t high_threshold,
25+
uint32_t retention_period_hours = 24
2526
);
2627

2728
bool start(const char *codec_private_data, size_t codec_private_data_size);

libs/pykvssdk/pykvssdk/pykvssink.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,19 @@ PYBIND11_MODULE(pykvssdk, m) {
2222
bool,
2323
uint32_t,
2424
uint32_t,
25+
uint32_t,
2526
uint32_t
26-
>()
27+
>(),
28+
py::arg("region"),
29+
py::arg("access_key"),
30+
py::arg("secret_key"),
31+
py::arg("stream_name"),
32+
py::arg("codec"),
33+
py::arg("allow_stream_creation"),
34+
py::arg("framerate"),
35+
py::arg("low_threshold"),
36+
py::arg("high_threshold"),
37+
py::arg("retention_period_hours") = 24
2738
)
2839
.def("start", &KvsWrapper::start)
2940
.def("stop_sync", &KvsWrapper::stop_sync)

0 commit comments

Comments
 (0)