Refactoring PayloadRouter.

- Move PayloadRouter to RtpTransportControllerInterface.
- Move RetransmissionLimiter inside RtpTransportControllerSend from
  VideoSendStreamImpl.
- Move video RTP specifics into PayloadRouter, in particular ownership
  of the RTP modules.
- PayloadRouter now contains all video specific RTP code, and will be
  renamed in a follow-up to VideoRtpSender.
- Introduce VideoRtpSenderInterface.

Bug: webrtc:9517
Change-Id: I1c7b293fa6f9c320286c80533b3c584498034a38
Reviewed-on: https://webrtc-review.googlesource.com/88240
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24009}
This commit is contained in:
Stefan Holmer
2018-07-17 16:03:46 +02:00
committed by Commit Bot
parent e1d7b23915
commit dbdb3a0079
45 changed files with 1199 additions and 783 deletions

View File

@ -29,6 +29,8 @@ VCMExtDecoderMapItem::VCMExtDecoderMapItem(
: payload_type(payload_type),
external_decoder_instance(external_decoder_instance) {}
VCMDecoderMapItem::~VCMDecoderMapItem() {}
VCMDecoderDataBase::VCMDecoderDataBase()
: receive_codec_(), dec_map_(), dec_external_map_() {}

View File

@ -23,6 +23,7 @@ struct VCMDecoderMapItem {
VCMDecoderMapItem(VideoCodec* settings,
int number_of_cores,
bool require_key_frame);
~VCMDecoderMapItem();
std::unique_ptr<VideoCodec> settings;
int number_of_cores;

View File

@ -31,6 +31,9 @@ const int kMessagesThrottlingThreshold = 2;
const int kThrottleRatio = 100000;
} // namespace
VCMEncodedFrameCallback::TimingFramesLayerInfo::TimingFramesLayerInfo() {}
VCMEncodedFrameCallback::TimingFramesLayerInfo::~TimingFramesLayerInfo() {}
VCMGenericEncoder::VCMGenericEncoder(
VideoEncoder* encoder,
VCMEncodedFrameCallback* encoded_frame_callback,

View File

@ -38,7 +38,7 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
public:
VCMEncodedFrameCallback(EncodedImageCallback* post_encode_callback,
media_optimization::MediaOptimization* media_opt);
virtual ~VCMEncodedFrameCallback();
~VCMEncodedFrameCallback() override;
// Implements EncodedImageCallback.
EncodedImageCallback::Result OnEncodedImage(
@ -102,6 +102,8 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
int64_t encode_start_time_ms;
};
struct TimingFramesLayerInfo {
TimingFramesLayerInfo();
~TimingFramesLayerInfo();
size_t target_bitrate_bytes_per_sec = 0;
std::list<EncodeStartTimeRecord> encode_start_list;
};

View File

@ -46,9 +46,9 @@ class EventFactory {
class EventFactoryImpl : public EventFactory {
public:
virtual ~EventFactoryImpl() {}
~EventFactoryImpl() override {}
virtual EventWrapper* CreateEvent() { return EventWrapper::Create(); }
EventWrapper* CreateEvent() override;
};
// Used to indicate which decode with errors mode should be used.

View File

@ -123,6 +123,9 @@ void FrameList::Reset(UnorderedFrameList* free_frames) {
}
}
Vp9SsMap::Vp9SsMap() {}
Vp9SsMap::~Vp9SsMap() {}
bool Vp9SsMap::Insert(const VCMPacket& packet) {
if (!packet.video_header.vp9().ss_data_available)
return false;

View File

@ -75,6 +75,9 @@ class FrameList
class Vp9SsMap {
public:
typedef std::map<uint32_t, GofInfoVP9, TimestampLessThan> SsMap;
Vp9SsMap();
~Vp9SsMap();
bool Insert(const VCMPacket& packet);
void Reset();

View File

@ -29,6 +29,20 @@ static const int kPacketLossMax = 129;
namespace media_optimization {
VCMProtectionParameters::VCMProtectionParameters()
: rtt(0),
lossPr(0.0f),
bitRate(0.0f),
packetsPerFrame(0.0f),
packetsPerFrameKey(0.0f),
frameRate(0.0f),
keyFrameSize(0.0f),
fecRateDelta(0),
fecRateKey(0),
codecWidth(0),
codecHeight(0),
numLayers(1) {}
VCMProtectionMethod::VCMProtectionMethod()
: _effectivePacketLoss(0),
_protectionFactorK(0),
@ -40,6 +54,34 @@ VCMProtectionMethod::VCMProtectionMethod()
VCMProtectionMethod::~VCMProtectionMethod() {}
enum VCMProtectionMethodEnum VCMProtectionMethod::Type() const {
return _type;
}
uint8_t VCMProtectionMethod::RequiredPacketLossER() {
return _effectivePacketLoss;
}
uint8_t VCMProtectionMethod::RequiredProtectionFactorK() {
return _protectionFactorK;
}
uint8_t VCMProtectionMethod::RequiredProtectionFactorD() {
return _protectionFactorD;
}
bool VCMProtectionMethod::RequiredUepProtectionK() {
return _useUepProtectionK;
}
bool VCMProtectionMethod::RequiredUepProtectionD() {
return _useUepProtectionD;
}
int VCMProtectionMethod::MaxFramesFec() const {
return 1;
}
VCMNackFecMethod::VCMNackFecMethod(int64_t lowRttNackThresholdMs,
int64_t highRttNackThresholdMs)
: VCMFecMethod(),

View File

@ -48,19 +48,7 @@ const int64_t kLowRttNackMs = 20;
const int kMaxRttDelayThreshold = 500;
struct VCMProtectionParameters {
VCMProtectionParameters()
: rtt(0),
lossPr(0.0f),
bitRate(0.0f),
packetsPerFrame(0.0f),
packetsPerFrameKey(0.0f),
frameRate(0.0f),
keyFrameSize(0.0f),
fecRateDelta(0),
fecRateKey(0),
codecWidth(0),
codecHeight(0),
numLayers(1) {}
VCMProtectionParameters();
int64_t rtt;
float lossPr;
@ -107,38 +95,38 @@ class VCMProtectionMethod {
// Returns the protection type
//
// Return value : The protection type
enum VCMProtectionMethodEnum Type() const { return _type; }
VCMProtectionMethodEnum Type() const;
// Returns the effective packet loss for ER, required by this protection
// method
//
// Return value : Required effective packet loss
virtual uint8_t RequiredPacketLossER() { return _effectivePacketLoss; }
virtual uint8_t RequiredPacketLossER();
// Extracts the FEC protection factor for Key frame, required by this
// protection method
//
// Return value : Required protectionFactor for Key frame
virtual uint8_t RequiredProtectionFactorK() { return _protectionFactorK; }
virtual uint8_t RequiredProtectionFactorK();
// Extracts the FEC protection factor for Delta frame, required by this
// protection method
//
// Return value : Required protectionFactor for delta frame
virtual uint8_t RequiredProtectionFactorD() { return _protectionFactorD; }
virtual uint8_t RequiredProtectionFactorD();
// Extracts whether the FEC Unequal protection (UEP) is used for Key frame.
//
// Return value : Required Unequal protection on/off state.
virtual bool RequiredUepProtectionK() { return _useUepProtectionK; }
virtual bool RequiredUepProtectionK();
// Extracts whether the the FEC Unequal protection (UEP) is used for Delta
// frame.
//
// Return value : Required Unequal protection on/off state.
virtual bool RequiredUepProtectionD() { return _useUepProtectionD; }
virtual bool RequiredUepProtectionD();
virtual int MaxFramesFec() const { return 1; }
virtual int MaxFramesFec() const;
protected:
uint8_t _effectivePacketLoss;
@ -151,14 +139,14 @@ class VCMProtectionMethod {
bool _useUepProtectionK;
bool _useUepProtectionD;
float _corrFecCost;
enum VCMProtectionMethodEnum _type;
VCMProtectionMethodEnum _type;
};
class VCMNackMethod : public VCMProtectionMethod {
public:
VCMNackMethod();
virtual ~VCMNackMethod();
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
~VCMNackMethod() override;
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
// Get the effective packet loss
bool EffectivePacketLoss(const VCMProtectionParameters* parameter);
};
@ -166,8 +154,8 @@ class VCMNackMethod : public VCMProtectionMethod {
class VCMFecMethod : public VCMProtectionMethod {
public:
VCMFecMethod();
virtual ~VCMFecMethod();
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
~VCMFecMethod() override;
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
// Get the effective packet loss for ER
bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
// Get the FEC protection factors
@ -202,14 +190,14 @@ class VCMNackFecMethod : public VCMFecMethod {
public:
VCMNackFecMethod(int64_t lowRttNackThresholdMs,
int64_t highRttNackThresholdMs);
virtual ~VCMNackFecMethod();
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
~VCMNackFecMethod() override;
bool UpdateParameters(const VCMProtectionParameters* parameters) override;
// Get the effective packet loss for ER
bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
// Get the protection factors
bool ProtectionFactor(const VCMProtectionParameters* parameters);
// Get the max number of frames the FEC is allowed to be based on.
int MaxFramesFec() const;
int MaxFramesFec() const override;
// Turn off the FEC based on low bitrate and other factors.
bool BitRateTooLowForFec(const VCMProtectionParameters* parameters);

View File

@ -33,6 +33,8 @@ VCMSessionInfo::VCMSessionInfo()
first_packet_seq_num_(-1),
last_packet_seq_num_(-1) {}
VCMSessionInfo::~VCMSessionInfo() {}
void VCMSessionInfo::UpdateDataPointers(const uint8_t* old_base_ptr,
const uint8_t* new_base_ptr) {
for (PacketIterator it = packets_.begin(); it != packets_.end(); ++it)

View File

@ -30,6 +30,7 @@ struct FrameData {
class VCMSessionInfo {
public:
VCMSessionInfo();
~VCMSessionInfo();
void UpdateDataPointers(const uint8_t* old_base_ptr,
const uint8_t* new_base_ptr);

View File

@ -27,6 +27,10 @@
#include "system_wrappers/include/clock.h"
namespace webrtc {
EventWrapper* EventFactoryImpl::CreateEvent() {
return EventWrapper::Create();
}
namespace vcm {
int64_t VCMProcessTimer::Period() const {