Never invoke rtc::LogMessage::SetLogToStderr outside of main.
rtc::LogMessage::SetLogToStderr should only be invoked by the main function in order to enable or disable logging in a consistent way [1]. Usage of rtc::LogMessage::SetLogToStderr in other parts of the codebase creates complex behaviors and confusion. [1] - https://cs.chromium.org/chromium/src/third_party/webrtc/test/test_main.cc?l=88&rcl=665174fdbb4e0540eccb27cf7412348f1b65534c Bug: None Change-Id: Iae86fb14d7ca40af6d78d0f0cd81c5a39f65068d Reviewed-on: https://webrtc-review.googlesource.com/91442 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24154}
This commit is contained in:

committed by
Commit Bot

parent
2a99c0bf67
commit
45a4c41eda
@ -270,6 +270,7 @@ if (rtc_include_tests) {
|
||||
]
|
||||
deps = [
|
||||
":video_quality_test",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../system_wrappers:field_trial_default",
|
||||
"../system_wrappers:metrics_default",
|
||||
@ -296,6 +297,7 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":video_quality_test",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../system_wrappers:field_trial_default",
|
||||
"../system_wrappers:metrics_default",
|
||||
@ -321,6 +323,7 @@ if (rtc_include_tests) {
|
||||
]
|
||||
deps = [
|
||||
":video_quality_test",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../system_wrappers:field_trial_default",
|
||||
"../system_wrappers:metrics_default",
|
||||
|
@ -56,8 +56,8 @@ struct ParamsWithLogging : public VideoQualityTest::Params {
|
||||
public:
|
||||
ParamsWithLogging() {
|
||||
// Use these logging flags by default, for everything.
|
||||
logging = {flags::FLAG_logs, flags::RtcEventLogName(),
|
||||
flags::RtpDumpName(), flags::EncodedFramePath()};
|
||||
logging = {flags::RtcEventLogName(), flags::RtpDumpName(),
|
||||
flags::EncodedFramePath()};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "system_wrappers/include/field_trial_default.h"
|
||||
#include "test/field_trial.h"
|
||||
@ -314,8 +315,8 @@ void Loopback() {
|
||||
flags::OutputFilename(),
|
||||
flags::GraphTitle()};
|
||||
params.pipe = pipe_config;
|
||||
params.logging = {flags::FLAG_logs, flags::RtcEventLogName(),
|
||||
flags::RtpDumpName(), flags::EncodedFramePath()};
|
||||
params.logging = {flags::RtcEventLogName(), flags::RtpDumpName(),
|
||||
flags::EncodedFramePath()};
|
||||
|
||||
if (flags::NumStreams() > 1 && flags::Stream0().empty() &&
|
||||
flags::Stream1().empty()) {
|
||||
@ -350,6 +351,8 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtc::LogMessage::SetLogToStderr(webrtc::flags::FLAG_logs);
|
||||
|
||||
webrtc::test::ValidateFieldTrialsStringOrDie(
|
||||
webrtc::flags::FLAG_force_fieldtrials);
|
||||
// InitFieldTrialsFromString stores the char*, so the char array must outlive
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "system_wrappers/include/field_trial_default.h"
|
||||
#include "test/field_trial.h"
|
||||
@ -529,8 +530,8 @@ void Loopback() {
|
||||
flags::GetCaptureDevice()};
|
||||
params.audio = {flags::FLAG_audio, flags::FLAG_audio_video_sync,
|
||||
flags::FLAG_audio_dtx};
|
||||
params.logging = {flags::FLAG_logs, flags::FLAG_rtc_event_log_name,
|
||||
flags::FLAG_rtp_dump_name, flags::FLAG_encoded_frame_path};
|
||||
params.logging = {flags::FLAG_rtc_event_log_name, flags::FLAG_rtp_dump_name,
|
||||
flags::FLAG_encoded_frame_path};
|
||||
params.analyzer = {"dual_streams",
|
||||
0.0,
|
||||
0.0,
|
||||
@ -598,6 +599,8 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtc::LogMessage::SetLogToStderr(webrtc::flags::FLAG_logs);
|
||||
|
||||
webrtc::test::ValidateFieldTrialsStringOrDie(
|
||||
webrtc::flags::FLAG_force_fieldtrials);
|
||||
// InitFieldTrialsFromString stores the char*, so the char array must outlive
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/field_trial_default.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
@ -307,8 +308,8 @@ void Loopback() {
|
||||
flags::GetCaptureDevice()};
|
||||
params.audio = {flags::FLAG_audio, flags::FLAG_audio_video_sync,
|
||||
flags::FLAG_audio_dtx};
|
||||
params.logging = {flags::FLAG_logs, flags::FLAG_rtc_event_log_name,
|
||||
flags::FLAG_rtp_dump_name, flags::FLAG_encoded_frame_path};
|
||||
params.logging = {flags::FLAG_rtc_event_log_name, flags::FLAG_rtp_dump_name,
|
||||
flags::FLAG_encoded_frame_path};
|
||||
params.screenshare[0].enabled = false;
|
||||
params.analyzer = {"video",
|
||||
0.0,
|
||||
@ -351,6 +352,8 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtc::LogMessage::SetLogToStderr(webrtc::flags::FLAG_logs);
|
||||
|
||||
webrtc::test::ValidateFieldTrialsStringOrDie(
|
||||
webrtc::flags::FLAG_force_fieldtrials);
|
||||
// InitFieldTrialsFromString stores the char*, so the char array must outlive
|
||||
|
@ -115,7 +115,7 @@ VideoQualityTest::Params::Params()
|
||||
std::vector<SpatialLayer>()},
|
||||
{std::vector<VideoStream>(), 0, 0, -1, InterLayerPredMode::kOn,
|
||||
std::vector<SpatialLayer>()}},
|
||||
logging({false, "", "", ""}) {}
|
||||
logging({"", "", ""}) {}
|
||||
|
||||
VideoQualityTest::Params::~Params() = default;
|
||||
|
||||
@ -774,7 +774,6 @@ VideoQualityTest::CreateReceiveTransport() {
|
||||
}
|
||||
|
||||
void VideoQualityTest::RunWithAnalyzer(const Params& params) {
|
||||
rtc::LogMessage::SetLogToStderr(params.logging.logs);
|
||||
num_video_streams_ = params.call.dual_video ? 2 : 1;
|
||||
std::unique_ptr<test::LayerFilteringTransport> send_transport;
|
||||
std::unique_ptr<test::DirectTransport> recv_transport;
|
||||
@ -969,7 +968,6 @@ void VideoQualityTest::SetupAudio(Transport* transport) {
|
||||
}
|
||||
|
||||
void VideoQualityTest::RunWithRenderers(const Params& params) {
|
||||
rtc::LogMessage::SetLogToStderr(params.logging.logs);
|
||||
num_video_streams_ = params.call.dual_video ? 2 : 1;
|
||||
std::unique_ptr<test::LayerFilteringTransport> send_transport;
|
||||
std::unique_ptr<test::DirectTransport> recv_transport;
|
||||
|
Reference in New Issue
Block a user