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

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

Issue 2320093002: Adding DTX controller to audio network adaptor. (Closed)
Patch Set: Created 4 years, 3 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
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/audio_coding/audio_network_adaptor/dtx_controller.h"
12 #include "webrtc/base/checks.h"
13
14 namespace webrtc {
15
16 DtxController::DtxController(const Config& config)
17 : config_(config), dtx_enabled_(config_.initial_dtx_enabled) {}
18
19 void DtxController::MakeDecision(
20 const NetworkMetrics& metrics,
21 AudioNetworkAdaptor::EncoderRuntimeConfig* config) {
22 // Decision on |num_channels| should not have been made.
minyue-webrtc 2016/09/08 14:57:54 num_channels -> enable_dtx
23 RTC_DCHECK(!config->enable_dtx);
24
25 if (metrics.uplink_bandwidth_bps) {
26 if (dtx_enabled_ &&
27 *metrics.uplink_bandwidth_bps >= config_.dtx_disabling_bandwidth_bps) {
28 dtx_enabled_ = false;
29 } else if (!dtx_enabled_ &&
30 *metrics.uplink_bandwidth_bps <=
31 config_.dtx_enabling_bandwidth_bps) {
32 dtx_enabled_ = true;
33 }
34 }
35 config->enable_dtx = rtc::Optional<bool>(dtx_enabled_);
36 }
37
38 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698