diff options
author | Jordan Bayles <jophba@chromium.org> | 2021-03-29 18:43:14 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-30 16:13:53 +0000 |
commit | 5d3785cc3ab458837068f38e3d65482657fd4f76 (patch) | |
tree | c065bf75e27b9262a0e5ec243206db824d150ecd | |
parent | ed4033b0da1ac45bd37a85659651868bcf462572 (diff) | |
download | openscreen-5d3785cc3ab458837068f38e3d65482657fd4f76.tar.gz |
[Cast] Fix Standalone Sender/Receiver
Over the last year, the standalone sender and receiver applications have
gone through some major changes, and unfortunately a few regressions
have been introduced.
This patch fixes the poor performance. This was actually caused by a "fix" to the
PlatformClientPosix implementation, where we were using inappropriate
values for network looping (50ms, which is an eternity).
Bug: b/182937147
Change-Id: I39af927401ce940b81829e5b2992e06bc544ef01
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2792912
Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
Commit-Queue: Jordan Bayles <jophba@chromium.org>
-rw-r--r-- | cast/standalone_receiver/main.cc | 4 | ||||
-rw-r--r-- | cast/standalone_sender/main.cc | 4 | ||||
-rw-r--r-- | platform/impl/platform_client_posix.h | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/cast/standalone_receiver/main.cc b/cast/standalone_receiver/main.cc index 1263f39c..9faee412 100644 --- a/cast/standalone_receiver/main.cc +++ b/cast/standalone_receiver/main.cc @@ -230,7 +230,9 @@ int RunStandaloneReceiver(int argc, char* argv[]) { } auto* const task_runner = new TaskRunnerImpl(&Clock::now); - PlatformClientPosix::Create(milliseconds(50), milliseconds(50), + // Cast has high networking demands--network operation timing and timeout must + // be kept extremely small. + PlatformClientPosix::Create(microseconds(50), microseconds(50), std::unique_ptr<TaskRunnerImpl>(task_runner)); RunCastService(task_runner, interface, std::move(creds.value()), friendly_name, model_name, discovery_enabled); diff --git a/cast/standalone_sender/main.cc b/cast/standalone_sender/main.cc index da7ed24c..7479adc1 100644 --- a/cast/standalone_sender/main.cc +++ b/cast/standalone_sender/main.cc @@ -174,7 +174,9 @@ int StandaloneSenderMain(int argc, char* argv[]) { #endif auto* const task_runner = new TaskRunnerImpl(&Clock::now); - PlatformClientPosix::Create(milliseconds(50), milliseconds(50), + // Cast has high networking demands--network operation timing and timeout must + // be kept extremely small. + PlatformClientPosix::Create(microseconds(50), microseconds(50), std::unique_ptr<TaskRunnerImpl>(task_runner)); IPEndpoint remote_endpoint = ParseAsEndpoint(iface_or_endpoint); diff --git a/platform/impl/platform_client_posix.h b/platform/impl/platform_client_posix.h index 6bda424b..9f086f58 100644 --- a/platform/impl/platform_client_posix.h +++ b/platform/impl/platform_client_posix.h @@ -9,6 +9,7 @@ #include <memory> #include <mutex> #include <thread> +#include <vector> #include "absl/types/optional.h" #include "platform/api/time.h" @@ -41,7 +42,8 @@ class PlatformClientPosix { // |networking_loop_interval| sets the minimum amount of time that should pass // between iterations of the loop used to handle networking operations. Higher // values will result in less time being spent on these operations, but also - // potentially less performant networking operations. + // less performant networking operations. Be careful setting values larger + // than a few hundred microseconds. // // |networking_operation_timeout| sets how much time may be spent on a // single networking operation type. |