Skip to content

Commit

Permalink
Update to roc-toolkit 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed Jun 14, 2024
1 parent cc73fa5 commit c7be60a
Show file tree
Hide file tree
Showing 16 changed files with 477 additions and 832 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v0.0.2][v0.0.2] - 14 Jun 2024

* Use roc-toolkit from master
* Fix compatibility with roc-toolkit 0.4
* Update documentation

[v0.0.2]: https://github.com/roc-streaming/roc-vad/releases/tag/v0.0.2

## [v0.0.1][v0.0.1] - 09 May 2024

* Initial release
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ When you create sender virtual device using `roc-vad device add sender`, the fol
| --latency-backend | disabled | latency tuner backend (default, niq) | for sender-side latency tuner |
| --latency-profile | disabled | latency tuner profile (default, intact, responsive, gradual) | for sender-side latency tuner |
| --target-latency | disabled | target latency (e.g. 123ms) | for sender-side latency tuner |
| --min-latency | disabled | minimum latency (e.g. 123ms) | for sender-side latency tuner |
| --max-latency | disabled | maximum latency (e.g. 123ms) | for sender-side latency tuner |
| --latency-tolerance | disabled | maximum latency deviation (e.g. 123ms) | for sender-side latency tuner |

### Receiver options

Expand All @@ -494,8 +493,7 @@ When you create receiver virtual device using `roc-vad device add receiver`, the
| --latency-backend | selected automatically | latency tuner backend (default, niq) | |
| --latency-profile | selected automatically | latency tuner profile (default, intact, responsive, gradual) | |
| --target-latency | 200ms | target latency (e.g. 123ms) | |
| --min-latency | selected automatically | minimum latency (e.g. 123ms) | |
| --max-latency | selected automatically | maximum latency (e.g. 123ms) | |
| --latency-tolerance | selected automatically | maximum latency deviation (e.g. 123ms) | |
| --no-play-timeout | selected automatically | no playback timeout (e.g. 123ms) | |
| --choppy-play-timeout | selected automatically | choppy playback timeout (e.g. 123ms) | |

Expand Down Expand Up @@ -582,8 +580,7 @@ Both sender and receiver latency is affected by `--device-buffer` option, which
Receiver-side parameters essential for latency are:

* `--target-latency` - which latency should be maintained
* `--min-latency` - which minimum latency causes session restart
* `--max-latency` - which maximum latency causes session restart
* `--latency-tolerance` - maximum allowed deviation of current latency from target

You can also force specific latency tuner settings (by default they're auto-selected based on target latency):

Expand Down
6 changes: 2 additions & 4 deletions RPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ Parameters of receiver device.
| resampler_backend | [RvResamplerBackend](#rvpb-RvResamplerBackend) | optional | Resampling algorithm. Keep unset to use default. |
| resampler_profile | [RvResamplerProfile](#rvpb-RvResamplerProfile) | optional | Resampling quality. Keep unset to use default. |
| target_latency | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Target latency. Keep unset to use default. |
| min_latency | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Minimum latency. Keep unset to use default. |
| max_latency | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Maximum latency. Keep unset to use default. |
| latency_tolerance | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Maximum deviation of latency from target. Keep unset to disable. |
| no_playback_timeout | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Timeout for the lack of playback. Keep unset to use default. |
| choppy_playback_timeout | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Timeout for choppy playback. Keep unset to use default. |

Expand Down Expand Up @@ -253,8 +252,7 @@ Parameters of sender device.
| resampler_backend | [RvResamplerBackend](#rvpb-RvResamplerBackend) | optional | Resampling algorithm. Keep unset to use default. |
| resampler_profile | [RvResamplerProfile](#rvpb-RvResamplerProfile) | optional | Resampling quality. Keep unset to use default. |
| target_latency | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Target latency. Use only if you need sender-side latency tuning. Keep unset to disable. |
| min_latency | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Minimum latency. Use only if you need sender-side latency tuning. Keep unset to disable. |
| max_latency | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Maximum latency. Use only if you need sender-side latency tuning. Keep unset to disable. |
| latency_tolerance | [google.protobuf.Duration](#google-protobuf-Duration) | optional | Maximum deviation of latency from target. Use only if you need sender-side latency tuning. Keep unset to disable. |



Expand Down
2 changes: 1 addition & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(SCONS_CMD
)
ExternalProject_Add(roc_lib
GIT_REPOSITORY "https://github.com/roc-streaming/roc-toolkit.git"
GIT_TAG "8f75c4b336f81bfaa13229e3605697b180154929"
GIT_TAG "master"
GIT_SHALLOW OFF
GIT_PROGRESS ON
UPDATE_DISCONNECTED ON
Expand Down
6 changes: 2 additions & 4 deletions driver/device_defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ struct DeviceSenderConfig
roc_resampler_profile resampler_profile = ROC_RESAMPLER_PROFILE_DEFAULT;

int64_t target_latency_ns = 0;
int64_t min_latency_ns = 0;
int64_t max_latency_ns = 0;
int64_t latency_tolerance_ns = 0;
};

// Network parameters of sender device.
Expand All @@ -87,8 +86,7 @@ struct DeviceReceiverConfig
roc_resampler_profile resampler_profile = ROC_RESAMPLER_PROFILE_DEFAULT;

int64_t target_latency_ns = 0;
int64_t min_latency_ns = 0;
int64_t max_latency_ns = 0;
int64_t latency_tolerance_ns = 0;

int64_t no_playback_timeout_ns = 0;
int64_t choppy_playback_timeout_ns = 0;
Expand Down
3 changes: 1 addition & 2 deletions driver/receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ Receiver::Receiver(const std::string& device_uid,
net_receiver_config.resampler_profile = device_receiver_config.resampler_profile;

net_receiver_config.target_latency = device_receiver_config.target_latency_ns;
net_receiver_config.min_latency = device_receiver_config.min_latency_ns;
net_receiver_config.max_latency = device_receiver_config.max_latency_ns;
net_receiver_config.latency_tolerance = device_receiver_config.latency_tolerance_ns;

net_receiver_config.no_playback_timeout =
device_receiver_config.no_playback_timeout_ns;
Expand Down
51 changes: 17 additions & 34 deletions driver/rpc_serdes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,11 @@ void device_info_from_rpc(DeviceInfo& out, const rvpb::RvDeviceInfo& in)
"RvSenderConfig.target_latency", in.sender_config().target_latency());
}

// min_latency
if (in.sender_config().has_min_latency()) {
out.sender_config->min_latency_ns = nanoseconds_from_rpc(
"RvSenderConfig.min_latency", in.sender_config().min_latency());
}

// max_latency
if (in.sender_config().has_max_latency()) {
out.sender_config->max_latency_ns = nanoseconds_from_rpc(
"RvSenderConfig.max_latency", in.sender_config().max_latency());
// latency_tolerance
if (in.sender_config().has_latency_tolerance()) {
out.sender_config->latency_tolerance_ns =
nanoseconds_from_rpc("RvSenderConfig.latency_tolerance",
in.sender_config().latency_tolerance());
}
}

Expand Down Expand Up @@ -289,16 +284,11 @@ void device_info_from_rpc(DeviceInfo& out, const rvpb::RvDeviceInfo& in)
"RvReceiverConfig.target_latency", in.receiver_config().target_latency());
}

// min_latency
if (in.receiver_config().has_min_latency()) {
out.receiver_config->min_latency_ns = nanoseconds_from_rpc(
"RvReceiverConfig.min_latency", in.receiver_config().min_latency());
}

// max_latency
if (in.receiver_config().has_max_latency()) {
out.receiver_config->max_latency_ns = nanoseconds_from_rpc(
"RvReceiverConfig.max_latency", in.receiver_config().max_latency());
// latency_tolerance
if (in.receiver_config().has_latency_tolerance()) {
out.receiver_config->latency_tolerance_ns =
nanoseconds_from_rpc("RvReceiverConfig.latency_tolerance",
in.receiver_config().latency_tolerance());
}

// no_playback_timeout
Expand Down Expand Up @@ -417,13 +407,9 @@ void device_info_to_rpc(rvpb::RvDeviceInfo& out, const DeviceInfo& in)
*out.mutable_sender_config()->mutable_target_latency() = nanoseconds_to_rpc(
"RvSenderConfig.target_latency", in.sender_config->target_latency_ns);

// min_latency
*out.mutable_sender_config()->mutable_min_latency() = nanoseconds_to_rpc(
"RvSenderConfig.min_latency", in.sender_config->min_latency_ns);

// max_latency
*out.mutable_sender_config()->mutable_max_latency() = nanoseconds_to_rpc(
"RvSenderConfig.max_latency", in.sender_config->max_latency_ns);
// latency_tolerance
*out.mutable_sender_config()->mutable_latency_tolerance() = nanoseconds_to_rpc(
"RvSenderConfig.latency_tolerance", in.sender_config->latency_tolerance_ns);
}

// receiver_config
Expand Down Expand Up @@ -468,13 +454,10 @@ void device_info_to_rpc(rvpb::RvDeviceInfo& out, const DeviceInfo& in)
*out.mutable_receiver_config()->mutable_target_latency() = nanoseconds_to_rpc(
"RvReceiverConfig.target_latency", in.receiver_config->target_latency_ns);

// min_latency
*out.mutable_receiver_config()->mutable_min_latency() = nanoseconds_to_rpc(
"RvReceiverConfig.min_latency", in.receiver_config->min_latency_ns);

// max_latency
*out.mutable_receiver_config()->mutable_max_latency() = nanoseconds_to_rpc(
"RvReceiverConfig.max_latency", in.receiver_config->max_latency_ns);
// latency_tolerance
*out.mutable_receiver_config()->mutable_latency_tolerance() =
nanoseconds_to_rpc("RvReceiverConfig.latency_tolerance",
in.receiver_config->latency_tolerance_ns);

// no_playback_timeout
*out.mutable_receiver_config()->mutable_no_playback_timeout() =
Expand Down
3 changes: 1 addition & 2 deletions driver/sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ Sender::Sender(const std::string& device_uid,
net_sender_config.resampler_profile = device_sender_config.resampler_profile;

net_sender_config.target_latency = device_sender_config.target_latency_ns;
net_sender_config.min_latency = device_sender_config.min_latency_ns;
net_sender_config.max_latency = device_sender_config.max_latency_ns;
net_sender_config.latency_tolerance = device_sender_config.latency_tolerance_ns;

if ((err = roc_sender_open(net_context_, &net_sender_config, &net_sender_)) < 0) {
throw std::invalid_argument(
Expand Down
Loading

0 comments on commit c7be60a

Please sign in to comment.