Don't block the signaling thread during the call.

Since WebRTC stats are collected on the signaling thread, this CL moves
the wait from the signaling thread to the main thread.

Bug: webrtc:10138
Change-Id: I0e554fe82e3a4afe66b45e53032b06d533f54a39
Reviewed-on: https://webrtc-review.googlesource.com/c/123228
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26746}
This commit is contained in:
Mirko Bonadei
2019-02-18 18:52:43 +01:00
committed by Commit Bot
parent 0e1a1f9e7c
commit 713188010b
3 changed files with 21 additions and 7 deletions

View File

@ -216,6 +216,7 @@ if (rtc_include_tests) {
"../../../rtc_base:gunit_helpers",
"../../../rtc_base:rtc_base",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../system_wrappers:system_wrappers",
"../../../test:fileutils",
"../../../test:video_test_support",

View File

@ -11,6 +11,7 @@
*/
#include "test/pc/e2e/peer_connection_quality_test.h"
#include <algorithm>
#include <set>
#include <utility>
@ -22,6 +23,7 @@
#include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/bind.h"
#include "rtc_base/gunit.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "system_wrappers/include/cpu_info.h"
#include "test/pc/e2e/analyzer/video/example_video_quality_analyzer.h"
#include "test/pc/e2e/api/video_quality_analyzer_interface.h"
@ -189,8 +191,19 @@ void PeerConnectionE2EQualityTest::Run(
video_quality_analyzer_injection_helper_->Start(video_analyzer_threads);
signaling_thread->Invoke<void>(
RTC_FROM_HERE,
rtc::Bind(&PeerConnectionE2EQualityTest::RunOnSignalingThread, this,
run_params));
rtc::Bind(&PeerConnectionE2EQualityTest::SetupCallOnSignalingThread,
this));
// TODO(bugs.webrtc.org/10138): Implement stats collection and send stats
// reports to analyzers every 1 second.
rtc::Event done;
done.Wait(rtc::checked_cast<int>(run_params.run_duration.ms()));
signaling_thread->Invoke<void>(
RTC_FROM_HERE,
rtc::Bind(&PeerConnectionE2EQualityTest::TearDownCallOnSignalingThread,
this));
video_quality_analyzer_injection_helper_->Stop();
// Ensuring that TestPeers have been destroyed in order to correctly close
@ -296,15 +309,14 @@ void PeerConnectionE2EQualityTest::SetupVideoSink(
output_video_sinks_.push_back(std::move(video_sink));
}
void PeerConnectionE2EQualityTest::RunOnSignalingThread(RunParams run_params) {
void PeerConnectionE2EQualityTest::SetupCallOnSignalingThread() {
alice_video_sources_ = AddMedia(alice_.get());
bob_video_sources_ = AddMedia(bob_.get());
SetupCall();
}
rtc::Event done;
done.Wait(static_cast<int>(run_params.run_duration.ms()));
void PeerConnectionE2EQualityTest::TearDownCallOnSignalingThread() {
TearDownCall();
}

View File

@ -58,7 +58,8 @@ class PeerConnectionE2EQualityTest
void SetupVideoSink(rtc::scoped_refptr<RtpTransceiverInterface> transceiver,
std::vector<VideoConfig> remote_video_configs);
// Have to be run on the signaling thread.
void RunOnSignalingThread(RunParams run_params);
void SetupCallOnSignalingThread();
void TearDownCallOnSignalingThread();
std::vector<rtc::scoped_refptr<FrameGeneratorCapturerVideoTrackSource>>
AddMedia(TestPeer* peer);
std::vector<rtc::scoped_refptr<FrameGeneratorCapturerVideoTrackSource>>