Reland: Fix race / crash in OnNetworkRouteChanged().

To achieve this some refactoring was done to make it possible to synchronize
access to the DelayBasedBwe in TransportFeedbackAdapter:
- The callback was removed from DelayBasedBwe, it now instead returns its
  result.
- TransportFeedbackAdapter was moved to modules/congestion_controller to avoid
  unnecessary dependencies.

Reenables previously disabled flaky test. Can no longer reproduce flakiness with gtest-parallel and asan/tsan builds.

BUG=webrtc:6427, webrtc:6422
R=terelius@webrtc.org

Review URL: https://codereview.webrtc.org/2378103005 .

Cr-Commit-Position: refs/heads/master@{#14452}
This commit is contained in:
Stefan Holmer
2016-09-30 10:06:51 +02:00
parent 20a52e1639
commit 280de9e1c3
22 changed files with 354 additions and 327 deletions

View File

@ -24,6 +24,7 @@
#include "webrtc/base/rate_statistics.h"
#include "webrtc/call.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -1053,6 +1054,34 @@ void EventLogAnalyzer::CreateBweSimulationGraph(Plot* plot) {
plot->SetTitle("Simulated BWE behavior");
}
// TODO(holmer): Remove once TransportFeedbackAdapter no longer needs a
// BitrateController.
class NullBitrateController : public BitrateController {
public:
~NullBitrateController() override {}
RtcpBandwidthObserver* CreateRtcpBandwidthObserver() override {
return nullptr;
}
void SetStartBitrate(int start_bitrate_bps) override {}
void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) override {}
void SetBitrates(int start_bitrate_bps,
int min_bitrate_bps,
int max_bitrate_bps) override {}
void ResetBitrates(int bitrate_bps,
int min_bitrate_bps,
int max_bitrate_bps) override {}
void OnDelayBasedBweResult(const DelayBasedBwe::Result& result) override {}
bool AvailableBandwidth(uint32_t* bandwidth) const override { return false; }
void SetReservedBitrate(uint32_t reserved_bitrate_bps) override {}
bool GetNetworkParameters(uint32_t* bitrate,
uint8_t* fraction_loss,
int64_t* rtt) override {
return false;
}
int64_t TimeUntilNextProcess() override { return 0; }
void Process() override {}
};
void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) {
std::map<uint64_t, const LoggedRtpPacket*> outgoing_rtp;
std::map<uint64_t, const LoggedRtcpPacket*> incoming_rtcp;
@ -1073,7 +1102,8 @@ void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) {
}
SimulatedClock clock(0);
TransportFeedbackAdapter feedback_adapter(&clock);
NullBitrateController null_controller;
TransportFeedbackAdapter feedback_adapter(&clock, &null_controller);
TimeSeries time_series;
time_series.label = "Network Delay Change";