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

Side by Side Diff: webrtc/modules/audio_coding/audio_network_adaptor/controller_manager_unittest.cc

Issue 2786363002: Revert of Loosening the coupling between WebRTC and //third_party/protobuf (Closed)
Patch Set: 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 <utility> 11 #include <utility>
12 12
13 #include "webrtc/base/ignore_wundef.h" 13 #include "webrtc/base/ignore_wundef.h"
14 #include "webrtc/base/protobuf_utils.h"
15 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h " 14 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h "
16 #include "webrtc/modules/audio_coding/audio_network_adaptor/mock/mock_controller .h" 15 #include "webrtc/modules/audio_coding/audio_network_adaptor/mock/mock_controller .h"
17 #include "webrtc/system_wrappers/include/clock.h" 16 #include "webrtc/system_wrappers/include/clock.h"
18 #include "webrtc/test/gtest.h" 17 #include "webrtc/test/gtest.h"
19 18
20 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP 19 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
21 RTC_PUSH_IGNORING_WUNDEF() 20 RTC_PUSH_IGNORING_WUNDEF()
22 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 21 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
23 #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/conf ig.pb.h" 22 #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/conf ig.pb.h"
24 #else 23 #else
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 266 }
268 267
269 constexpr int kInitialBitrateBps = 24000; 268 constexpr int kInitialBitrateBps = 24000;
270 constexpr size_t kIntialChannelsToEncode = 1; 269 constexpr size_t kIntialChannelsToEncode = 1;
271 constexpr bool kInitialDtxEnabled = true; 270 constexpr bool kInitialDtxEnabled = true;
272 constexpr bool kInitialFecEnabled = true; 271 constexpr bool kInitialFecEnabled = true;
273 constexpr int kInitialFrameLengthMs = 60; 272 constexpr int kInitialFrameLengthMs = 60;
274 constexpr int kMinBitrateBps = 6000; 273 constexpr int kMinBitrateBps = 6000;
275 274
276 ControllerManagerStates CreateControllerManager( 275 ControllerManagerStates CreateControllerManager(
277 const ProtoString& config_string) { 276 const std::string& config_string) {
278 ControllerManagerStates states; 277 ControllerManagerStates states;
279 states.simulated_clock.reset(new SimulatedClock(kClockInitialTime)); 278 states.simulated_clock.reset(new SimulatedClock(kClockInitialTime));
280 constexpr size_t kNumEncoderChannels = 2; 279 constexpr size_t kNumEncoderChannels = 2;
281 const std::vector<int> encoder_frame_lengths_ms = {20, 60}; 280 const std::vector<int> encoder_frame_lengths_ms = {20, 60};
282 states.controller_manager = ControllerManagerImpl::Create( 281 states.controller_manager = ControllerManagerImpl::Create(
283 config_string, kNumEncoderChannels, encoder_frame_lengths_ms, 282 config_string, kNumEncoderChannels, encoder_frame_lengths_ms,
284 kMinBitrateBps, kIntialChannelsToEncode, kInitialFrameLengthMs, 283 kMinBitrateBps, kIntialChannelsToEncode, kInitialFrameLengthMs,
285 kInitialBitrateBps, kInitialFecEnabled, kInitialDtxEnabled, 284 kInitialBitrateBps, kInitialFecEnabled, kInitialDtxEnabled,
286 states.simulated_clock.get()); 285 states.simulated_clock.get());
287 return states; 286 return states;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 audio_network_adaptor::config::ControllerManager config; 338 audio_network_adaptor::config::ControllerManager config;
340 config.set_min_reordering_time_ms(kMinReorderingTimeMs); 339 config.set_min_reordering_time_ms(kMinReorderingTimeMs);
341 config.set_min_reordering_squared_distance(kMinReorderingSquareDistance); 340 config.set_min_reordering_squared_distance(kMinReorderingSquareDistance);
342 341
343 AddFecControllerConfig(&config); 342 AddFecControllerConfig(&config);
344 AddChannelControllerConfig(&config); 343 AddChannelControllerConfig(&config);
345 AddDtxControllerConfig(&config); 344 AddDtxControllerConfig(&config);
346 AddFrameLengthControllerConfig(&config); 345 AddFrameLengthControllerConfig(&config);
347 AddBitrateControllerConfig(&config); 346 AddBitrateControllerConfig(&config);
348 347
349 ProtoString config_string; 348 std::string config_string;
350 config.SerializeToString(&config_string); 349 config.SerializeToString(&config_string);
351 350
352 auto states = CreateControllerManager(config_string); 351 auto states = CreateControllerManager(config_string);
353 Controller::NetworkMetrics metrics; 352 Controller::NetworkMetrics metrics;
354 353
355 auto controllers = states.controller_manager->GetSortedControllers(metrics); 354 auto controllers = states.controller_manager->GetSortedControllers(metrics);
356 CheckControllersOrder( 355 CheckControllersOrder(
357 controllers, 356 controllers,
358 std::vector<ControllerType>{ 357 std::vector<ControllerType>{
359 ControllerType::FEC, ControllerType::CHANNEL, ControllerType::DTX, 358 ControllerType::FEC, ControllerType::CHANNEL, ControllerType::DTX,
(...skipping 10 matching lines...) Expand all
370 // Internally associated with characteristic point 0. 369 // Internally associated with characteristic point 0.
371 AddFecControllerConfig(&config); 370 AddFecControllerConfig(&config);
372 371
373 AddDtxControllerConfig(&config); 372 AddDtxControllerConfig(&config);
374 373
375 // Internally associated with characteristic point 1. 374 // Internally associated with characteristic point 1.
376 AddFrameLengthControllerConfig(&config); 375 AddFrameLengthControllerConfig(&config);
377 376
378 AddBitrateControllerConfig(&config); 377 AddBitrateControllerConfig(&config);
379 378
380 ProtoString config_string; 379 std::string config_string;
381 config.SerializeToString(&config_string); 380 config.SerializeToString(&config_string);
382 381
383 auto states = CreateControllerManager(config_string); 382 auto states = CreateControllerManager(config_string);
384 383
385 Controller::NetworkMetrics metrics; 384 Controller::NetworkMetrics metrics;
386 metrics.uplink_bandwidth_bps = 385 metrics.uplink_bandwidth_bps =
387 rtc::Optional<int>(kChracteristicBandwithBps[0]); 386 rtc::Optional<int>(kChracteristicBandwithBps[0]);
388 metrics.uplink_packet_loss_fraction = 387 metrics.uplink_packet_loss_fraction =
389 rtc::Optional<float>(kChracteristicPacketLossFraction[0]); 388 rtc::Optional<float>(kChracteristicPacketLossFraction[0]);
390 389
(...skipping 22 matching lines...) Expand all
413 // Reorder now. 412 // Reorder now.
414 CheckControllersOrder(controllers, 413 CheckControllersOrder(controllers,
415 std::vector<ControllerType>{ 414 std::vector<ControllerType>{
416 ControllerType::FRAME_LENGTH, ControllerType::FEC, 415 ControllerType::FRAME_LENGTH, ControllerType::FEC,
417 ControllerType::CHANNEL, ControllerType::DTX, 416 ControllerType::CHANNEL, ControllerType::DTX,
418 ControllerType::BIT_RATE}); 417 ControllerType::BIT_RATE});
419 } 418 }
420 #endif // WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP 419 #endif // WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
421 420
422 } // namespace webrtc 421 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698