Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine_unittest.cc

Issue 1457653003: Remove SetVideoLogging/SetAudioLogging from ChannelManager and down the stack. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: oops Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | talk/session/media/channelmanager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2008 Google Inc. 3 * Copyright 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 : cricket::VoEWrapper(engine, // processing 68 : cricket::VoEWrapper(engine, // processing
69 engine, // base 69 engine, // base
70 engine, // codec 70 engine, // codec
71 engine, // dtmf 71 engine, // dtmf
72 engine, // hw 72 engine, // hw
73 engine, // network 73 engine, // network
74 engine, // rtp 74 engine, // rtp
75 engine) { // volume 75 engine) { // volume
76 } 76 }
77 }; 77 };
78
79 class FakeVoETraceWrapper : public cricket::VoETraceWrapper {
80 public:
81 int SetTraceFilter(const unsigned int filter) override {
82 filter_ = filter;
83 return 0;
84 }
85 int SetTraceFile(const char* fileNameUTF8) override { return 0; }
86 int SetTraceCallback(webrtc::TraceCallback* callback) override { return 0; }
87 unsigned int filter_;
88 };
89 } // namespace 78 } // namespace
90 79
91 class WebRtcVoiceEngineTestFake : public testing::Test { 80 class WebRtcVoiceEngineTestFake : public testing::Test {
92 public: 81 public:
93 WebRtcVoiceEngineTestFake() 82 WebRtcVoiceEngineTestFake()
94 : call_(webrtc::Call::Config()), 83 : call_(webrtc::Call::Config()),
95 voe_(kAudioCodecs, arraysize(kAudioCodecs)), 84 voe_(kAudioCodecs, arraysize(kAudioCodecs)),
96 trace_wrapper_(new FakeVoETraceWrapper()), 85 engine_(new FakeVoEWrapper(&voe_)),
97 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_),
98 channel_(nullptr) { 86 channel_(nullptr) {
99 send_parameters_.codecs.push_back(kPcmuCodec); 87 send_parameters_.codecs.push_back(kPcmuCodec);
100 recv_parameters_.codecs.push_back(kPcmuCodec); 88 recv_parameters_.codecs.push_back(kPcmuCodec);
101 options_adjust_agc_.adjust_agc_delta = rtc::Optional<int>(-10); 89 options_adjust_agc_.adjust_agc_delta = rtc::Optional<int>(-10);
102 } 90 }
103 bool SetupEngine() { 91 bool SetupEngine() {
104 if (!engine_.Init(rtc::Thread::Current())) { 92 if (!engine_.Init(rtc::Thread::Current())) {
105 return false; 93 return false;
106 } 94 }
107 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 95 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 EXPECT_EQ(info.decoding_normal, stats.decoding_normal); 398 EXPECT_EQ(info.decoding_normal, stats.decoding_normal);
411 EXPECT_EQ(info.decoding_plc, stats.decoding_plc); 399 EXPECT_EQ(info.decoding_plc, stats.decoding_plc);
412 EXPECT_EQ(info.decoding_cng, stats.decoding_cng); 400 EXPECT_EQ(info.decoding_cng, stats.decoding_cng);
413 EXPECT_EQ(info.decoding_plc_cng, stats.decoding_plc_cng); 401 EXPECT_EQ(info.decoding_plc_cng, stats.decoding_plc_cng);
414 EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms); 402 EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms);
415 } 403 }
416 404
417 protected: 405 protected:
418 cricket::FakeCall call_; 406 cricket::FakeCall call_;
419 cricket::FakeWebRtcVoiceEngine voe_; 407 cricket::FakeWebRtcVoiceEngine voe_;
420 FakeVoETraceWrapper* trace_wrapper_;
421 cricket::WebRtcVoiceEngine engine_; 408 cricket::WebRtcVoiceEngine engine_;
422 cricket::VoiceMediaChannel* channel_; 409 cricket::VoiceMediaChannel* channel_;
423 410
424 cricket::AudioSendParameters send_parameters_; 411 cricket::AudioSendParameters send_parameters_;
425 cricket::AudioRecvParameters recv_parameters_; 412 cricket::AudioRecvParameters recv_parameters_;
426 cricket::AudioOptions options_adjust_agc_; 413 cricket::AudioOptions options_adjust_agc_;
427 }; 414 };
428 415
429 // Tests that our stub library "works". 416 // Tests that our stub library "works".
430 TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) { 417 TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) {
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 options.playout_sample_rate = rtc::Optional<uint32_t>(44100); 2304 options.playout_sample_rate = rtc::Optional<uint32_t>(44100);
2318 EXPECT_TRUE(engine_.SetOptions(options)); 2305 EXPECT_TRUE(engine_.SetOptions(options));
2319 2306
2320 unsigned int recording_sample_rate, playout_sample_rate; 2307 unsigned int recording_sample_rate, playout_sample_rate;
2321 EXPECT_EQ(0, voe_.RecordingSampleRate(&recording_sample_rate)); 2308 EXPECT_EQ(0, voe_.RecordingSampleRate(&recording_sample_rate));
2322 EXPECT_EQ(0, voe_.PlayoutSampleRate(&playout_sample_rate)); 2309 EXPECT_EQ(0, voe_.PlayoutSampleRate(&playout_sample_rate));
2323 EXPECT_EQ(48000u, recording_sample_rate); 2310 EXPECT_EQ(48000u, recording_sample_rate);
2324 EXPECT_EQ(44100u, playout_sample_rate); 2311 EXPECT_EQ(44100u, playout_sample_rate);
2325 } 2312 }
2326 2313
2327 TEST_F(WebRtcVoiceEngineTestFake, TraceFilterViaTraceOptions) {
2328 EXPECT_TRUE(SetupEngineWithSendStream());
2329 engine_.SetLogging(rtc::LS_INFO, "");
2330 EXPECT_EQ(
2331 // Info:
2332 webrtc::kTraceStateInfo | webrtc::kTraceInfo |
2333 // Warning:
2334 webrtc::kTraceTerseInfo | webrtc::kTraceWarning |
2335 // Error:
2336 webrtc::kTraceError | webrtc::kTraceCritical,
2337 static_cast<int>(trace_wrapper_->filter_));
2338 // Now set it explicitly
2339 std::string filter =
2340 "tracefilter " + rtc::ToString(webrtc::kTraceDefault);
2341 engine_.SetLogging(rtc::LS_VERBOSE, filter.c_str());
2342 EXPECT_EQ(static_cast<unsigned int>(webrtc::kTraceDefault),
2343 trace_wrapper_->filter_);
2344 }
2345
2346 // Test that we can set the outgoing SSRC properly. 2314 // Test that we can set the outgoing SSRC properly.
2347 // SSRC is set in SetupEngine by calling AddSendStream. 2315 // SSRC is set in SetupEngine by calling AddSendStream.
2348 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { 2316 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) {
2349 EXPECT_TRUE(SetupEngineWithSendStream()); 2317 EXPECT_TRUE(SetupEngineWithSendStream());
2350 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); 2318 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1));
2351 } 2319 }
2352 2320
2353 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { 2321 TEST_F(WebRtcVoiceEngineTestFake, GetStats) {
2354 // Setup. We need send codec to be set to get all stats. 2322 // Setup. We need send codec to be set to get all stats.
2355 EXPECT_TRUE(SetupEngineWithSendStream()); 2323 EXPECT_TRUE(SetupEngineWithSendStream());
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 cricket::WebRtcVoiceEngine engine; 3355 cricket::WebRtcVoiceEngine engine;
3388 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3356 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3389 rtc::scoped_ptr<webrtc::Call> call( 3357 rtc::scoped_ptr<webrtc::Call> call(
3390 webrtc::Call::Create(webrtc::Call::Config())); 3358 webrtc::Call::Create(webrtc::Call::Config()));
3391 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3359 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(),
3392 call.get()); 3360 call.get());
3393 cricket::AudioRecvParameters parameters; 3361 cricket::AudioRecvParameters parameters;
3394 parameters.codecs = engine.codecs(); 3362 parameters.codecs = engine.codecs();
3395 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3363 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3396 } 3364 }
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | talk/session/media/channelmanager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698