diff --git a/webrtc/call/flexfec_receive_stream_impl.cc b/webrtc/call/flexfec_receive_stream_impl.cc index 16edadd803..ffb3455349 100644 --- a/webrtc/call/flexfec_receive_stream_impl.cc +++ b/webrtc/call/flexfec_receive_stream_impl.cc @@ -168,11 +168,8 @@ FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() { } void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) { - { - rtc::CritScope cs(&crit_); - if (!started_) - return; - } + if (!started_.load()) + return; if (!receiver_) return; @@ -191,13 +188,11 @@ void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) { } void FlexfecReceiveStreamImpl::Start() { - rtc::CritScope cs(&crit_); - started_ = true; + started_.store(true); } void FlexfecReceiveStreamImpl::Stop() { - rtc::CritScope cs(&crit_); - started_ = false; + started_.store(false); } // TODO(brandtr): Implement this member function when we have designed the diff --git a/webrtc/call/flexfec_receive_stream_impl.h b/webrtc/call/flexfec_receive_stream_impl.h index de5de4190c..d1c19ffc70 100644 --- a/webrtc/call/flexfec_receive_stream_impl.h +++ b/webrtc/call/flexfec_receive_stream_impl.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_ #define WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_ +#include #include #include "webrtc/call/flexfec_receive_stream.h" @@ -52,8 +53,7 @@ class FlexfecReceiveStreamImpl : public FlexfecReceiveStream, private: // Config. const Config config_; - bool started_ GUARDED_BY(crit_); - rtc::CriticalSection crit_; + std::atomic started_; // Erasure code interfacing. const std::unique_ptr receiver_;