aboutsummaryrefslogtreecommitdiff
path: root/talk
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org>2014-09-24 07:10:57 +0000
committerpbos@webrtc.org <pbos@webrtc.org>2014-09-24 07:10:57 +0000
commitd60d79a14594cbc8266e4a50391ddbe64ed491f0 (patch)
tree848f7410360b13e866203fd743b9f0af6a68b7c0 /talk
parent38344ed2806c8fed60d67d280ca44c32e36707c0 (diff)
downloadwebrtc-d60d79a14594cbc8266e4a50391ddbe64ed491f0.tar.gz
Thread annotation of rtc::CriticalSection.
Effectively re-lands r5516 which was reverted because talk/-only checkouts existed. This now resides in webrtc/base/, so no talk/-only checkouts should be possible. This change also enables -Wthread-safety for talk/ and fixes a bug in talk/media/webrtc/webrtcvideoengine2.cc where a guarded variable was read without taking the corresponding lock. R=andresp@webrtc.org, mflodman@webrtc.org, pthatcher@webrtc.org BUG= Review URL: https://webrtc-codereview.appspot.com/27569004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7284 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'talk')
-rw-r--r--talk/build/common.gypi1
-rw-r--r--talk/media/webrtc/webrtcvideoengine2.cc16
-rw-r--r--talk/media/webrtc/webrtcvideoengine2.h8
-rw-r--r--talk/session/media/mediamonitor.h3
4 files changed, 16 insertions, 12 deletions
diff --git a/talk/build/common.gypi b/talk/build/common.gypi
index 57b21af8a9..7ee4224e4e 100644
--- a/talk/build/common.gypi
+++ b/talk/build/common.gypi
@@ -91,6 +91,7 @@
# LateBindingSymbolTable::TableInfo from
# latebindingsymboltable.cc.def and remove below flag.
'-Wno-address-of-array-temporary',
+ '-Wthread-safety',
],
}],
],
diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc
index 31f6070b17..26e3079787 100644
--- a/talk/media/webrtc/webrtcvideoengine2.cc
+++ b/talk/media/webrtc/webrtcvideoengine2.cc
@@ -1381,14 +1381,8 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame(
<< frame->GetHeight();
// Lock before copying, can be called concurrently when swapping input source.
rtc::CritScope frame_cs(&frame_lock_);
- if (!muted_) {
- ConvertToI420VideoFrame(*frame, &video_frame_);
- } else {
- // Create a black frame to transmit instead.
- CreateBlackFrame(&video_frame_,
- static_cast<int>(frame->GetWidth()),
- static_cast<int>(frame->GetHeight()));
- }
+ ConvertToI420VideoFrame(*frame, &video_frame_);
+
rtc::CritScope cs(&lock_);
if (stream_ == NULL) {
LOG(LS_WARNING) << "Capturer inputting frames before send codecs are "
@@ -1400,6 +1394,12 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame(
LOG(LS_VERBOSE) << "VideoFormat 0x0 set, Dropping frame.";
return;
}
+ if (muted_) {
+ // Create a black frame to transmit instead.
+ CreateBlackFrame(&video_frame_,
+ static_cast<int>(frame->GetWidth()),
+ static_cast<int>(frame->GetHeight()));
+ }
// Reconfigure codec if necessary.
SetDimensions(
video_frame_.width(), video_frame_.height(), capturer->IsScreencast());
diff --git a/talk/media/webrtc/webrtcvideoengine2.h b/talk/media/webrtc/webrtcvideoengine2.h
index a19abd58d3..18a80d7ad7 100644
--- a/talk/media/webrtc/webrtcvideoengine2.h
+++ b/talk/media/webrtc/webrtcvideoengine2.h
@@ -335,10 +335,12 @@ class WebRtcVideoChannel2 : public rtc::MessageHandler,
};
void SetCodecAndOptions(const VideoCodecSettings& codec,
- const VideoOptions& options);
- void RecreateWebRtcStream();
+ const VideoOptions& options)
+ EXCLUSIVE_LOCKS_REQUIRED(lock_);
+ void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_);
// When |override_max| is false constrain width/height to codec dimensions.
- void SetDimensions(int width, int height, bool override_max);
+ void SetDimensions(int width, int height, bool override_max)
+ EXCLUSIVE_LOCKS_REQUIRED(lock_);
webrtc::Call* const call_;
WebRtcVideoEncoderFactory2* const encoder_factory_;
diff --git a/talk/session/media/mediamonitor.h b/talk/session/media/mediamonitor.h
index d549362ad7..89740a8d4c 100644
--- a/talk/session/media/mediamonitor.h
+++ b/talk/session/media/mediamonitor.h
@@ -34,6 +34,7 @@
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/thread.h"
+#include "webrtc/base/thread_annotations.h"
namespace cricket {
@@ -77,7 +78,7 @@ class MediaMonitorT : public MediaMonitor {
media_info_.Clear();
media_channel_->GetStats(&media_info_);
}
- virtual void Update() {
+ virtual void Update() EXCLUSIVE_LOCKS_REQUIRED(crit_) {
MI stats(media_info_);
crit_.Leave();
SignalUpdate(media_channel_, stats);