Breaking out receive-stats, rtp-payload-registry and rtp-receiver from the
rtp_rtcp implementation. This refactoring significantly reduces the receive-side RTP parser and receiver complexity, and makes it possible to implement RTX correctly by having two instances of receive-statistics. With this change the dead-or-alive and packet timeout APIs are removed. TEST=trybots, vie_auto_test, voe_auto_test BUG=1811 R=mflodman@webrtc.org, pbos@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1745004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4301 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtp_payload_registry.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
||||
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
@ -21,8 +21,7 @@ RTPPayloadRegistry::RTPPayloadRegistry(
|
||||
rtp_payload_strategy_(rtp_payload_strategy),
|
||||
red_payload_type_(-1),
|
||||
last_received_payload_type_(-1),
|
||||
last_received_media_payload_type_(-1) {
|
||||
}
|
||||
last_received_media_payload_type_(-1) {}
|
||||
|
||||
RTPPayloadRegistry::~RTPPayloadRegistry() {
|
||||
while (!payload_type_map_.empty()) {
|
||||
@ -226,7 +225,29 @@ int32_t RTPPayloadRegistry::ReceivePayloadType(
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t RTPPayloadRegistry::PayloadTypeToPayload(
|
||||
bool RTPPayloadRegistry::GetPayloadSpecifics(uint8_t payload_type,
|
||||
PayloadUnion* payload) const {
|
||||
ModuleRTPUtility::PayloadTypeMap::const_iterator it =
|
||||
payload_type_map_.find(payload_type);
|
||||
|
||||
// Check that this is a registered payload type.
|
||||
if (it == payload_type_map_.end()) {
|
||||
return false;
|
||||
}
|
||||
*payload = it->second->typeSpecific;
|
||||
return true;
|
||||
}
|
||||
|
||||
int RTPPayloadRegistry::GetPayloadTypeFrequency(
|
||||
uint8_t payload_type) const {
|
||||
ModuleRTPUtility::Payload* payload;
|
||||
if (!PayloadTypeToPayload(payload_type, payload)) {
|
||||
return -1;
|
||||
}
|
||||
return rtp_payload_strategy_->GetPayloadTypeFrequency(*payload);
|
||||
}
|
||||
|
||||
bool RTPPayloadRegistry::PayloadTypeToPayload(
|
||||
const uint8_t payload_type,
|
||||
ModuleRTPUtility::Payload*& payload) const {
|
||||
|
||||
@ -235,10 +256,10 @@ int32_t RTPPayloadRegistry::PayloadTypeToPayload(
|
||||
|
||||
// Check that this is a registered payload type.
|
||||
if (it == payload_type_map_.end()) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
payload = it->second;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RTPPayloadRegistry::ReportMediaPayloadType(
|
||||
@ -289,6 +310,11 @@ class RTPPayloadAudioStrategy : public RTPPayloadStrategy {
|
||||
payload->audio = true;
|
||||
return payload;
|
||||
}
|
||||
|
||||
int GetPayloadTypeFrequency(
|
||||
const ModuleRTPUtility::Payload& payload) const {
|
||||
return payload.typeSpecific.Audio.frequency;
|
||||
}
|
||||
};
|
||||
|
||||
class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
|
||||
@ -315,15 +341,15 @@ class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
|
||||
const uint32_t frequency,
|
||||
const uint8_t channels,
|
||||
const uint32_t rate) const {
|
||||
RtpVideoCodecTypes videoType = kRtpGenericVideo;
|
||||
RtpVideoCodecTypes videoType = kRtpVideoGeneric;
|
||||
if (ModuleRTPUtility::StringCompare(payloadName, "VP8", 3)) {
|
||||
videoType = kRtpVp8Video;
|
||||
videoType = kRtpVideoVp8;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "I420", 4)) {
|
||||
videoType = kRtpGenericVideo;
|
||||
videoType = kRtpVideoGeneric;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "ULPFEC", 6)) {
|
||||
videoType = kRtpFecVideo;
|
||||
videoType = kRtpVideoFec;
|
||||
} else {
|
||||
videoType = kRtpGenericVideo;
|
||||
videoType = kRtpVideoGeneric;
|
||||
}
|
||||
ModuleRTPUtility::Payload* payload = new ModuleRTPUtility::Payload;
|
||||
|
||||
@ -334,6 +360,11 @@ class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
|
||||
payload->audio = false;
|
||||
return payload;
|
||||
}
|
||||
|
||||
int GetPayloadTypeFrequency(
|
||||
const ModuleRTPUtility::Payload& payload) const {
|
||||
return kVideoPayloadTypeFrequency;
|
||||
}
|
||||
};
|
||||
|
||||
RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy(
|
||||
|
||||
Reference in New Issue
Block a user