Signal Network route change in fake ice.

Fake Ice currently does not signal the network route change. Also, it is not aware of the network thread, so added a setter for a network thread.


Bug: None
Change-Id: I25326282f32d36229422eca7368b53ee7b52ec72
Reviewed-on: https://webrtc-review.googlesource.com/c/110363
Commit-Queue: Peter Slatala <psla@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25585}
This commit is contained in:
Piotr (Peter) Slatala
2018-11-09 08:37:19 -08:00
committed by Commit Bot
parent d95b0a2fbd
commit 7127f342a9

View File

@ -23,8 +23,13 @@ namespace cricket {
class FakeIceTransport : public IceTransportInternal {
public:
explicit FakeIceTransport(const std::string& name, int component)
: name_(name), component_(component) {}
explicit FakeIceTransport(const std::string& name,
int component,
rtc::Thread* network_thread = nullptr)
: name_(name),
component_(component),
network_thread_(network_thread ? network_thread
: rtc::Thread::Current()) {}
~FakeIceTransport() override {
if (dest_ && dest_->dest_ == this) {
dest_->dest_ = nullptr;
@ -239,6 +244,8 @@ class FakeIceTransport : public IceTransportInternal {
}
void SetNetworkRoute(absl::optional<rtc::NetworkRoute> network_route) {
network_route_ = network_route;
network_thread_->Invoke<void>(
RTC_FROM_HERE, [this] { SignalNetworkRouteChanged(network_route_); });
}
private:
@ -295,6 +302,7 @@ class FakeIceTransport : public IceTransportInternal {
absl::optional<rtc::NetworkRoute> network_route_;
std::map<rtc::Socket::Option, int> socket_options_;
rtc::CopyOnWriteBuffer last_sent_packet_;
rtc::Thread* const network_thread_;
};
} // namespace cricket