File tree Expand file tree Collapse file tree 5 files changed +19
-5
lines changed
Expand file tree Collapse file tree 5 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ def __init__(self):
7575class 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
Original file line number Diff line number Diff line change 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 )
Original file line number Diff line number Diff 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,
Original file line number Diff line number Diff 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);
Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments