Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration options for RL-based CC and GCC on AlphaRTC #94

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.DS_Store
*.Makefile
*.host.mk
*.ncb
*.ninja
Expand Down Expand Up @@ -77,3 +76,8 @@
target/
src/
.gclient_entries
.gclient_previous_sync_commits
outvideo*
outaudio*
*.log

20 changes: 20 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3110,6 +3110,26 @@ hooks = [
'--bucket', 'chromium-webrtc-resources',
'src/resources'],
},
{
'name': 'noise_tracks',
'pattern': '.',
'action': [ "download_from_google_storage",
"--no_resume",
"--no_auth",
"--bucket", "chromium-webrtc-resources",
"-s", "resources/audio_processing/test/py_quality_assessment/noise_tracks/city.wav.sha1",
],
},
{
'name': 'probing_signals',
'pattern': '.',
'action': [ "download_from_google_storage",
"--no_resume",
"--no_auth",
"--bucket", "chromium-webrtc-resources",
"-s", "resources/audio_processing/test/py_quality_assessment/probing_signals/tone-880.wav.sha1",
],
},
]

recursedeps = []
Expand Down
33 changes: 11 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ target_lib_dir := $(target_dir)/lib
target_bin_dir := $(target_dir)/bin
target_pylib_dir := $(target_dir)/pylib

compile_docker := alphartc-compile
release_docker := alphartc
compile_docker := gcc-compile
release_docker := gcc

host_workdir := `pwd`
docker_homedir := /app/AlphaRTC/
Expand All @@ -22,45 +22,34 @@ all: init sync app release
init:
docker build dockers --build-arg UID=$(shell id -u) --build-arg GUID=$(shell id -g) -f $(build_dockerfile) -t $(compile_docker)

release:
docker build $(target_dir) -f $(release_dockerfile) -t $(release_docker)

sync:
docker run $(docker_flags) $(compile_docker) \
make docker-$@ \
output_dir=$(output_dir) \
gn_flags=$(gn_flags)

app: peerconnection_serverless

peerconnection_serverless:
app:
docker run $(docker_flags) $(compile_docker) \
make docker-$@ \
output_dir=$(output_dir) \
target_lib_dir=$(target_lib_dir) \
target_bin_dir=$(target_bin_dir) \
target_pylib_dir=$(target_pylib_dir)

# Docker internal command
release:
docker build $(target_dir) -f $(release_dockerfile) -t $(release_docker)


# Docker internal command
docker-sync:
gclient sync
mv -fvn src/* .
rm -rf src
gn gen $(output_dir) $(gn_flags)

docker-app: docker-peerconnection_serverless

docker-peerconnection_serverless:
ninja -C $(output_dir) peerconnection_serverless

mkdir -p $(target_lib_dir)
cp modules/third_party/onnxinfer/lib/*.so $(target_lib_dir)
cp modules/third_party/onnxinfer/lib/*.so.* $(target_lib_dir)
docker-app:
ninja -C $(output_dir) peerconnection_challenge_client

mkdir -p $(target_bin_dir)
cp $(output_dir)/peerconnection_serverless $(target_bin_dir)/peerconnection_serverless.origin
cp examples/peerconnection/serverless/peerconnection_serverless $(target_bin_dir)

mkdir -p $(target_pylib_dir)
cp modules/third_party/cmdinfer/*.py $(target_pylib_dir)/
cp $(output_dir)/peerconnection_challenge_client $(target_bin_dir)/peerconnection_serverless_gcc
cp $(output_dir)/peerconnection_challenge_client peerconnection_serverless_gcc
11 changes: 4 additions & 7 deletions api/transport/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,17 @@ rtc_source_set("datagram_transport_interface") {
]
}

# Revision for enabling AlphaCC and disabling GCC
rtc_static_library("alpha_cc") {
rtc_library("goog_cc") {
visibility = [ "*" ]
sources = [
"alpha_cc_factory.cc",
"alpha_cc_factory.h",
"goog_cc_factory.cc",
"goog_cc_factory.h",
]
deps = [
":network_control",
":webrtc_key_value_config",
"..:network_state_predictor_api",
"../../modules/congestion_controller/alpha_cc",
"//third_party/abseil-cpp/absl/memory",
# "../../modules/congestion_controller/goog_cc",
"../../modules/congestion_controller/goog_cc",
"../../rtc_base:deprecation",
]
}
Expand Down
20 changes: 10 additions & 10 deletions api/transport/alpha_cc_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@
#include "rtc_base/logging.h"

namespace webrtc {
GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
AlphaCcNetworkControllerFactory::AlphaCcNetworkControllerFactory(
RtcEventLog* event_log)
: event_log_(event_log) {}

GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
AlphaCcNetworkControllerFactory::AlphaCcNetworkControllerFactory(
NetworkStatePredictorFactoryInterface* network_state_predictor_factory) {
factory_config_.network_state_predictor_factory =
network_state_predictor_factory;
}

GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
GoogCcFactoryConfig config)
AlphaCcNetworkControllerFactory::AlphaCcNetworkControllerFactory(
AlphaCcFactoryConfig config)
: factory_config_(std::move(config)) {}

std::unique_ptr<NetworkControllerInterface>
GoogCcNetworkControllerFactory::Create(NetworkControllerConfig config) {
AlphaCcNetworkControllerFactory::Create(NetworkControllerConfig config) {
if (event_log_)
config.event_log = event_log_;
GoogCcConfig goog_cc_config;
AlphaCcConfig goog_cc_config;
goog_cc_config.feedback_only = factory_config_.feedback_only;
if (factory_config_.network_state_estimator_factory) {
RTC_DCHECK(config.key_value_config);
Expand All @@ -48,18 +48,18 @@ GoogCcNetworkControllerFactory::Create(NetworkControllerConfig config) {
factory_config_.network_state_predictor_factory
->CreateNetworkStatePredictor();
}
return std::make_unique<GoogCcNetworkController>(config,
return std::make_unique<AlphaCcNetworkController>(config,
std::move(goog_cc_config));
}

TimeDelta GoogCcNetworkControllerFactory::GetProcessInterval() const {
TimeDelta AlphaCcNetworkControllerFactory::GetProcessInterval() const {
const int64_t kUpdateIntervalMs = 25;
return TimeDelta::Millis(kUpdateIntervalMs);
}

GoogCcFeedbackNetworkControllerFactory::GoogCcFeedbackNetworkControllerFactory(
AlphaCcFeedbackNetworkControllerFactory::AlphaCcFeedbackNetworkControllerFactory(
RtcEventLog* event_log)
: GoogCcNetworkControllerFactory(event_log) {
: AlphaCcNetworkControllerFactory(event_log) {
factory_config_.feedback_only = true;
}

Expand Down
22 changes: 11 additions & 11 deletions api/transport/alpha_cc_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,40 @@
namespace webrtc {
class RtcEventLog;

struct GoogCcFactoryConfig {
struct AlphaCcFactoryConfig {
std::unique_ptr<NetworkStateEstimatorFactory>
network_state_estimator_factory = nullptr;
NetworkStatePredictorFactoryInterface* network_state_predictor_factory =
nullptr;
bool feedback_only = false;
};

class GoogCcNetworkControllerFactory
class AlphaCcNetworkControllerFactory
: public NetworkControllerFactoryInterface {
public:
GoogCcNetworkControllerFactory() = default;
explicit RTC_DEPRECATED GoogCcNetworkControllerFactory(
AlphaCcNetworkControllerFactory() = default;
explicit RTC_DEPRECATED AlphaCcNetworkControllerFactory(
RtcEventLog* event_log);
explicit GoogCcNetworkControllerFactory(
explicit AlphaCcNetworkControllerFactory(
NetworkStatePredictorFactoryInterface* network_state_predictor_factory);

explicit GoogCcNetworkControllerFactory(GoogCcFactoryConfig config);
explicit AlphaCcNetworkControllerFactory(AlphaCcFactoryConfig config);
std::unique_ptr<NetworkControllerInterface> Create(
NetworkControllerConfig config) override;
TimeDelta GetProcessInterval() const override;

protected:
RtcEventLog* const event_log_ = nullptr;
GoogCcFactoryConfig factory_config_;
AlphaCcFactoryConfig factory_config_;
};

// Deprecated, use GoogCcFactoryConfig to enable feedback only mode instead.
// Deprecated, use AlphaCcFactoryConfig to enable feedback only mode instead.
// Factory to create packet feedback only GoogCC, this can be used for
// connections providing packet receive time feedback but no other reports.
class RTC_DEPRECATED GoogCcFeedbackNetworkControllerFactory
: public GoogCcNetworkControllerFactory {
class RTC_DEPRECATED AlphaCcFeedbackNetworkControllerFactory
: public AlphaCcNetworkControllerFactory {
public:
explicit GoogCcFeedbackNetworkControllerFactory(RtcEventLog* event_log);
explicit AlphaCcFeedbackNetworkControllerFactory(RtcEventLog* event_log);
};

} // namespace webrtc
Expand Down
65 changes: 65 additions & 0 deletions api/transport/goog_cc_factory.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/

#include "api/transport/goog_cc_factory.h"

#include <memory>
#include <utility>

#include "modules/congestion_controller/goog_cc/goog_cc_network_control.h"

namespace webrtc {
GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
RtcEventLog* event_log)
: event_log_(event_log) {}

GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
NetworkStatePredictorFactoryInterface* network_state_predictor_factory) {
factory_config_.network_state_predictor_factory =
network_state_predictor_factory;
}

GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
GoogCcFactoryConfig config)
: factory_config_(std::move(config)) {}

std::unique_ptr<NetworkControllerInterface>
GoogCcNetworkControllerFactory::Create(NetworkControllerConfig config) {
if (event_log_)
config.event_log = event_log_;
GoogCcConfig goog_cc_config;
goog_cc_config.feedback_only = factory_config_.feedback_only;
if (factory_config_.network_state_estimator_factory) {
RTC_DCHECK(config.key_value_config);
goog_cc_config.network_state_estimator =
factory_config_.network_state_estimator_factory->Create(
config.key_value_config);
}
if (factory_config_.network_state_predictor_factory) {
goog_cc_config.network_state_predictor =
factory_config_.network_state_predictor_factory
->CreateNetworkStatePredictor();
}
return std::make_unique<GoogCcNetworkController>(config,
std::move(goog_cc_config));
}

TimeDelta GoogCcNetworkControllerFactory::GetProcessInterval() const {
const int64_t kUpdateIntervalMs = 25;
return TimeDelta::Millis(kUpdateIntervalMs);
}

GoogCcFeedbackNetworkControllerFactory::GoogCcFeedbackNetworkControllerFactory(
RtcEventLog* event_log)
: GoogCcNetworkControllerFactory(event_log) {
factory_config_.feedback_only = true;
}

} // namespace webrtc
60 changes: 60 additions & 0 deletions api/transport/goog_cc_factory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/

#ifndef API_TRANSPORT_GOOG_CC_FACTORY_H_
#define API_TRANSPORT_GOOG_CC_FACTORY_H_
#include <memory>

#include "api/network_state_predictor.h"
#include "api/transport/network_control.h"
#include "rtc_base/deprecation.h"

namespace webrtc {
class RtcEventLog;

struct GoogCcFactoryConfig {
std::unique_ptr<NetworkStateEstimatorFactory>
network_state_estimator_factory = nullptr;
NetworkStatePredictorFactoryInterface* network_state_predictor_factory =
nullptr;
bool feedback_only = false;
};

class GoogCcNetworkControllerFactory
: public NetworkControllerFactoryInterface {
public:
GoogCcNetworkControllerFactory() = default;
explicit RTC_DEPRECATED GoogCcNetworkControllerFactory(
RtcEventLog* event_log);
explicit GoogCcNetworkControllerFactory(
NetworkStatePredictorFactoryInterface* network_state_predictor_factory);

explicit GoogCcNetworkControllerFactory(GoogCcFactoryConfig config);
std::unique_ptr<NetworkControllerInterface> Create(
NetworkControllerConfig config) override;
TimeDelta GetProcessInterval() const override;

protected:
RtcEventLog* const event_log_ = nullptr;
GoogCcFactoryConfig factory_config_;
};

// Deprecated, use GoogCcFactoryConfig to enable feedback only mode instead.
// Factory to create packet feedback only GoogCC, this can be used for
// connections providing packet receive time feedback but no other reports.
class RTC_DEPRECATED GoogCcFeedbackNetworkControllerFactory
: public GoogCcNetworkControllerFactory {
public:
explicit GoogCcFeedbackNetworkControllerFactory(RtcEventLog* event_log);
};

} // namespace webrtc

#endif // API_TRANSPORT_GOOG_CC_FACTORY_H_
Loading