Make RtpHelper<>::sending_ atomic.

This is to address flakiness of "DoubleThread" tests for the media
channel class. More investigation is in order though, so I'm adding
a TODO. The bug appears to be in test code only though, so this is
just to deflake the bots.

Bug: webrtc:12783
Change-Id: Ib6cf78927f2a9be9d2c6aa7f6915b1131a206e7c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219460
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34049}
This commit is contained in:
Tommi
2021-05-19 10:10:16 +02:00
committed by WebRTC LUCI CQ
parent 38f1d4bf8a
commit 12c881b21e

View File

@ -11,6 +11,7 @@
#ifndef MEDIA_BASE_FAKE_MEDIA_ENGINE_H_ #ifndef MEDIA_BASE_FAKE_MEDIA_ENGINE_H_
#define MEDIA_BASE_FAKE_MEDIA_ENGINE_H_ #define MEDIA_BASE_FAKE_MEDIA_ENGINE_H_
#include <atomic>
#include <list> #include <list>
#include <map> #include <map>
#include <memory> #include <memory>
@ -284,7 +285,10 @@ class RtpHelper : public Base {
bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; }
private: private:
bool sending_; // TODO(bugs.webrtc.org/12783): This flag is used from more than one thread.
// As a workaround for tsan, it's currently std::atomic but that might not
// be the appropriate fix.
std::atomic<bool> sending_;
bool playout_; bool playout_;
std::vector<RtpExtension> recv_extensions_; std::vector<RtpExtension> recv_extensions_;
std::vector<RtpExtension> send_extensions_; std::vector<RtpExtension> send_extensions_;