From f5717ff74f4bc09a824f3a9e31906662853780ff Mon Sep 17 00:00:00 2001 From: melpon Date: Thu, 3 Oct 2024 11:18:36 +0900 Subject: [PATCH] =?UTF-8?q?Fake=20network=20=E3=81=AE=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libwebrtc の DegradedCall が削除されたので ref: https://webrtc-review.googlesource.com/c/src/+/353140 --- CHANGES.md | 2 + CMakeLists.txt | 1 - src/enable_media_with_fake_call.cpp | 68 ----------------------------- src/enable_media_with_fake_call.h | 12 ----- src/util.cpp | 52 ---------------------- src/virtual_client.h | 6 --- src/zakuro.cpp | 9 ++-- src/zakuro.h | 7 --- 8 files changed, 6 insertions(+), 151 deletions(-) delete mode 100644 src/enable_media_with_fake_call.cpp delete mode 100644 src/enable_media_with_fake_call.h diff --git a/CHANGES.md b/CHANGES.md index 5e8c662..852ec10 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,8 @@ - @melpon - [CHANGE] multistream のオプションを削除 - @torikizi +- [CHANGE] FakeNetwork 系の機能を削除 + - @melpon - [UPDATE] Sora C++ SDK を `2024.8.0` に上げる - それに伴って以下のライブラリのバージョンも上げる - libwebrtc のバージョンを `m128.6613.2.0` に上げる diff --git a/CMakeLists.txt b/CMakeLists.txt index 6210d12..b8730eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,6 @@ target_include_directories(zakuro PRIVATE ${OPENH264_ROOT_DIR}/include) target_sources(zakuro PRIVATE src/embedded_binary.cpp - src/enable_media_with_fake_call.cpp src/fake_video_capturer.cpp src/main.cpp src/nop_video_decoder.cpp diff --git a/src/enable_media_with_fake_call.cpp b/src/enable_media_with_fake_call.cpp deleted file mode 100644 index 3b7fb65..0000000 --- a/src/enable_media_with_fake_call.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "enable_media_with_fake_call.h" - -#include -#include -#include -#include - -// WebRTC -#include -#include -#include - -class MediaFactoryImpl : public webrtc::MediaFactory { - public: - MediaFactoryImpl( - std::unique_ptr p, - const webrtc::DegradedCall::TimeScopedNetworkConfig& send_config, - const webrtc::DegradedCall::TimeScopedNetworkConfig& receive_config) - : p_(std::move(p)), - send_config_(send_config), - receive_config_(receive_config) {} - MediaFactoryImpl(const MediaFactoryImpl&) = delete; - MediaFactoryImpl& operator=(const MediaFactoryImpl&) = delete; - ~MediaFactoryImpl() override = default; - - std::unique_ptr CreateCall( - const webrtc::CallConfig& config) override { - webrtc::DegradedCall::TimeScopedNetworkConfig default_config; - - bool send_config_changed = - memcmp(&send_config_, &default_config, sizeof(default_config)) != 0; - bool receive_config_changed = - memcmp(&receive_config_, &default_config, sizeof(default_config)) != 0; - - std::unique_ptr call = webrtc::Call::Create(config); - - if (send_config_changed || receive_config_changed) { - std::vector send_config = { - send_config_}; - std::vector - receive_config = {receive_config_}; - return std::make_unique( - std::move(call), send_config, receive_config); - } - - return call; - } - - std::unique_ptr CreateMediaEngine( - const webrtc::Environment& env, - webrtc::PeerConnectionFactoryDependencies& deps) override { - return p_->CreateMediaEngine(env, deps); - } - - private: - std::unique_ptr p_; - webrtc::DegradedCall::TimeScopedNetworkConfig send_config_; - webrtc::DegradedCall::TimeScopedNetworkConfig receive_config_; -}; - -void EnableMediaWithFakeCall( - webrtc::PeerConnectionFactoryDependencies& deps, - const webrtc::DegradedCall::TimeScopedNetworkConfig& send_config, - const webrtc::DegradedCall::TimeScopedNetworkConfig& receive_config) { - webrtc::EnableMedia(deps); - deps.media_factory = std::make_unique( - std::move(deps.media_factory), send_config, receive_config); -} \ No newline at end of file diff --git a/src/enable_media_with_fake_call.h b/src/enable_media_with_fake_call.h deleted file mode 100644 index 4b342ac..0000000 --- a/src/enable_media_with_fake_call.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ENABLE_MEDIA_WITH_FAKE_CALL_H_ -#define ENABLE_MEDIA_WITH_FAKE_CALL_H_ - -#include -#include - -void EnableMediaWithFakeCall( - webrtc::PeerConnectionFactoryDependencies& deps, - const webrtc::DegradedCall::TimeScopedNetworkConfig& send_config, - const webrtc::DegradedCall::TimeScopedNetworkConfig& receive_config); - -#endif \ No newline at end of file diff --git a/src/util.cpp b/src/util.cpp index b8e6f16..03b6935 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -259,58 +259,6 @@ void Util::ParseArgs(const std::vector& cargs, "DataChannels (default: none)") ->check(is_json); - // Fake network 系 - app.add_option("--fake-network-send-queue-length-packets", - config.fake_network_send.queue_length_packets, - "Queue length in number of packets for sending"); - app.add_option("--fake-network-send-queue-delay-ms", - config.fake_network_send.queue_delay_ms, - "Delay in addition to capacity induced delay for sending"); - app.add_option("--fake-network-send-delay-standard-deviation-ms", - config.fake_network_send.delay_standard_deviation_ms, - "Standard deviation of the extra delay for sending"); - app.add_option("--fake-network-send-link-capacity-kbps", - config.fake_network_send.link_capacity_kbps, - "Link capacity in kbps for sending"); - app.add_option("--fake-network-send-loss-percent", - config.fake_network_send.loss_percent, - "Random packet loss for sending"); - app.add_option("--fake-network-send-allow-reordering", - config.fake_network_send.allow_reordering, - "If packets are allowed to be reordered for sending") - ->transform(CLI::CheckedTransformer(bool_map, CLI::ignore_case)); - app.add_option("--fake-network-send-avg-burst-loss-length", - config.fake_network_send.avg_burst_loss_length, - "The average length of a burst of lost packets for sending"); - app.add_option("--fake-network-send-packet-overhead", - config.fake_network_send.packet_overhead, - "Additional bytes to add to packet size for sending"); - app.add_option("--fake-network-receive-queue-length-packets", - config.fake_network_receive.queue_length_packets, - "Queue length in number of packets for receiving"); - app.add_option("--fake-network-receive-queue-delay-ms", - config.fake_network_receive.queue_delay_ms, - "Delay in addition to capacity induced delay for receiving"); - app.add_option("--fake-network-receive-delay-standard-deviation-ms", - config.fake_network_receive.delay_standard_deviation_ms, - "Standard deviation of the extra delay for receiving"); - app.add_option("--fake-network-receive-link-capacity-kbps", - config.fake_network_receive.link_capacity_kbps, - "Link capacity in kbps for receiving"); - app.add_option("--fake-network-receive-loss-percent", - config.fake_network_receive.loss_percent, - "Random packet loss for receiving"); - app.add_option("--fake-network-receive-allow-reordering", - config.fake_network_receive.allow_reordering, - "If packets are allowed to be reordered for receiving") - ->transform(CLI::CheckedTransformer(bool_map, CLI::ignore_case)); - app.add_option("--fake-network-receive-avg-burst-loss-length", - config.fake_network_receive.avg_burst_loss_length, - "The average length of a burst of lost packets for receiving"); - app.add_option("--fake-network-receive-packet-overhead", - config.fake_network_receive.packet_overhead, - "Additional bytes to add to packet size for receiving"); - try { app.parse(args); } catch (const CLI::ParseError& e) { diff --git a/src/virtual_client.h b/src/virtual_client.h index c842676..bd8dea9 100644 --- a/src/virtual_client.h +++ b/src/virtual_client.h @@ -6,9 +6,6 @@ // Sora C++ SDK #include -// WebRTC -#include - // Boost #include @@ -55,9 +52,6 @@ struct VirtualClientConfig { int sample_rate; int channels; - webrtc::DegradedCall::TimeScopedNetworkConfig fake_network_send; - webrtc::DegradedCall::TimeScopedNetworkConfig fake_network_receive; - std::string openh264; std::shared_ptr context; diff --git a/src/zakuro.cpp b/src/zakuro.cpp index e9408cf..58941f4 100644 --- a/src/zakuro.cpp +++ b/src/zakuro.cpp @@ -8,11 +8,13 @@ #include #include +// WebRTC +#include + // Sora C++ SDK #include #include -#include "enable_media_with_fake_call.h" #include "fake_audio_key_trigger.h" #include "fake_video_capturer.h" #include "game/game_kuzushi.h" @@ -280,8 +282,6 @@ int Zakuro::Run() { vc_config.fixed_resolution = config_.fixed_resolution; vc_config.priority = config_.priority; vc_config.openh264 = config_.openh264; - vc_config.fake_network_send = config_.fake_network_send; - vc_config.fake_network_receive = config_.fake_network_receive; vc_config.initial_mute_video = config_.initial_mute_video; vc_config.initial_mute_audio = config_.initial_mute_audio; if (config_.no_audio_device) { @@ -365,8 +365,7 @@ int Zakuro::Run() { std::move(sw_config)); dependencies.video_decoder_factory.reset(new NopVideoDecoderFactory()); - EnableMediaWithFakeCall(dependencies, vc.fake_network_send, - vc.fake_network_receive); + webrtc::EnableMedia(dependencies); }; vc_config.context = sora::SoraClientContext::Create(context_config); diff --git a/src/zakuro.h b/src/zakuro.h index ff6aeea..17a0a6f 100644 --- a/src/zakuro.h +++ b/src/zakuro.h @@ -5,10 +5,6 @@ #include #include -// WebRTC -#include -#include - // Boost #include #include @@ -79,9 +75,6 @@ struct ZakuroConfig { boost::json::value sora_signaling_notify_metadata; boost::json::value sora_data_channels; - webrtc::DegradedCall::TimeScopedNetworkConfig fake_network_send; - webrtc::DegradedCall::TimeScopedNetworkConfig fake_network_receive; - std::shared_ptr key_core; std::shared_ptr stats;