Fix unsafe variable access in RTCStatsCollector
With this change, all production callers of BaseChannel::transport_name()
will be making the call from the right thread and we can safely delegate
the call to the transport itself. Some tests still need to be updated.
This facilitates the main goal of not needing synchronization inside
of the channel classes, being able to apply thread checks and eventually
remove thread hops from the channel classes.
A downside of this particular change is that a blocking call to the
network thread from the signaling thread inside of RTCStatsCollector
needs to be done. This is done once though and fixes a race.
Bug: webrtc:12601, webrtc:11687, webrtc:12644
Change-Id: I85f34f3341a06da9a9efd936b1d36722b10ec487
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213080
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33775}
diff --git a/pc/peer_connection.h b/pc/peer_connection.h
index b44fb87..5ba9ec3 100644
--- a/pc/peer_connection.h
+++ b/pc/peer_connection.h
@@ -293,9 +293,9 @@
std::vector<DataChannelStats> GetDataChannelStats() const override;
absl::optional<std::string> sctp_transport_name() const override;
+ absl::optional<std::string> sctp_mid() const override;
cricket::CandidateStatsList GetPooledCandidateStats() const override;
- std::map<std::string, std::string> GetTransportNamesByMid() const override;
std::map<std::string, cricket::TransportStats> GetTransportStatsByNames(
const std::set<std::string>& transport_names) override;
Call::Stats GetCallStats() override;
@@ -342,10 +342,6 @@
RTC_DCHECK_RUN_ON(signaling_thread());
return &configuration_;
}
- absl::optional<std::string> sctp_mid() {
- RTC_DCHECK_RUN_ON(signaling_thread());
- return sctp_mid_s_;
- }
PeerConnectionMessageHandler* message_handler() {
RTC_DCHECK_RUN_ON(signaling_thread());
return &message_handler_;