Remove calls to data_channel_transport() from the wrong thread.
Applying thread guards and removing the accessor that was being
called from the wrong context.
Bug: webrtc:11547, webrtc:9987
Change-Id: I80953aab48e5d155fc9d101526a3fa1f2704c39f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/300544
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39832}
diff --git a/pc/data_channel_controller.h b/pc/data_channel_controller.h
index 074b1fe..edd21c2 100644
--- a/pc/data_channel_controller.h
+++ b/pc/data_channel_controller.h
@@ -94,7 +94,6 @@
bool HasUsedDataChannels() const;
// Accessors
- DataChannelTransportInterface* data_channel_transport() const;
void set_data_channel_transport(DataChannelTransportInterface* transport);
// Called when the transport for the data channels is closed or destroyed.
@@ -135,11 +134,6 @@
absl::optional<rtc::SSLRole> fallback_ssl_role)
RTC_RUN_ON(network_thread());
- // Called from SendData when data_channel_transport() is true.
- RTCError DataChannelSendData(StreamId sid,
- const SendDataParams& params,
- const rtc::CopyOnWriteBuffer& payload);
-
// Called when all data channels need to be notified of a transport channel
// (calls OnTransportChannelCreated on the signaling thread).
void NotifyDataChannelsOfTransportCreated();
@@ -147,9 +141,8 @@
// Plugin transport used for data channels. Pointer may be accessed and
// checked from any thread, but the object may only be touched on the
// network thread.
- // TODO(bugs.webrtc.org/9987): Accessed on both signaling and network
- // thread.
- DataChannelTransportInterface* data_channel_transport_ = nullptr;
+ DataChannelTransportInterface* data_channel_transport_
+ RTC_GUARDED_BY(network_thread()) = nullptr;
SctpSidAllocator sid_allocator_ RTC_GUARDED_BY(network_thread());
std::vector<rtc::scoped_refptr<SctpDataChannel>> sctp_data_channels_n_
RTC_GUARDED_BY(network_thread());