Extract RTP-header SSRC inline in Call.

Prevents unknown-RTP-header-extension warnings to be flooding from the
RTP-header parsing as there's no way to register RTP extensions for the
parser in Call as they're allowed to differ between RTP streams.

RTP-header parsing should instead be done separately in every
VideoReceiveStream.

BUG=
R=stefan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6619 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-07-08 07:38:12 +00:00
parent a70be68f65
commit af38f4e511

View File

@ -89,9 +89,7 @@ class Call : public webrtc::Call, public PacketReceiver {
private:
DeliveryStatus DeliverRtcp(const uint8_t* packet, size_t length);
DeliveryStatus DeliverRtp(const RTPHeader& header,
const uint8_t* packet,
size_t length);
DeliveryStatus DeliverRtp(const uint8_t* packet, size_t length);
Call::Config config_;
@ -288,7 +286,7 @@ uint32_t Call::ReceiveBitrateEstimate() {
return 0;
}
Call::PacketReceiver::DeliveryStatus Call::DeliverRtcp(const uint8_t* packet,
PacketReceiver::DeliveryStatus Call::DeliverRtcp(const uint8_t* packet,
size_t length) {
// TODO(pbos): Figure out what channel needs it actually.
// Do NOT broadcast! Also make sure it's a valid packet.
@ -319,32 +317,32 @@ Call::PacketReceiver::DeliveryStatus Call::DeliverRtcp(const uint8_t* packet,
return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR;
}
Call::PacketReceiver::DeliveryStatus Call::DeliverRtp(const RTPHeader& header,
const uint8_t* packet,
size_t length) {
PacketReceiver::DeliveryStatus Call::DeliverRtp(const uint8_t* packet,
size_t length) {
// Minimum RTP header size.
if (length < 12)
return DELIVERY_PACKET_ERROR;
const uint8_t* ptr = &packet[8];
uint32_t ssrc = ptr[0] << 24 | ptr[1] << 16 | ptr[2] << 8 | ptr[3] ;
ReadLockScoped read_lock(*receive_lock_);
std::map<uint32_t, VideoReceiveStream*>::iterator it =
receive_ssrcs_.find(header.ssrc);
receive_ssrcs_.find(ssrc);
if (it == receive_ssrcs_.end())
return DELIVERY_UNKNOWN_SSRC;
return it->second->DeliverRtp(static_cast<const uint8_t*>(packet), length)
? DELIVERY_OK
: DELIVERY_PACKET_ERROR;
return it->second->DeliverRtp(packet, length) ? DELIVERY_OK
: DELIVERY_PACKET_ERROR;
}
Call::PacketReceiver::DeliveryStatus Call::DeliverPacket(const uint8_t* packet,
size_t length) {
// TODO(pbos): ExtensionMap if there are extensions.
PacketReceiver::DeliveryStatus Call::DeliverPacket(const uint8_t* packet,
size_t length) {
if (RtpHeaderParser::IsRtcp(packet, static_cast<int>(length)))
return DeliverRtcp(packet, length);
RTPHeader rtp_header;
if (!rtp_header_parser_->Parse(packet, static_cast<int>(length), &rtp_header))
return DELIVERY_PACKET_ERROR;
return DeliverRtp(rtp_header, packet, length);
return DeliverRtp(packet, length);
}
} // namespace internal