Update talk to 50918584.

Together with Stefan's http://review.webrtc.org/1960004/.

R=mallinath@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4556 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org
2013-08-15 23:38:54 +00:00
parent dde7d4c6ed
commit 822fbd8b68
108 changed files with 2926 additions and 4301 deletions

View File

@ -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()) {
@ -104,6 +103,7 @@ int32_t RTPPayloadRegistry::RegisterReceivePayload(
if (ModuleRTPUtility::StringCompare(payload_name, "red", 3)) {
red_payload_type_ = payload_type;
payload = new ModuleRTPUtility::Payload;
memset(payload, 0, sizeof(*payload));
payload->audio = false;
payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload->name, payload_name, RTP_PAYLOAD_NAME_SIZE - 1);
@ -226,7 +226,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 +257,11 @@ 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(
@ -283,12 +306,18 @@ class RTPPayloadAudioStrategy : public RTPPayloadStrategy {
ModuleRTPUtility::Payload* payload = new ModuleRTPUtility::Payload;
payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1);
assert(frequency >= 1000);
payload->typeSpecific.Audio.frequency = frequency;
payload->typeSpecific.Audio.channels = channels;
payload->typeSpecific.Audio.rate = rate;
payload->audio = true;
return payload;
}
int GetPayloadTypeFrequency(
const ModuleRTPUtility::Payload& payload) const {
return payload.typeSpecific.Audio.frequency;
}
};
class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
@ -315,15 +344,15 @@ class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
const uint32_t frequency,
const uint8_t channels,
const uint32_t rate) const OVERRIDE {
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 +363,11 @@ class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
payload->audio = false;
return payload;
}
int GetPayloadTypeFrequency(
const ModuleRTPUtility::Payload& payload) const {
return kVideoPayloadTypeFrequency;
}
};
RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy(