From 12c881b21e75367013830ebeb62c68d9a39b0a64 Mon Sep 17 00:00:00 2001 From: Tommi Date: Wed, 19 May 2021 10:10:16 +0200 Subject: [PATCH] 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 Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#34049} --- media/base/fake_media_engine.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/media/base/fake_media_engine.h b/media/base/fake_media_engine.h index 6ee37369f9..e4f7b6659f 100644 --- a/media/base/fake_media_engine.h +++ b/media/base/fake_media_engine.h @@ -11,6 +11,7 @@ #ifndef MEDIA_BASE_FAKE_MEDIA_ENGINE_H_ #define MEDIA_BASE_FAKE_MEDIA_ENGINE_H_ +#include #include #include #include @@ -284,7 +285,10 @@ class RtpHelper : public Base { bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } 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 sending_; bool playout_; std::vector recv_extensions_; std::vector send_extensions_;