Replaced the _audio parameter with a strategy.
The purpose is to make _rtpReceiver mostly agnostic to if it processes audio or video, and make its delegates responsible for that. This patch makes the actual interfaces and interactions between the classes a lot clearer which will probably help straighten out the rather convoluted business logic in here. There are a number of rough edges I hope to address in coming patches. In particular, I think there are a lot of audio-specific hacks, especially when it comes to telephone event handling. I think we will see a lot of benefit once that stuff moves out of rtp_receiver altogether. The new strategy I introduced doesn't quite pull its own weight yet, but I think I will be able to remove a lot of that interface later once the responsibilities of the classes becomes move cohesive (e.g. that audio specific stuff actually lives in the audio class, and so on). Also I think it should be possible to extract payload type management to a helper class later on. BUG= TEST=vie/voe_auto_test, trybots Review URL: https://webrtc-codereview.appspot.com/1001006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3306 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -43,10 +43,12 @@ RTPReceiverVideo::~RTPReceiverVideo() {
|
||||
delete _receiveFEC;
|
||||
}
|
||||
|
||||
ModuleRTPUtility::Payload* RTPReceiverVideo::RegisterReceiveVideoPayload(
|
||||
ModuleRTPUtility::Payload* RTPReceiverVideo::CreatePayloadType(
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const WebRtc_Word8 payloadType,
|
||||
const WebRtc_UWord32 maxRate) {
|
||||
const WebRtc_UWord32 frequency,
|
||||
const WebRtc_UWord8 channels,
|
||||
const WebRtc_UWord32 rate) {
|
||||
RtpVideoCodecTypes videoType = kRtpNoVideo;
|
||||
if (ModuleRTPUtility::StringCompare(payloadName, "VP8", 3)) {
|
||||
videoType = kRtpVp8Video;
|
||||
@ -67,11 +69,68 @@ ModuleRTPUtility::Payload* RTPReceiverVideo::RegisterReceiveVideoPayload(
|
||||
payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
|
||||
strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1);
|
||||
payload->typeSpecific.Video.videoCodecType = videoType;
|
||||
payload->typeSpecific.Video.maxRate = maxRate;
|
||||
payload->typeSpecific.Video.maxRate = rate;
|
||||
payload->audio = false;
|
||||
return payload;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiverVideo::ParseRtpPacket(
|
||||
WebRtcRTPHeader* rtpHeader,
|
||||
const ModuleRTPUtility::PayloadUnion& specificPayload,
|
||||
const bool isRed,
|
||||
const WebRtc_UWord8* packet,
|
||||
const WebRtc_UWord16 packetLength,
|
||||
const WebRtc_Word64 timestampMs) {
|
||||
const WebRtc_UWord8* payloadData =
|
||||
ModuleRTPUtility::GetPayloadData(rtpHeader, packet);
|
||||
const WebRtc_UWord16 payloadDataLength =
|
||||
ModuleRTPUtility::GetPayloadDataLength(rtpHeader, packetLength);
|
||||
return ParseVideoCodecSpecific(
|
||||
rtpHeader, payloadData, payloadDataLength,
|
||||
specificPayload.Video.videoCodecType, isRed, packet, packetLength,
|
||||
timestampMs);
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiverVideo::GetFrequencyHz() const {
|
||||
return kDefaultVideoFrequency;
|
||||
}
|
||||
|
||||
RTPAliveType RTPReceiverVideo::ProcessDeadOrAlive(
|
||||
WebRtc_UWord16 lastPayloadLength) const {
|
||||
return kRtpDead;
|
||||
}
|
||||
|
||||
bool RTPReceiverVideo::PayloadIsCompatible(
|
||||
const ModuleRTPUtility::Payload& payload,
|
||||
const WebRtc_UWord32 frequency,
|
||||
const WebRtc_UWord8 channels,
|
||||
const WebRtc_UWord32 rate) const {
|
||||
return !payload.audio;
|
||||
}
|
||||
|
||||
void RTPReceiverVideo::UpdatePayloadRate(
|
||||
ModuleRTPUtility::Payload* payload,
|
||||
const WebRtc_UWord32 rate) const {
|
||||
payload->typeSpecific.Video.maxRate = rate;
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiverVideo::InvokeOnInitializeDecoder(
|
||||
RtpFeedback* callback,
|
||||
const WebRtc_Word32 id,
|
||||
const WebRtc_Word8 payloadType,
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const ModuleRTPUtility::PayloadUnion& specificPayload) const {
|
||||
// For video we just go with default values.
|
||||
if (-1 == callback->OnInitializeDecoder(
|
||||
id, payloadType, payloadName, kDefaultVideoFrequency, 1, 0)) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id,
|
||||
"Failed to create video decoder for payload type:%d",
|
||||
payloadType);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we have no critext when calling this
|
||||
// we are not allowed to have any critsects when calling
|
||||
// CallbackOfReceivedPayloadData
|
||||
|
Reference in New Issue
Block a user