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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc

Issue 2745473003: Resolve cyclic dependency between audio network adaptor and event log api (Closed)
Patch Set: Revert "Activated checks for rtc_event_log_api" Created 3 years, 8 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/buffer.h" 17 #include "webrtc/base/buffer.h"
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/fakeclock.h" 19 #include "webrtc/base/fakeclock.h"
20 #include "webrtc/base/random.h" 20 #include "webrtc/base/random.h"
21 #include "webrtc/call/call.h" 21 #include "webrtc/call/call.h"
22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
23 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" 23 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
24 #include "webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h" 24 #include "webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h"
25 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
30 #include "webrtc/test/gtest.h" 31 #include "webrtc/test/gtest.h"
31 #include "webrtc/test/testsupport/fileutils.h" 32 #include "webrtc/test/testsupport/fileutils.h"
32 33
33 // Files generated at build-time by the protobuf compiler. 34 // Files generated at build-time by the protobuf compiler.
34 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 35 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 config->rtp.ssrc = prng->Rand<uint32_t>(); 221 config->rtp.ssrc = prng->Rand<uint32_t>();
221 // Add header extensions. 222 // Add header extensions.
222 for (unsigned i = 0; i < kNumExtensions; i++) { 223 for (unsigned i = 0; i < kNumExtensions; i++) {
223 if (extensions_bitvector & (1u << i)) { 224 if (extensions_bitvector & (1u << i)) {
224 config->rtp.extensions.push_back( 225 config->rtp.extensions.push_back(
225 RtpExtension(kExtensionNames[i], prng->Rand<int>())); 226 RtpExtension(kExtensionNames[i], prng->Rand<int>()));
226 } 227 }
227 } 228 }
228 } 229 }
229 230
230 void GenerateAudioNetworkAdaptation( 231 void GenerateAudioNetworkAdaptation(uint32_t extensions_bitvector,
231 uint32_t extensions_bitvector, 232 AudioEncoderRuntimeConfig* config,
232 AudioNetworkAdaptor::EncoderRuntimeConfig* config, 233 Random* prng) {
233 Random* prng) {
234 config->bitrate_bps = rtc::Optional<int>(prng->Rand(0, 3000000)); 234 config->bitrate_bps = rtc::Optional<int>(prng->Rand(0, 3000000));
235 config->enable_fec = rtc::Optional<bool>(prng->Rand<bool>()); 235 config->enable_fec = rtc::Optional<bool>(prng->Rand<bool>());
236 config->enable_dtx = rtc::Optional<bool>(prng->Rand<bool>()); 236 config->enable_dtx = rtc::Optional<bool>(prng->Rand<bool>());
237 config->frame_length_ms = rtc::Optional<int>(prng->Rand(10, 120)); 237 config->frame_length_ms = rtc::Optional<int>(prng->Rand(10, 120));
238 config->num_channels = rtc::Optional<size_t>(prng->Rand(1, 2)); 238 config->num_channels = rtc::Optional<size_t>(prng->Rand(1, 2));
239 config->uplink_packet_loss_fraction = 239 config->uplink_packet_loss_fraction =
240 rtc::Optional<float>(prng->Rand<float>()); 240 rtc::Optional<float>(prng->Rand<float>());
241 } 241 }
242 242
243 // Test for the RtcEventLog class. Dumps some RTP packets and other events 243 // Test for the RtcEventLog class. Dumps some RTP packets and other events
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 GenerateAudioNetworkAdaptation(extensions_bitvector, &config, &prng); 852 GenerateAudioNetworkAdaptation(extensions_bitvector, &config, &prng);
853 } 853 }
854 void LogConfig(RtcEventLog* event_log) override { 854 void LogConfig(RtcEventLog* event_log) override {
855 event_log->LogAudioNetworkAdaptation(config); 855 event_log->LogAudioNetworkAdaptation(config);
856 } 856 }
857 void VerifyConfig(const ParsedRtcEventLog& parsed_log, 857 void VerifyConfig(const ParsedRtcEventLog& parsed_log,
858 size_t index) override { 858 size_t index) override {
859 RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(parsed_log, index, 859 RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(parsed_log, index,
860 config); 860 config);
861 } 861 }
862 AudioNetworkAdaptor::EncoderRuntimeConfig config; 862 AudioEncoderRuntimeConfig config;
863 }; 863 };
864 864
865 TEST(RtcEventLogTest, LogAudioReceiveConfig) { 865 TEST(RtcEventLogTest, LogAudioReceiveConfig) {
866 AudioReceiveConfigReadWriteTest test; 866 AudioReceiveConfigReadWriteTest test;
867 test.DoTest(); 867 test.DoTest();
868 } 868 }
869 869
870 TEST(RtcEventLogTest, LogAudioSendConfig) { 870 TEST(RtcEventLogTest, LogAudioSendConfig) {
871 AudioSendConfigReadWriteTest test; 871 AudioSendConfigReadWriteTest test;
872 test.DoTest(); 872 test.DoTest();
873 } 873 }
874 874
875 TEST(RtcEventLogTest, LogVideoReceiveConfig) { 875 TEST(RtcEventLogTest, LogVideoReceiveConfig) {
876 VideoReceiveConfigReadWriteTest test; 876 VideoReceiveConfigReadWriteTest test;
877 test.DoTest(); 877 test.DoTest();
878 } 878 }
879 879
880 TEST(RtcEventLogTest, LogVideoSendConfig) { 880 TEST(RtcEventLogTest, LogVideoSendConfig) {
881 VideoSendConfigReadWriteTest test; 881 VideoSendConfigReadWriteTest test;
882 test.DoTest(); 882 test.DoTest();
883 } 883 }
884 884
885 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { 885 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) {
886 AudioNetworkAdaptationReadWriteTest test; 886 AudioNetworkAdaptationReadWriteTest test;
887 test.DoTest(); 887 test.DoTest();
888 } 888 }
889 889
890 } // namespace webrtc 890 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log_parser.cc ('k') | webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698