Fix deadlock in webrtc_perf_tests

Reenable hanging tests on Mac.

Deadlock happened because the following locks were grabbed by two threads at the end of a test:
Thread 1:
CapturedFrameForwarder::AddOrUpdateSink() locks CapturedFrameForwarder::crit_ and calls
FrameGeneratorCapturer::AddOrUpdateSink() what tries to lock FrameGeneratorCapturer::lock_.

Thread 2:
FrameGeneratorCapturer::InsertFrame() locks FrameGeneratorCapturer::lock_ and calls
CapturedFrameForwarder::OnFrame() which tries to lock CapturedFrameForwarder::crit_.

So two threads are locking two same locks in different orders which may cause deadlock.

BUG=webrtc:7870

Review-Url: https://codereview.webrtc.org/2955083002
Cr-Commit-Position: refs/heads/master@{#18783}
This commit is contained in:
ilnik 2017-06-27 07:21:01 -07:00 committed by Commit Bot
parent 4847ae6b51
commit 267041c470
2 changed files with 6 additions and 5 deletions

View File

@ -465,8 +465,7 @@ TEST_F(FullStackTest, VP9SVC_3SL_Low) {
#endif // !defined(RTC_DISABLE_VP9)
// Android bots can't handle FullHD, so disable the test.
// Test is not working correctly on Mac: webrtc:7870.
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
#if defined(WEBRTC_ANDROID)
#define MAYBE_SimulcastFullHdOveruse DISABLED_SimulcastFullHdOveruse
#else
#define MAYBE_SimulcastFullHdOveruse SimulcastFullHdOveruse

View File

@ -939,9 +939,11 @@ class VideoAnalyzer : public PacketReceiver,
// Called when |send_stream_.SetSource()| is called.
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
rtc::CritScope lock(&crit_);
RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink);
send_stream_input_ = sink;
{
rtc::CritScope lock(&crit_);
RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink);
send_stream_input_ = sink;
}
if (video_capturer_) {
video_capturer_->AddOrUpdateSink(this, wants);
}