Adds support to change transport routes in Scenario tests.
This CL makes it possible to change transport routes while running
a scenario based test.
To make this possible in a consistent manner, the scenario test
framework is modified to only allow shared transport for all streams
between two CallClients. This is what typically is done in practice and
it is quite complex to even reason about the implications of using
mixed transports for a single call.
Bug: webrtc:9718
Change-Id: Ib836928feed98aa2bbbe0295e158157a6518348b
Reviewed-on: https://webrtc-review.googlesource.com/c/107200
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25287}
diff --git a/test/scenario/network_node.h b/test/scenario/network_node.h
index af6db0a..4e90f6f 100644
--- a/test/scenario/network_node.h
+++ b/test/scenario/network_node.h
@@ -18,10 +18,10 @@
#include "api/call/transport.h"
#include "api/units/timestamp.h"
+#include "call/call.h"
#include "call/simulated_network.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/copyonwritebuffer.h"
-#include "test/scenario/call_client.h"
#include "test/scenario/column_printer.h"
#include "test/scenario/scenario_config.h"
@@ -119,23 +119,30 @@
class NetworkNodeTransport : public Transport {
public:
- NetworkNodeTransport(CallClient* sender,
- NetworkNode* send_net,
- uint64_t receiver,
- DataSize packet_overhead);
+ NetworkNodeTransport(const Clock* sender_clock, Call* sender_call);
~NetworkNodeTransport() override;
bool SendRtp(const uint8_t* packet,
size_t length,
const PacketOptions& options) override;
bool SendRtcp(const uint8_t* packet, size_t length) override;
- uint64_t ReceiverId() const;
+
+ void Connect(NetworkNode* send_node,
+ uint64_t receiver_id,
+ DataSize packet_overhead);
+
+ DataSize packet_overhead() {
+ rtc::CritScope crit(&crit_sect_);
+ return packet_overhead_;
+ }
private:
- CallClient* const sender_;
- NetworkNode* const send_net_;
- const uint64_t receiver_id_;
- const DataSize packet_overhead_;
+ rtc::CriticalSection crit_sect_;
+ const Clock* const sender_clock_;
+ Call* const sender_call_;
+ NetworkNode* send_net_ RTC_GUARDED_BY(crit_sect_) = nullptr;
+ uint64_t receiver_id_ RTC_GUARDED_BY(crit_sect_) = 0;
+ DataSize packet_overhead_ RTC_GUARDED_BY(crit_sect_) = DataSize::Zero();
};
// CrossTrafficSource is created by a Scenario and generates cross traffic. It