Files
platform-external-webrtc/webrtc/voice_engine/network_predictor.h
minyue@webrtc.org 74aaf29a0f Raw packet loss rate reported by RTP_RTCP module may vary too drastically over time. This CL is to add a filter to the value in VoE before lending it to audio coding module.
The filter is an exponential filter borrowed from video coding module.

The method is written in a new class called PacketLossProtector (not sure if the name is nice), which can be used in the future for more sophisticated logic.

BUG=
R=henrika@webrtc.org, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/20809004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6709 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-07-16 21:28:26 +00:00

47 lines
1.4 KiB
C++

/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_
#define WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_
#include "webrtc/base/exp_filter.h"
#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc {
namespace voe {
// NetworkPredictor is to predict network conditions e.g., packet loss rate, for
// sender and/or receiver to cope with changes in the network condition.
class NetworkPredictor {
public:
explicit NetworkPredictor(Clock* clock);
~NetworkPredictor() {}
// Gets the predicted packet loss rate.
uint8_t GetLossRate();
// Updates the packet loss rate predictor, on receiving a new observation of
// packet loss rate from past. Input packet loss rate should be in the
// interval [0, 255].
void UpdatePacketLossRate(uint8_t loss_rate);
private:
Clock* clock_;
int64_t last_loss_rate_update_time_ms_;
// An exponential filter is used to predict packet loss rate.
scoped_ptr<rtc::ExpFilter> loss_rate_filter_;
};
} // namespace voe
} // namespace webrtc
#endif // WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_