webrtc_m130/webrtc/base/networkroute.h
honghaiz 059e183419 Reland of "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #1 id:1 of https://codereview.webrtc.org/2098703004/ )
Reason for revert:
It turns out this revert was not necessary because the connection-state mapping for turn-turn connections was not done in connection.

Original issue's description:
> Revert of Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #5 id:120001 of https://codereview.webrtc.org/2041593002/ )
>
> Reason for revert:
> ReadyToSendMedia did not consider the new presumed_writable state.
>
> Original issue's description:
> > Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://codereview.webrtc.org/2000063003/ )"
> >
> > This reverts commit 72d41aa6da94dacb8a8464d1abd4ca7d1afffc65.
> >
> > New change made:
> > Do not reset the BWE when the new network route is not ready to send media.
> >
> > BUG=
> > R=pthatcher@webrtc.org, stefan@webrtc.org
> >

TBR=pthatcher@webrtc.org,stefan@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/2094863003
Cr-Commit-Position: refs/heads/master@{#13282}
2016-06-24 18:04:00 +00:00

54 lines
1.8 KiB
C++

/*
* Copyright 2016 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 WEBRTC_BASE_NETWORKROUTE_H_
#define WEBRTC_BASE_NETWORKROUTE_H_
// TODO(honghaiz): Make a directory that describes the interfaces and structs
// the media code can rely on and the network code can implement, and both can
// depend on that, but not depend on each other. Then, move this file to that
// directory.
namespace rtc {
struct NetworkRoute {
bool connected;
uint16_t local_network_id;
uint16_t remote_network_id;
int last_sent_packet_id; // Last packet id sent on the PREVIOUS route.
NetworkRoute()
: connected(false),
local_network_id(0),
remote_network_id(0),
last_sent_packet_id(-1) {}
// The route is connected if the local and remote network ids are provided.
NetworkRoute(bool connected,
uint16_t local_net_id,
uint16_t remote_net_id,
int last_packet_id)
: connected(connected),
local_network_id(local_net_id),
remote_network_id(remote_net_id),
last_sent_packet_id(last_packet_id) {}
// |last_sent_packet_id| does not affect the NetworkRoute comparison.
bool operator==(const NetworkRoute& nr) const {
return connected == nr.connected &&
local_network_id == nr.local_network_id &&
remote_network_id == nr.remote_network_id;
}
bool operator!=(const NetworkRoute& nr) const { return !(*this == nr); }
};
} // namespace rtc
#endif // WEBRTC_BASE_NETWORKROUTE_H_