Skip to content

Commit

Permalink
Merge pull request #33 from insight-platform/issue-32
Browse files Browse the repository at this point in the history
Issue #32. Clean up statistics configuration.
  • Loading branch information
ksenia-vazhdaeva authored Aug 6, 2024
2 parents 4ac0b4b + 82687d1 commit ca2a41b
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 31 deletions.
3 changes: 1 addition & 2 deletions benches/config/client_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"inflight_ops": 100
},
"statistics": {
"frame_period": 1000,
"history_size": 1000
"frame_period": 1000
}
}
3 changes: 1 addition & 2 deletions benches/config/server_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"fix_ipc_permissions": 511
},
"statistics": {
"frame_period": 1000,
"history_size": 1000
"frame_period": 1000
}
}
11 changes: 2 additions & 9 deletions docs/source/getting_started/0_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ tls
statistics
^^^^^^^^^^

At least one of ``frame_period`` and ``timestamp_period`` should be specified.
Exactly one of ``frame_period`` and ``timestamp_period`` must be specified.

.. list-table::
:header-rows: 1
Expand All @@ -278,9 +278,6 @@ At least one of ``frame_period`` and ``timestamp_period`` should be specified.
* - timestamp_period
- A timestamp period in the duration format with millisecond precision, e.g. ``{"secs": 1, "nanos": 0}``
- no
* - history_size
- A size of a history to be stored
- yes

Client
------
Expand Down Expand Up @@ -511,7 +508,7 @@ tls
statistics
^^^^^^^^^^

At least one of ``frame_period`` and ``timestamp_period`` should be specified.
Exactly one of ``frame_period`` and ``timestamp_period`` must be specified.

.. list-table::
:header-rows: 1
Expand All @@ -525,10 +522,6 @@ At least one of ``frame_period`` and ``timestamp_period`` should be specified.
* - timestamp_period
- A timestamp period in the duration format with millisecond precision, e.g. ``{"secs": 1, "nanos": 0}``
- no
* - history_size
- A size of a history to be stored
- yes


Environment variables in configuration files
--------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions media_gateway_common/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,4 @@ pub struct StatisticsConfiguration {
pub frame_period: Option<i64>,
/// Statistics based on timestamp period
pub timestamp_period: Option<Duration>,
/// A size of a history to be stored
pub history_size: usize,
}
8 changes: 5 additions & 3 deletions media_gateway_common/src/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ impl TryFrom<(&StatisticsConfiguration, &str)> for StatisticsService {

fn try_from(value: (&StatisticsConfiguration, &str)) -> Result<Self, Self::Error> {
let configuration = value.0;
if configuration.frame_period.is_none() && configuration.timestamp_period.is_none() {
bail!("At least one of frame_period and timestamp_period should be specified")
if configuration.frame_period.is_none() && configuration.timestamp_period.is_none()
|| configuration.frame_period.is_some() && configuration.timestamp_period.is_some()
{
bail!("Exactly one of frame_period and timestamp_period must be specified")
}
let timestamp_period = match configuration.timestamp_period {
Some(duration) => {
Expand All @@ -74,7 +76,7 @@ impl TryFrom<(&StatisticsConfiguration, &str)> for StatisticsService {
None => None,
};
let pipeline_configuration = PipelineConfigurationBuilder::default()
.collection_history(configuration.history_size)
.collection_history(2)
.timestamp_period(timestamp_period)
.frame_period(configuration.frame_period)
.build()?;
Expand Down
7 changes: 1 addition & 6 deletions samples/configuration/client/statistics_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
"inflight_ops": 100
},
"statistics": {
"frame_period": 1000,
"timestamp_period": {
"secs": 1,
"nanos": 0
},
"history_size": 1000
"frame_period": 1000
}
}
4 changes: 1 addition & 3 deletions samples/configuration/server/statistics_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
"fix_ipc_permissions": 511
},
"statistics": {
"frame_period": 1000,
"timestamp_period": {
"secs": 1,
"nanos": 0
},
"history_size": 1000
}
}
}
3 changes: 1 addition & 2 deletions samples/e2e_usage_video_loop_ao_rtsp/client_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"timestamp_period": {
"secs": 1,
"nanos": 0
},
"history_size": 1000
}
}
}
3 changes: 1 addition & 2 deletions samples/e2e_usage_video_loop_ao_rtsp/server_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"timestamp_period": {
"secs": 1,
"nanos": 0
},
"history_size": 1000
}
}
}

0 comments on commit ca2a41b

Please sign in to comment.