Add threading assertions to TransceiverList
Also add a function for accessing the list as internal transceivers
rather than accessing the proxy objects; this exposes where the
internal objects are accessed and where we need external references.
Used the new list function in sdp_offer_answer wherever possible.
Adds an UnsafeList function that is not thread guarded, so that the
job of rooting out those instances can be done in a later CL.
Bug: webrtc:12692
Change-Id: Ia591f22a1c8f82ec452a1a66a94fbf9ab9debd14
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215581
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33781}
diff --git a/pc/transceiver_list.cc b/pc/transceiver_list.cc
index 63d3e67..235c9af 100644
--- a/pc/transceiver_list.cc
+++ b/pc/transceiver_list.cc
@@ -41,8 +41,18 @@
init_send_encodings_ = encodings;
}
+std::vector<RtpTransceiver*> TransceiverList::ListInternal() const {
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
+ std::vector<RtpTransceiver*> internals;
+ for (auto transceiver : transceivers_) {
+ internals.push_back(transceiver->internal());
+ }
+ return internals;
+}
+
RtpTransceiverProxyRefPtr TransceiverList::FindBySender(
rtc::scoped_refptr<RtpSenderInterface> sender) const {
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
for (auto transceiver : transceivers_) {
if (transceiver->sender() == sender) {
return transceiver;
@@ -53,6 +63,7 @@
RtpTransceiverProxyRefPtr TransceiverList::FindByMid(
const std::string& mid) const {
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
for (auto transceiver : transceivers_) {
if (transceiver->mid() == mid) {
return transceiver;
@@ -63,6 +74,7 @@
RtpTransceiverProxyRefPtr TransceiverList::FindByMLineIndex(
size_t mline_index) const {
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
for (auto transceiver : transceivers_) {
if (transceiver->internal()->mline_index() == mline_index) {
return transceiver;