Convert logs in rtp rtcp module from WEBRTC_TRACE into LOG.
Clean some logs and add asserts in the way. BUG=3153 R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/11129004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5861 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b287d968d9
commit
dc80bae2a6
@ -18,7 +18,7 @@ namespace webrtc {
|
|||||||
|
|
||||||
class FecReceiver {
|
class FecReceiver {
|
||||||
public:
|
public:
|
||||||
static FecReceiver* Create(int32_t id, RtpData* callback);
|
static FecReceiver* Create(RtpData* callback);
|
||||||
|
|
||||||
virtual ~FecReceiver() {}
|
virtual ~FecReceiver() {}
|
||||||
|
|
||||||
|
@ -54,8 +54,7 @@ class RTPPayloadStrategy {
|
|||||||
class RTPPayloadRegistry {
|
class RTPPayloadRegistry {
|
||||||
public:
|
public:
|
||||||
// The registry takes ownership of the strategy.
|
// The registry takes ownership of the strategy.
|
||||||
RTPPayloadRegistry(const int32_t id,
|
RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy);
|
||||||
RTPPayloadStrategy* rtp_payload_strategy);
|
|
||||||
~RTPPayloadRegistry();
|
~RTPPayloadRegistry();
|
||||||
|
|
||||||
int32_t RegisterReceivePayload(
|
int32_t RegisterReceivePayload(
|
||||||
@ -153,7 +152,6 @@ class RTPPayloadRegistry {
|
|||||||
|
|
||||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||||
ModuleRTPUtility::PayloadTypeMap payload_type_map_;
|
ModuleRTPUtility::PayloadTypeMap payload_type_map_;
|
||||||
int32_t id_;
|
|
||||||
scoped_ptr<RTPPayloadStrategy> rtp_payload_strategy_;
|
scoped_ptr<RTPPayloadStrategy> rtp_payload_strategy_;
|
||||||
int8_t red_payload_type_;
|
int8_t red_payload_type_;
|
||||||
int8_t ulpfec_payload_type_;
|
int8_t ulpfec_payload_type_;
|
||||||
|
@ -16,20 +16,19 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
// RFC 5109
|
// RFC 5109
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
FecReceiver* FecReceiver::Create(int32_t id, RtpData* callback) {
|
FecReceiver* FecReceiver::Create(RtpData* callback) {
|
||||||
return new FecReceiverImpl(id, callback);
|
return new FecReceiverImpl(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
FecReceiverImpl::FecReceiverImpl(const int32_t id, RtpData* callback)
|
FecReceiverImpl::FecReceiverImpl(RtpData* callback)
|
||||||
: id_(id),
|
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
|
||||||
recovered_packet_callback_(callback),
|
recovered_packet_callback_(callback),
|
||||||
fec_(new ForwardErrorCorrection(id)) {}
|
fec_(new ForwardErrorCorrection()) {}
|
||||||
|
|
||||||
FecReceiverImpl::~FecReceiverImpl() {
|
FecReceiverImpl::~FecReceiverImpl() {
|
||||||
while (!received_packet_list_.empty()) {
|
while (!received_packet_list_.empty()) {
|
||||||
@ -103,8 +102,7 @@ int32_t FecReceiverImpl::AddReceivedRedPacket(
|
|||||||
if (timestamp_offset != 0) {
|
if (timestamp_offset != 0) {
|
||||||
// |timestampOffset| should be 0. However, it's possible this is the first
|
// |timestampOffset| should be 0. However, it's possible this is the first
|
||||||
// location a corrupt payload can be caught, so don't assert.
|
// location a corrupt payload can be caught, so don't assert.
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Corrupt payload found.";
|
||||||
"Corrupt payload found in %s", __FUNCTION__);
|
|
||||||
delete received_packet;
|
delete received_packet;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class CriticalSectionWrapper;
|
|||||||
|
|
||||||
class FecReceiverImpl : public FecReceiver {
|
class FecReceiverImpl : public FecReceiver {
|
||||||
public:
|
public:
|
||||||
FecReceiverImpl(const int32_t id, RtpData* callback);
|
FecReceiverImpl(RtpData* callback);
|
||||||
virtual ~FecReceiverImpl();
|
virtual ~FecReceiverImpl();
|
||||||
|
|
||||||
virtual int32_t AddReceivedRedPacket(const RTPHeader& rtp_header,
|
virtual int32_t AddReceivedRedPacket(const RTPHeader& rtp_header,
|
||||||
@ -36,7 +36,6 @@ class FecReceiverImpl : public FecReceiver {
|
|||||||
virtual int32_t ProcessReceivedFec() OVERRIDE;
|
virtual int32_t ProcessReceivedFec() OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int id_;
|
|
||||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||||
RtpData* recovered_packet_callback_;
|
RtpData* recovered_packet_callback_;
|
||||||
ForwardErrorCorrection* fec_;
|
ForwardErrorCorrection* fec_;
|
||||||
|
@ -39,8 +39,8 @@ class MockRtpData : public RtpData {
|
|||||||
class ReceiverFecTest : public ::testing::Test {
|
class ReceiverFecTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
fec_ = new ForwardErrorCorrection(0);
|
fec_ = new ForwardErrorCorrection();
|
||||||
receiver_fec_ = FecReceiver::Create(0, &rtp_data_callback_);
|
receiver_fec_ = FecReceiver::Create(&rtp_data_callback_);
|
||||||
generator_ = new FrameGenerator();
|
generator_ = new FrameGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h"
|
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -82,9 +82,8 @@ ForwardErrorCorrection::ReceivedPacket::~ReceivedPacket() {}
|
|||||||
ForwardErrorCorrection::RecoveredPacket::RecoveredPacket() {}
|
ForwardErrorCorrection::RecoveredPacket::RecoveredPacket() {}
|
||||||
ForwardErrorCorrection::RecoveredPacket::~RecoveredPacket() {}
|
ForwardErrorCorrection::RecoveredPacket::~RecoveredPacket() {}
|
||||||
|
|
||||||
ForwardErrorCorrection::ForwardErrorCorrection(int32_t id)
|
ForwardErrorCorrection::ForwardErrorCorrection()
|
||||||
: id_(id),
|
: generated_fec_packets_(kMaxMediaPackets),
|
||||||
generated_fec_packets_(kMaxMediaPackets),
|
|
||||||
fec_packet_received_(false) {}
|
fec_packet_received_(false) {}
|
||||||
|
|
||||||
ForwardErrorCorrection::~ForwardErrorCorrection() {}
|
ForwardErrorCorrection::~ForwardErrorCorrection() {}
|
||||||
@ -112,43 +111,23 @@ int32_t ForwardErrorCorrection::GenerateFEC(const PacketList& media_packet_list,
|
|||||||
bool use_unequal_protection,
|
bool use_unequal_protection,
|
||||||
FecMaskType fec_mask_type,
|
FecMaskType fec_mask_type,
|
||||||
PacketList* fec_packet_list) {
|
PacketList* fec_packet_list) {
|
||||||
if (media_packet_list.empty()) {
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"%s media packet list is empty", __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!fec_packet_list->empty()) {
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"%s FEC packet list is not empty", __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
const uint16_t num_media_packets = media_packet_list.size();
|
const uint16_t num_media_packets = media_packet_list.size();
|
||||||
|
|
||||||
|
// Sanity check arguments.
|
||||||
|
assert(num_media_packets > 0);
|
||||||
|
assert(num_important_packets >= 0 &&
|
||||||
|
num_important_packets <= num_media_packets);
|
||||||
|
assert(fec_packet_list->empty());
|
||||||
|
|
||||||
|
if (num_media_packets > kMaxMediaPackets) {
|
||||||
|
LOG(LS_WARNING) << "Can't protect " << num_media_packets
|
||||||
|
<< " media packets per frame. Max is " << kMaxMediaPackets;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bool l_bit = (num_media_packets > 8 * kMaskSizeLBitClear);
|
bool l_bit = (num_media_packets > 8 * kMaskSizeLBitClear);
|
||||||
int num_maskBytes = l_bit ? kMaskSizeLBitSet : kMaskSizeLBitClear;
|
int num_maskBytes = l_bit ? kMaskSizeLBitSet : kMaskSizeLBitClear;
|
||||||
|
|
||||||
if (num_media_packets > kMaxMediaPackets) {
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"%s can only protect %d media packets per frame; %d requested",
|
|
||||||
__FUNCTION__, kMaxMediaPackets, num_media_packets);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error checking on the number of important packets.
|
|
||||||
// Can't have more important packets than media packets.
|
|
||||||
if (num_important_packets > num_media_packets) {
|
|
||||||
WEBRTC_TRACE(
|
|
||||||
kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"Number of important packets (%d) greater than number of media "
|
|
||||||
"packets (%d)",
|
|
||||||
num_important_packets, num_media_packets);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (num_important_packets < 0) {
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"Number of important packets (%d) less than zero",
|
|
||||||
num_important_packets);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// Do some error checking on the media packets.
|
// Do some error checking on the media packets.
|
||||||
PacketList::const_iterator media_list_it = media_packet_list.begin();
|
PacketList::const_iterator media_list_it = media_packet_list.begin();
|
||||||
while (media_list_it != media_packet_list.end()) {
|
while (media_list_it != media_packet_list.end()) {
|
||||||
@ -156,20 +135,16 @@ int32_t ForwardErrorCorrection::GenerateFEC(const PacketList& media_packet_list,
|
|||||||
assert(media_packet);
|
assert(media_packet);
|
||||||
|
|
||||||
if (media_packet->length < kRtpHeaderSize) {
|
if (media_packet->length < kRtpHeaderSize) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Media packet " << media_packet->length << " bytes "
|
||||||
"%s media packet (%d bytes) is smaller than RTP header",
|
<< "is smaller than RTP header.";
|
||||||
__FUNCTION__, media_packet->length);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure our FEC packets will fit in a typical MTU.
|
// Ensure our FEC packets will fit in a typical MTU.
|
||||||
if (media_packet->length + PacketOverhead() + kTransportOverhead >
|
if (media_packet->length + PacketOverhead() + kTransportOverhead >
|
||||||
IP_PACKET_SIZE) {
|
IP_PACKET_SIZE) {
|
||||||
WEBRTC_TRACE(
|
LOG(LS_WARNING) << "Media packet " << media_packet->length << " bytes "
|
||||||
kTraceError, kTraceRtpRtcp, id_,
|
<< "with overhead is larger than " << IP_PACKET_SIZE;
|
||||||
"%s media packet (%d bytes) with overhead is larger than MTU(%d)",
|
|
||||||
__FUNCTION__, media_packet->length, IP_PACKET_SIZE);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
media_list_it++;
|
media_list_it++;
|
||||||
}
|
}
|
||||||
@ -582,9 +557,7 @@ void ForwardErrorCorrection::InsertFECPacket(
|
|||||||
}
|
}
|
||||||
if (fec_packet->protected_pkt_list.empty()) {
|
if (fec_packet->protected_pkt_list.empty()) {
|
||||||
// All-zero packet mask; we can discard this FEC packet.
|
// All-zero packet mask; we can discard this FEC packet.
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "FEC packet has an all-zero packet mask.";
|
||||||
"FEC packet %u has an all-zero packet mask.",
|
|
||||||
fec_packet->seq_num, __FUNCTION__);
|
|
||||||
delete fec_packet;
|
delete fec_packet;
|
||||||
} else {
|
} else {
|
||||||
AssignRecoveredPackets(fec_packet, recovered_packet_list);
|
AssignRecoveredPackets(fec_packet, recovered_packet_list);
|
||||||
|
@ -117,8 +117,7 @@ class ForwardErrorCorrection {
|
|||||||
typedef std::list<ReceivedPacket*> ReceivedPacketList;
|
typedef std::list<ReceivedPacket*> ReceivedPacketList;
|
||||||
typedef std::list<RecoveredPacket*> RecoveredPacketList;
|
typedef std::list<RecoveredPacket*> RecoveredPacketList;
|
||||||
|
|
||||||
// \param[in] id Module ID
|
ForwardErrorCorrection();
|
||||||
ForwardErrorCorrection(int32_t id);
|
|
||||||
|
|
||||||
virtual ~ForwardErrorCorrection();
|
virtual ~ForwardErrorCorrection();
|
||||||
|
|
||||||
@ -304,7 +303,6 @@ class ForwardErrorCorrection {
|
|||||||
static void DiscardOldPackets(RecoveredPacketList* recovered_packet_list);
|
static void DiscardOldPackets(RecoveredPacketList* recovered_packet_list);
|
||||||
static uint16_t ParseSequenceNumber(uint8_t* packet);
|
static uint16_t ParseSequenceNumber(uint8_t* packet);
|
||||||
|
|
||||||
int32_t id_;
|
|
||||||
std::vector<Packet> generated_fec_packets_;
|
std::vector<Packet> generated_fec_packets_;
|
||||||
FecPacketList fec_packet_list_;
|
FecPacketList fec_packet_list_;
|
||||||
bool fec_packet_received_;
|
bool fec_packet_received_;
|
||||||
|
@ -164,7 +164,7 @@ class RtxLoopBackTransport : public webrtc::Transport {
|
|||||||
class RtpRtcpRtxNackTest : public ::testing::Test {
|
class RtpRtcpRtxNackTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
RtpRtcpRtxNackTest()
|
RtpRtcpRtxNackTest()
|
||||||
: rtp_payload_registry_(0, RTPPayloadStrategy::CreateStrategy(false)),
|
: rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)),
|
||||||
rtp_rtcp_module_(NULL),
|
rtp_rtcp_module_(NULL),
|
||||||
transport_(kTestSsrc + 1),
|
transport_(kTestSsrc + 1),
|
||||||
receiver_(),
|
receiver_(),
|
||||||
|
@ -39,7 +39,7 @@ void VerifyHeader(uint16_t seq_num,
|
|||||||
class ProducerFecTest : public ::testing::Test {
|
class ProducerFecTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
fec_ = new ForwardErrorCorrection(0);
|
fec_ = new ForwardErrorCorrection();
|
||||||
producer_ = new ProducerFec(fec_);
|
producer_ = new ProducerFec(fec_);
|
||||||
generator_ = new FrameGenerator;
|
generator_ = new FrameGenerator;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
|
||||||
|
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace rtcp {
|
namespace rtcp {
|
||||||
@ -233,8 +233,7 @@ void SenderReport::Create(uint8_t* packet,
|
|||||||
uint16_t* len,
|
uint16_t* len,
|
||||||
uint16_t max_len) const {
|
uint16_t max_len) const {
|
||||||
if (*len + Length() > max_len) {
|
if (*len + Length() > max_len) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max packet size reached.";
|
||||||
"Max packet size reached, skipped SR.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateSenderReport(sr_, packet, len);
|
CreateSenderReport(sr_, packet, len);
|
||||||
@ -244,8 +243,7 @@ void SenderReport::Create(uint8_t* packet,
|
|||||||
void SenderReport::WithReportBlock(ReportBlock* block) {
|
void SenderReport::WithReportBlock(ReportBlock* block) {
|
||||||
assert(block);
|
assert(block);
|
||||||
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
|
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max report blocks reached.";
|
||||||
"Max report block size reached.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
report_blocks_.push_back(block);
|
report_blocks_.push_back(block);
|
||||||
@ -256,8 +254,7 @@ void ReceiverReport::Create(uint8_t* packet,
|
|||||||
uint16_t* len,
|
uint16_t* len,
|
||||||
uint16_t max_len) const {
|
uint16_t max_len) const {
|
||||||
if (*len + Length() > max_len) {
|
if (*len + Length() > max_len) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max packet size reached.";
|
||||||
"Max packet size reached, skipped RR.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateReceiverReport(rr_, packet, len);
|
CreateReceiverReport(rr_, packet, len);
|
||||||
@ -267,8 +264,7 @@ void ReceiverReport::Create(uint8_t* packet,
|
|||||||
void ReceiverReport::WithReportBlock(ReportBlock* block) {
|
void ReceiverReport::WithReportBlock(ReportBlock* block) {
|
||||||
assert(block);
|
assert(block);
|
||||||
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
|
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max report blocks reached.";
|
||||||
"Max report block size reached.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
report_blocks_.push_back(block);
|
report_blocks_.push_back(block);
|
||||||
@ -277,8 +273,7 @@ void ReceiverReport::WithReportBlock(ReportBlock* block) {
|
|||||||
|
|
||||||
void Bye::Create(uint8_t* packet, uint16_t* len, uint16_t max_len) const {
|
void Bye::Create(uint8_t* packet, uint16_t* len, uint16_t max_len) const {
|
||||||
if (*len + Length() > max_len) {
|
if (*len + Length() > max_len) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max packet size reached.";
|
||||||
"Max packet size reached, skipped BYE.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateBye(bye_, csrcs_, packet, len);
|
CreateBye(bye_, csrcs_, packet, len);
|
||||||
@ -286,8 +281,7 @@ void Bye::Create(uint8_t* packet, uint16_t* len, uint16_t max_len) const {
|
|||||||
|
|
||||||
void Bye::WithCsrc(uint32_t csrc) {
|
void Bye::WithCsrc(uint32_t csrc) {
|
||||||
if (csrcs_.size() >= kMaxNumberOfCsrcs) {
|
if (csrcs_.size() >= kMaxNumberOfCsrcs) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max CSRC size reached.";
|
||||||
"Max CSRC size reached.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
csrcs_.push_back(csrc);
|
csrcs_.push_back(csrc);
|
||||||
@ -295,8 +289,7 @@ void Bye::WithCsrc(uint32_t csrc) {
|
|||||||
|
|
||||||
void Fir::Create(uint8_t* packet, uint16_t* len, uint16_t max_len) const {
|
void Fir::Create(uint8_t* packet, uint16_t* len, uint16_t max_len) const {
|
||||||
if (*len + Length() > max_len) {
|
if (*len + Length() > max_len) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Max packet size reached.";
|
||||||
"Max packet size reached, skipped FIR.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateFirRequest(fir_, fir_item_, packet, len);
|
CreateFirRequest(fir_, fir_item_, packet, len);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -57,7 +57,6 @@ RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock,
|
|||||||
_lastIncreasedSequenceNumberMs(0),
|
_lastIncreasedSequenceNumberMs(0),
|
||||||
stats_callback_(NULL) {
|
stats_callback_(NULL) {
|
||||||
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
|
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTCPReceiver::~RTCPReceiver() {
|
RTCPReceiver::~RTCPReceiver() {
|
||||||
@ -82,8 +81,6 @@ RTCPReceiver::~RTCPReceiver() {
|
|||||||
delete first->second;
|
delete first->second;
|
||||||
_receivedCnameMap.erase(first);
|
_receivedCnameMap.erase(first);
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id,
|
|
||||||
"%s deleted", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -178,8 +175,7 @@ int32_t RTCPReceiver::ResetRTT(const uint32_t remoteSSRC) {
|
|||||||
RTCPReportBlockInformation* reportBlock =
|
RTCPReportBlockInformation* reportBlock =
|
||||||
GetReportBlockInformation(remoteSSRC);
|
GetReportBlockInformation(remoteSSRC);
|
||||||
if (reportBlock == NULL) {
|
if (reportBlock == NULL) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Failed to reset rtt for ssrc " << remoteSSRC;
|
||||||
"\tfailed to GetReportBlockInformation(%u)", remoteSSRC);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
reportBlock->RTT = 0;
|
reportBlock->RTT = 0;
|
||||||
@ -282,22 +278,14 @@ bool RTCPReceiver::LastReceivedXrReferenceTimeInfo(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t RTCPReceiver::SenderInfoReceived(RTCPSenderInfo* senderInfo) const {
|
||||||
RTCPReceiver::SenderInfoReceived(RTCPSenderInfo* senderInfo) const
|
assert(senderInfo);
|
||||||
{
|
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||||
if(senderInfo == NULL)
|
if (_lastReceivedSRNTPsecs == 0) {
|
||||||
{
|
return -1;
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
}
|
||||||
return -1;
|
memcpy(senderInfo, &(_remoteSenderInfo), sizeof(RTCPSenderInfo));
|
||||||
}
|
return 0;
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
|
||||||
if(_lastReceivedSRNTPsecs == 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, "%s No received SR", __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
memcpy(senderInfo, &(_remoteSenderInfo), sizeof(RTCPSenderInfo));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// statistics
|
// statistics
|
||||||
@ -518,8 +506,8 @@ void RTCPReceiver::HandleReportBlock(
|
|||||||
RTCPReportBlockInformation* reportBlock =
|
RTCPReportBlockInformation* reportBlock =
|
||||||
CreateReportBlockInformation(remoteSSRC);
|
CreateReportBlockInformation(remoteSSRC);
|
||||||
if (reportBlock == NULL) {
|
if (reportBlock == NULL) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Failed to CreateReportBlockInformation("
|
||||||
"\tfailed to CreateReportBlockInformation(%u)", remoteSSRC);
|
<< remoteSSRC << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,9 +767,6 @@ int32_t RTCPReceiver::BoundingSet(bool &tmmbrOwner, TMMBRSet* boundingSetRec) {
|
|||||||
}
|
}
|
||||||
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
|
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
|
||||||
if (receiveInfo == NULL) {
|
if (receiveInfo == NULL) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
|
||||||
"%s failed to get RTCPReceiveInformation",
|
|
||||||
__FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (receiveInfo->TmmbnBoundingSet.lengthOfSet() > 0) {
|
if (receiveInfo->TmmbnBoundingSet.lengthOfSet() > 0) {
|
||||||
@ -1348,8 +1333,7 @@ int32_t RTCPReceiver::UpdateTMMBR() {
|
|||||||
TMMBRSet* boundingSet = NULL;
|
TMMBRSet* boundingSet = NULL;
|
||||||
numBoundingSet = FindTMMBRBoundingSet(boundingSet);
|
numBoundingSet = FindTMMBRBoundingSet(boundingSet);
|
||||||
if (numBoundingSet == -1) {
|
if (numBoundingSet == -1) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Failed to find TMMBR bounding set.";
|
||||||
"Failed to find TMMBR bounding set.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Set bounding set
|
// Set bounding set
|
||||||
@ -1369,8 +1353,6 @@ int32_t RTCPReceiver::UpdateTMMBR() {
|
|||||||
CriticalSectionScoped lock(_criticalSectionFeedbacks);
|
CriticalSectionScoped lock(_criticalSectionFeedbacks);
|
||||||
if (_cbRtcpBandwidthObserver) {
|
if (_cbRtcpBandwidthObserver) {
|
||||||
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000);
|
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000);
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id,
|
|
||||||
"Set TMMBR request:%d kbps", bitrate);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1395,9 +1377,6 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
|
|||||||
// Process TMMBR and REMB first to avoid multiple callbacks
|
// Process TMMBR and REMB first to avoid multiple callbacks
|
||||||
// to OnNetworkChanged.
|
// to OnNetworkChanged.
|
||||||
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpTmmbr) {
|
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpTmmbr) {
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
|
|
||||||
"SIG [RTCP] Incoming TMMBR to id:%d", _id);
|
|
||||||
|
|
||||||
// Might trigger a OnReceivedBandwidthEstimateUpdate.
|
// Might trigger a OnReceivedBandwidthEstimateUpdate.
|
||||||
UpdateTMMBR();
|
UpdateTMMBR();
|
||||||
}
|
}
|
||||||
@ -1412,9 +1391,8 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
|
|||||||
}
|
}
|
||||||
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
|
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
|
||||||
if (rtcpPacketInformation.nackSequenceNumbers.size() > 0) {
|
if (rtcpPacketInformation.nackSequenceNumbers.size() > 0) {
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
|
LOG(LS_INFO) << "Incoming NACK length: "
|
||||||
"SIG [RTCP] Incoming NACK length:%d",
|
<< rtcpPacketInformation.nackSequenceNumbers.size();
|
||||||
rtcpPacketInformation.nackSequenceNumbers.size());
|
|
||||||
_rtpRtcp.OnReceivedNACK(rtcpPacketInformation.nackSequenceNumbers);
|
_rtpRtcp.OnReceivedNACK(rtcpPacketInformation.nackSequenceNumbers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1429,13 +1407,11 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
|
|||||||
if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) ||
|
if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) ||
|
||||||
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpFir)) {
|
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpFir)) {
|
||||||
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) {
|
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) {
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
|
LOG(LS_INFO) << "Incoming PLI from SSRC "
|
||||||
"SIG [RTCP] Incoming PLI from SSRC:0x%x",
|
<< rtcpPacketInformation.remoteSSRC;
|
||||||
rtcpPacketInformation.remoteSSRC);
|
|
||||||
} else {
|
} else {
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
|
LOG(LS_INFO) << "Incoming FIR from SSRC "
|
||||||
"SIG [RTCP] Incoming FIR from SSRC:0x%x",
|
<< rtcpPacketInformation.remoteSSRC;
|
||||||
rtcpPacketInformation.remoteSSRC);
|
|
||||||
}
|
}
|
||||||
_cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc);
|
_cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc);
|
||||||
}
|
}
|
||||||
@ -1450,9 +1426,8 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
|
|||||||
}
|
}
|
||||||
if (_cbRtcpBandwidthObserver) {
|
if (_cbRtcpBandwidthObserver) {
|
||||||
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb) {
|
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb) {
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
|
LOG(LS_INFO) << "Incoming REMB: "
|
||||||
"SIG [RTCP] Incoming REMB:%d",
|
<< rtcpPacketInformation.receiverEstimatedMaxBitrate;
|
||||||
rtcpPacketInformation.receiverEstimatedMaxBitrate);
|
|
||||||
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(
|
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(
|
||||||
rtcpPacketInformation.receiverEstimatedMaxBitrate);
|
rtcpPacketInformation.receiverEstimatedMaxBitrate);
|
||||||
}
|
}
|
||||||
@ -1548,9 +1523,6 @@ int32_t RTCPReceiver::TMMBRReceived(const uint32_t size,
|
|||||||
while (receiveInfoIt != _receivedInfoMap.end()) {
|
while (receiveInfoIt != _receivedInfoMap.end()) {
|
||||||
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
|
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
|
||||||
if(receiveInfo == NULL) {
|
if(receiveInfo == NULL) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
|
||||||
"%s failed to get RTCPReceiveInformation",
|
|
||||||
__FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
num += receiveInfo->TmmbrSet.lengthOfSet();
|
num += receiveInfo->TmmbrSet.lengthOfSet();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "webrtc/common_types.h"
|
#include "webrtc/common_types.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -161,8 +161,6 @@ RTCPSender::RTCPSender(const int32_t id,
|
|||||||
memset(_CNAME, 0, sizeof(_CNAME));
|
memset(_CNAME, 0, sizeof(_CNAME));
|
||||||
memset(_lastSendReport, 0, sizeof(_lastSendReport));
|
memset(_lastSendReport, 0, sizeof(_lastSendReport));
|
||||||
memset(_lastRTCPTime, 0, sizeof(_lastRTCPTime));
|
memset(_lastRTCPTime, 0, sizeof(_lastRTCPTime));
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTCPSender::~RTCPSender() {
|
RTCPSender::~RTCPSender() {
|
||||||
@ -187,8 +185,6 @@ RTCPSender::~RTCPSender() {
|
|||||||
}
|
}
|
||||||
delete _criticalSectionTransport;
|
delete _criticalSectionTransport;
|
||||||
delete _criticalSectionRTCPSender;
|
delete _criticalSectionRTCPSender;
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s deleted", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
@ -427,7 +423,8 @@ RTCPSender::SetCameraDelay(const int32_t delayMS)
|
|||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
if(delayMS > 1000 || delayMS < -1000)
|
if(delayMS > 1000 || delayMS < -1000)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument, delay can't be larger than 1 sec", __FUNCTION__);
|
LOG(LS_WARNING) << "Delay can't be larger than 1 second: "
|
||||||
|
<< delayMS << " ms";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
_cameraDelayMS = delayMS;
|
_cameraDelayMS = delayMS;
|
||||||
@ -631,15 +628,10 @@ int32_t RTCPSender::AddReportBlock(
|
|||||||
uint32_t SSRC,
|
uint32_t SSRC,
|
||||||
std::map<uint32_t, RTCPReportBlock*>* report_blocks,
|
std::map<uint32_t, RTCPReportBlock*>* report_blocks,
|
||||||
const RTCPReportBlock* reportBlock) {
|
const RTCPReportBlock* reportBlock) {
|
||||||
if (reportBlock == NULL) {
|
assert(reportBlock);
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
|
||||||
"%s invalid argument", __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (report_blocks->size() >= RTCP_MAX_REPORT_BLOCKS) {
|
if (report_blocks->size() >= RTCP_MAX_REPORT_BLOCKS) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Too many report blocks.";
|
||||||
"%s invalid argument", __FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
std::map<uint32_t, RTCPReportBlock*>::iterator it =
|
std::map<uint32_t, RTCPReportBlock*>::iterator it =
|
||||||
@ -677,7 +669,7 @@ int32_t RTCPSender::BuildSR(const FeedbackState& feedback_state,
|
|||||||
// sanity
|
// sanity
|
||||||
if(pos + 52 >= IP_PACKET_SIZE)
|
if(pos + 52 >= IP_PACKET_SIZE)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
LOG(LS_WARNING) << "Failed to build Sender Report.";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
uint32_t RTPtime;
|
uint32_t RTPtime;
|
||||||
@ -760,8 +752,7 @@ int32_t RTCPSender::BuildSDEC(uint8_t* rtcpbuffer, int& pos) {
|
|||||||
|
|
||||||
// sanity
|
// sanity
|
||||||
if(pos + 12 + lengthCname >= IP_PACKET_SIZE) {
|
if(pos + 12 + lengthCname >= IP_PACKET_SIZE) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Failed to build SDEC.";
|
||||||
"%s invalid argument", __FUNCTION__);
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
// SDEC Source Description
|
// SDEC Source Description
|
||||||
@ -913,7 +904,9 @@ RTCPSender::BuildExtendedJitterReport(
|
|||||||
{
|
{
|
||||||
if (external_report_blocks_.size() > 0)
|
if (external_report_blocks_.size() > 0)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, "Not implemented.");
|
// TODO(andresp): Remove external report blocks since they are not
|
||||||
|
// supported.
|
||||||
|
LOG(LS_ERROR) << "Handling of external report blocks not implemented.";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1317,7 +1310,7 @@ RTCPSender::BuildTMMBN(uint8_t* rtcpbuffer, int& pos)
|
|||||||
// sanity
|
// sanity
|
||||||
if(pos + 12 + boundingSet->lengthOfSet()*8 >= IP_PACKET_SIZE)
|
if(pos + 12 + boundingSet->lengthOfSet()*8 >= IP_PACKET_SIZE)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
LOG(LS_WARNING) << "Failed to build TMMBN.";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
uint8_t FMT = 4;
|
uint8_t FMT = 4;
|
||||||
@ -1384,12 +1377,12 @@ RTCPSender::BuildAPP(uint8_t* rtcpbuffer, int& pos)
|
|||||||
// sanity
|
// sanity
|
||||||
if(_appData == NULL)
|
if(_appData == NULL)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, "%s invalid state", __FUNCTION__);
|
LOG(LS_WARNING) << "Failed to build app specific.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(pos + 12 + _appLength >= IP_PACKET_SIZE)
|
if(pos + 12 + _appLength >= IP_PACKET_SIZE)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
LOG(LS_WARNING) << "Failed to build app specific.";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
rtcpbuffer[pos++]=(uint8_t)0x80 + _appSubType;
|
rtcpbuffer[pos++]=(uint8_t)0x80 + _appSubType;
|
||||||
@ -1425,7 +1418,7 @@ RTCPSender::BuildNACK(uint8_t* rtcpbuffer,
|
|||||||
// sanity
|
// sanity
|
||||||
if(pos + 16 >= IP_PACKET_SIZE)
|
if(pos + 16 >= IP_PACKET_SIZE)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
LOG(LS_WARNING) << "Failed to build NACK.";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1478,8 +1471,7 @@ RTCPSender::BuildNACK(uint8_t* rtcpbuffer,
|
|||||||
numOfNackFields++;
|
numOfNackFields++;
|
||||||
}
|
}
|
||||||
if (i != nackSize) {
|
if (i != nackSize) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Nack list to large for one packet.";
|
||||||
"Nack list to large for one packet.");
|
|
||||||
}
|
}
|
||||||
rtcpbuffer[nackSizePos] = static_cast<uint8_t>(2 + numOfNackFields);
|
rtcpbuffer[nackSizePos] = static_cast<uint8_t>(2 + numOfNackFields);
|
||||||
*nackString = stringBuilder.GetResult();
|
*nackString = stringBuilder.GetResult();
|
||||||
@ -1715,8 +1707,7 @@ int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state,
|
|||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
if(_method == kRtcpOff)
|
if(_method == kRtcpOff)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Can't send rtcp if it is disabled.";
|
||||||
"%s invalid state", __FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2128,13 +2119,7 @@ int32_t
|
|||||||
RTCPSender::SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize],
|
RTCPSender::SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize],
|
||||||
const uint8_t arrLength)
|
const uint8_t arrLength)
|
||||||
{
|
{
|
||||||
if(arrLength > kRtpCsrcSize)
|
assert(arrLength <= kRtpCsrcSize);
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
|
||||||
assert(false);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
|
|
||||||
for(int i = 0; i < arrLength;i++)
|
for(int i = 0; i < arrLength;i++)
|
||||||
@ -2153,7 +2138,7 @@ RTCPSender::SetApplicationSpecificData(const uint8_t subType,
|
|||||||
{
|
{
|
||||||
if(length %4 != 0)
|
if(length %4 != 0)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
|
LOG(LS_ERROR) << "Failed to SetApplicationSpecificData.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
@ -2199,17 +2184,10 @@ int32_t RTCPSender::WriteAllReportBlocksToBuffer(
|
|||||||
uint8_t& numberOfReportBlocks,
|
uint8_t& numberOfReportBlocks,
|
||||||
const uint32_t NTPsec,
|
const uint32_t NTPsec,
|
||||||
const uint32_t NTPfrac) {
|
const uint32_t NTPfrac) {
|
||||||
// sanity one block
|
|
||||||
if(pos + 24 >= IP_PACKET_SIZE) {
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
|
||||||
"%s invalid argument", __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
numberOfReportBlocks = external_report_blocks_.size();
|
numberOfReportBlocks = external_report_blocks_.size();
|
||||||
numberOfReportBlocks += internal_report_blocks_.size();
|
numberOfReportBlocks += internal_report_blocks_.size();
|
||||||
if ((pos + numberOfReportBlocks * 24) >= IP_PACKET_SIZE) {
|
if ((pos + numberOfReportBlocks * 24) >= IP_PACKET_SIZE) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING) << "Can't fit all report blocks.";
|
||||||
"%s invalid argument", __FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pos = WriteReportBlocksToBuffer(rtcpbuffer, pos, internal_report_blocks_);
|
pos = WriteReportBlocksToBuffer(rtcpbuffer, pos, internal_report_blocks_);
|
||||||
|
@ -278,7 +278,7 @@ class RtcpSenderTest : public ::testing::Test {
|
|||||||
: over_use_detector_options_(),
|
: over_use_detector_options_(),
|
||||||
clock_(1335900000),
|
clock_(1335900000),
|
||||||
rtp_payload_registry_(new RTPPayloadRegistry(
|
rtp_payload_registry_(new RTPPayloadRegistry(
|
||||||
0, RTPPayloadStrategy::CreateStrategy(false))),
|
RTPPayloadStrategy::CreateStrategy(false))),
|
||||||
remote_bitrate_observer_(),
|
remote_bitrate_observer_(),
|
||||||
remote_bitrate_estimator_(
|
remote_bitrate_estimator_(
|
||||||
RemoteBitrateEstimatorFactory().Create(
|
RemoteBitrateEstimatorFactory().Create(
|
||||||
|
@ -41,7 +41,7 @@ template <typename T> void ClearList(std::list<T*>* my_list) {
|
|||||||
class RtpFecTest : public ::testing::Test {
|
class RtpFecTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
RtpFecTest()
|
RtpFecTest()
|
||||||
: fec_(new ForwardErrorCorrection(0)), ssrc_(rand()), fec_seq_num_(0) {}
|
: fec_(new ForwardErrorCorrection()), ssrc_(rand()), fec_seq_num_(0) {}
|
||||||
|
|
||||||
ForwardErrorCorrection* fec_;
|
ForwardErrorCorrection* fec_;
|
||||||
int ssrc_;
|
int ssrc_;
|
||||||
@ -86,43 +86,6 @@ class RtpFecTest : public ::testing::Test {
|
|||||||
void TearDown();
|
void TearDown();
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(marpan): Consider adding table for input/output to simplify tests.
|
|
||||||
|
|
||||||
TEST_F(RtpFecTest, HandleIncorrectInputs) {
|
|
||||||
int kNumImportantPackets = 0;
|
|
||||||
bool kUseUnequalProtection = false;
|
|
||||||
uint8_t kProtectionFactor = 60;
|
|
||||||
|
|
||||||
// Media packet list is empty.
|
|
||||||
EXPECT_EQ(-1, fec_->GenerateFEC(media_packet_list_, kProtectionFactor,
|
|
||||||
kNumImportantPackets, kUseUnequalProtection,
|
|
||||||
webrtc::kFecMaskBursty, &fec_packet_list_));
|
|
||||||
|
|
||||||
int num_media_packets = 10;
|
|
||||||
ConstructMediaPackets(num_media_packets);
|
|
||||||
|
|
||||||
kNumImportantPackets = -1;
|
|
||||||
// Number of important packets below 0.
|
|
||||||
EXPECT_EQ(-1, fec_->GenerateFEC(media_packet_list_, kProtectionFactor,
|
|
||||||
kNumImportantPackets, kUseUnequalProtection,
|
|
||||||
webrtc::kFecMaskBursty, &fec_packet_list_));
|
|
||||||
|
|
||||||
kNumImportantPackets = 12;
|
|
||||||
// Number of important packets greater than number of media packets.
|
|
||||||
EXPECT_EQ(-1, fec_->GenerateFEC(media_packet_list_, kProtectionFactor,
|
|
||||||
kNumImportantPackets, kUseUnequalProtection,
|
|
||||||
webrtc::kFecMaskBursty, &fec_packet_list_));
|
|
||||||
|
|
||||||
num_media_packets = kMaxNumberMediaPackets + 1;
|
|
||||||
ConstructMediaPackets(num_media_packets);
|
|
||||||
|
|
||||||
kNumImportantPackets = 0;
|
|
||||||
// Number of media packet is above maximum allowed (kMaxNumberMediaPackets).
|
|
||||||
EXPECT_EQ(-1, fec_->GenerateFEC(media_packet_list_, kProtectionFactor,
|
|
||||||
kNumImportantPackets, kUseUnequalProtection,
|
|
||||||
webrtc::kFecMaskBursty, &fec_packet_list_));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(RtpFecTest, FecRecoveryNoLoss) {
|
TEST_F(RtpFecTest, FecRecoveryNoLoss) {
|
||||||
const int kNumImportantPackets = 0;
|
const int kNumImportantPackets = 0;
|
||||||
const bool kUseUnequalProtection = false;
|
const bool kUseUnequalProtection = false;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -60,8 +59,6 @@ bool RtpHeaderParserImpl::Parse(const uint8_t* packet, int length,
|
|||||||
|
|
||||||
const bool valid_rtpheader = rtp_parser.Parse(*header, &map);
|
const bool valid_rtpheader = rtp_parser.Parse(*header, &map);
|
||||||
if (!valid_rtpheader) {
|
if (!valid_rtpheader) {
|
||||||
WEBRTC_TRACE(kTraceDebug, kTraceRtpRtcp, -1,
|
|
||||||
"IncomingPacket invalid RTP header");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -33,13 +33,21 @@ RTPPacketHistory::RTPPacketHistory(Clock* clock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RTPPacketHistory::~RTPPacketHistory() {
|
RTPPacketHistory::~RTPPacketHistory() {
|
||||||
Free();
|
{
|
||||||
|
CriticalSectionScoped cs(critsect_);
|
||||||
|
Free();
|
||||||
|
}
|
||||||
delete critsect_;
|
delete critsect_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPPacketHistory::SetStorePacketsStatus(bool enable,
|
void RTPPacketHistory::SetStorePacketsStatus(bool enable,
|
||||||
uint16_t number_to_store) {
|
uint16_t number_to_store) {
|
||||||
|
CriticalSectionScoped cs(critsect_);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
if (store_) {
|
||||||
|
LOG(LS_WARNING) << "Purging packet history in order to re-set status.";
|
||||||
|
Free();
|
||||||
|
}
|
||||||
Allocate(number_to_store);
|
Allocate(number_to_store);
|
||||||
} else {
|
} else {
|
||||||
Free();
|
Free();
|
||||||
@ -48,16 +56,7 @@ void RTPPacketHistory::SetStorePacketsStatus(bool enable,
|
|||||||
|
|
||||||
void RTPPacketHistory::Allocate(uint16_t number_to_store) {
|
void RTPPacketHistory::Allocate(uint16_t number_to_store) {
|
||||||
assert(number_to_store > 0);
|
assert(number_to_store > 0);
|
||||||
CriticalSectionScoped cs(critsect_);
|
assert(!store_);
|
||||||
if (store_) {
|
|
||||||
if (number_to_store != stored_packets_.size()) {
|
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
|
||||||
"SetStorePacketsStatus already set, number: %d",
|
|
||||||
number_to_store);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
store_ = true;
|
store_ = true;
|
||||||
stored_packets_.resize(number_to_store);
|
stored_packets_.resize(number_to_store);
|
||||||
stored_seq_nums_.resize(number_to_store);
|
stored_seq_nums_.resize(number_to_store);
|
||||||
@ -68,7 +67,6 @@ void RTPPacketHistory::Allocate(uint16_t number_to_store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RTPPacketHistory::Free() {
|
void RTPPacketHistory::Free() {
|
||||||
CriticalSectionScoped cs(critsect_);
|
|
||||||
if (!store_) {
|
if (!store_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -133,8 +131,8 @@ int32_t RTPPacketHistory::PutRTPPacket(const uint8_t* packet,
|
|||||||
VerifyAndAllocatePacketLength(max_packet_length);
|
VerifyAndAllocatePacketLength(max_packet_length);
|
||||||
|
|
||||||
if (packet_length > max_packet_length_) {
|
if (packet_length > max_packet_length_) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Failed to store RTP packet with length: "
|
||||||
"Failed to store RTP packet, length: %d", packet_length);
|
<< packet_length;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,25 +167,20 @@ int32_t RTPPacketHistory::ReplaceRTPHeader(const uint8_t* packet,
|
|||||||
|
|
||||||
assert(packet);
|
assert(packet);
|
||||||
assert(rtp_header_length > 3);
|
assert(rtp_header_length > 3);
|
||||||
|
assert(rtp_header_length <= max_packet_length_);
|
||||||
if (rtp_header_length > max_packet_length_) {
|
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
|
||||||
"Failed to replace RTP packet, length: %d", rtp_header_length);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
bool found = FindSeqNum(sequence_number, &index);
|
bool found = FindSeqNum(sequence_number, &index);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING)
|
||||||
"No match for getting seqNum %u", sequence_number);
|
<< "Failed to replace RTP packet due to missing sequence number.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t length = stored_lengths_.at(index);
|
uint16_t length = stored_lengths_.at(index);
|
||||||
if (length == 0 || length > max_packet_length_) {
|
if (length == 0 || length > max_packet_length_) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "No match for getting seqNum " << sequence_number
|
||||||
"No match for getting seqNum %u, len %d", sequence_number, length);
|
<< ", len " << length;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
assert(stored_seq_nums_[index] == sequence_number);
|
assert(stored_seq_nums_[index] == sequence_number);
|
||||||
@ -225,6 +218,7 @@ bool RTPPacketHistory::GetPacketAndSetSendTime(uint16_t sequence_number,
|
|||||||
uint8_t* packet,
|
uint8_t* packet,
|
||||||
uint16_t* packet_length,
|
uint16_t* packet_length,
|
||||||
int64_t* stored_time_ms) {
|
int64_t* stored_time_ms) {
|
||||||
|
assert(*packet_length >= max_packet_length_);
|
||||||
CriticalSectionScoped cs(critsect_);
|
CriticalSectionScoped cs(critsect_);
|
||||||
if (!store_) {
|
if (!store_) {
|
||||||
return false;
|
return false;
|
||||||
@ -233,21 +227,15 @@ bool RTPPacketHistory::GetPacketAndSetSendTime(uint16_t sequence_number,
|
|||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
bool found = FindSeqNum(sequence_number, &index);
|
bool found = FindSeqNum(sequence_number, &index);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "No match for getting seqNum " << sequence_number;
|
||||||
"No match for getting seqNum %u", sequence_number);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t length = stored_lengths_.at(index);
|
uint16_t length = stored_lengths_.at(index);
|
||||||
if (length == 0 || length > max_packet_length_) {
|
assert(length <= max_packet_length_);
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
if (length == 0) {
|
||||||
"No match for getting seqNum %u, len %d", sequence_number, length);
|
LOG(LS_WARNING) << "No match for getting seqNum " << sequence_number
|
||||||
return false;
|
<< ", len " << length;
|
||||||
}
|
|
||||||
|
|
||||||
if (length > *packet_length) {
|
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
|
||||||
"Input buffer too short for packet %u", sequence_number);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,8 +243,6 @@ bool RTPPacketHistory::GetPacketAndSetSendTime(uint16_t sequence_number,
|
|||||||
int64_t now = clock_->TimeInMilliseconds();
|
int64_t now = clock_->TimeInMilliseconds();
|
||||||
if (min_elapsed_time_ms > 0 &&
|
if (min_elapsed_time_ms > 0 &&
|
||||||
((now - stored_send_times_.at(index)) < min_elapsed_time_ms)) {
|
((now - stored_send_times_.at(index)) < min_elapsed_time_ms)) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
|
||||||
"Skip getting packet %u, packet recently resent.", sequence_number);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "webrtc/modules/interface/module_common_types.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/thread_annotations.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -74,8 +75,8 @@ class RTPPacketHistory {
|
|||||||
private:
|
private:
|
||||||
void GetPacket(int index, uint8_t* packet, uint16_t* packet_length,
|
void GetPacket(int index, uint8_t* packet, uint16_t* packet_length,
|
||||||
int64_t* stored_time_ms) const;
|
int64_t* stored_time_ms) const;
|
||||||
void Allocate(uint16_t number_to_store);
|
void Allocate(uint16_t number_to_store) EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||||
void Free();
|
void Free() EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||||
void VerifyAndAllocatePacketLength(uint16_t packet_length);
|
void VerifyAndAllocatePacketLength(uint16_t packet_length);
|
||||||
bool FindSeqNum(uint16_t sequence_number, int32_t* index) const;
|
bool FindSeqNum(uint16_t sequence_number, int32_t* index) const;
|
||||||
int FindBestFittingPacket(uint16_t size) const;
|
int FindBestFittingPacket(uint16_t size) const;
|
||||||
|
@ -103,19 +103,6 @@ TEST_F(RtpPacketHistoryTest, PutRtpPacket_TooLargePacketLength) {
|
|||||||
kAllowRetransmission));
|
kAllowRetransmission));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(RtpPacketHistoryTest, GetRtpPacket_TooSmallBuffer) {
|
|
||||||
hist_->SetStorePacketsStatus(true, 10);
|
|
||||||
uint16_t len = 0;
|
|
||||||
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
|
|
||||||
CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len);
|
|
||||||
EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, kMaxPacketLength,
|
|
||||||
capture_time_ms, kAllowRetransmission));
|
|
||||||
uint16_t len_out = len - 1;
|
|
||||||
int64_t time;
|
|
||||||
EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, 0, false, packet_,
|
|
||||||
&len_out, &time));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(RtpPacketHistoryTest, GetRtpPacket_NotStored) {
|
TEST_F(RtpPacketHistoryTest, GetRtpPacket_NotStored) {
|
||||||
hist_->SetStorePacketsStatus(true, 10);
|
hist_->SetStorePacketsStatus(true, 10);
|
||||||
uint16_t len = kMaxPacketLength;
|
uint16_t len = kMaxPacketLength;
|
||||||
@ -161,8 +148,8 @@ TEST_F(RtpPacketHistoryTest, ReplaceRtpHeader) {
|
|||||||
uint16_t len = 0;
|
uint16_t len = 0;
|
||||||
int64_t capture_time_ms = 1;
|
int64_t capture_time_ms = 1;
|
||||||
CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len);
|
CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len);
|
||||||
|
|
||||||
// Replace should fail, packet is not stored.
|
// Replace should fail, packet is not stored.
|
||||||
EXPECT_EQ(-1, hist_->ReplaceRTPHeader(packet_, kSeqNum, len));
|
|
||||||
EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, kMaxPacketLength,
|
EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, kMaxPacketLength,
|
||||||
capture_time_ms, kAllowRetransmission));
|
capture_time_ms, kAllowRetransmission));
|
||||||
|
|
||||||
@ -181,10 +168,6 @@ TEST_F(RtpPacketHistoryTest, ReplaceRtpHeader) {
|
|||||||
EXPECT_EQ(packet_[i], packet_out_[i]);
|
EXPECT_EQ(packet_[i], packet_out_[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace should fail, too large length.
|
|
||||||
EXPECT_EQ(-1, hist_->ReplaceRTPHeader(packet_, kSeqNum,
|
|
||||||
kMaxPacketLength + 1));
|
|
||||||
|
|
||||||
// Replace should fail, packet is not stored.
|
// Replace should fail, packet is not stored.
|
||||||
len = 0;
|
len = 0;
|
||||||
CreateRtpPacket(kSeqNum + 1, kSsrc, kPayload, kTimestamp, packet_, &len);
|
CreateRtpPacket(kSeqNum + 1, kSsrc, kPayload, kTimestamp, packet_, &len);
|
||||||
@ -236,10 +219,10 @@ TEST_F(RtpPacketHistoryTest, MinResendTime) {
|
|||||||
capture_time_ms, kAllowRetransmission));
|
capture_time_ms, kAllowRetransmission));
|
||||||
|
|
||||||
int64_t time;
|
int64_t time;
|
||||||
|
len = kMaxPacketLength;
|
||||||
EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, 100, false, packet_, &len,
|
EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, 100, false, packet_, &len,
|
||||||
&time));
|
&time));
|
||||||
fake_clock_.AdvanceTimeMilliseconds(100);
|
fake_clock_.AdvanceTimeMilliseconds(100);
|
||||||
|
|
||||||
// Time has elapsed.
|
// Time has elapsed.
|
||||||
len = kMaxPacketLength;
|
len = kMaxPacketLength;
|
||||||
EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, 100, false, packet_, &len,
|
EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, 100, false, packet_, &len,
|
||||||
|
@ -10,15 +10,13 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
||||||
|
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
RTPPayloadRegistry::RTPPayloadRegistry(
|
RTPPayloadRegistry::RTPPayloadRegistry(
|
||||||
const int32_t id,
|
|
||||||
RTPPayloadStrategy* rtp_payload_strategy)
|
RTPPayloadStrategy* rtp_payload_strategy)
|
||||||
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
id_(id),
|
|
||||||
rtp_payload_strategy_(rtp_payload_strategy),
|
rtp_payload_strategy_(rtp_payload_strategy),
|
||||||
red_payload_type_(-1),
|
red_payload_type_(-1),
|
||||||
ulpfec_payload_type_(-1),
|
ulpfec_payload_type_(-1),
|
||||||
@ -60,9 +58,8 @@ int32_t RTPPayloadRegistry::RegisterReceivePayload(
|
|||||||
case 77: // 205 Transport layer FB message.
|
case 77: // 205 Transport layer FB message.
|
||||||
case 78: // 206 Payload-specific FB message.
|
case 78: // 206 Payload-specific FB message.
|
||||||
case 79: // 207 Extended report.
|
case 79: // 207 Extended report.
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_ERROR) << "Can't register invalid receiver payload type: "
|
||||||
"%s invalid payloadtype:%d",
|
<< payload_type;
|
||||||
__FUNCTION__, payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -94,9 +91,7 @@ int32_t RTPPayloadRegistry::RegisterReceivePayload(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_ERROR) << "Payload type already registered: " << payload_type;
|
||||||
"%s invalid argument payload_type:%d already registered",
|
|
||||||
__FUNCTION__, payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,14 +133,8 @@ int32_t RTPPayloadRegistry::DeRegisterReceivePayload(
|
|||||||
const int8_t payload_type) {
|
const int8_t payload_type) {
|
||||||
CriticalSectionScoped cs(crit_sect_.get());
|
CriticalSectionScoped cs(crit_sect_.get());
|
||||||
ModuleRTPUtility::PayloadTypeMap::iterator it =
|
ModuleRTPUtility::PayloadTypeMap::iterator it =
|
||||||
payload_type_map_.find(payload_type);
|
payload_type_map_.find(payload_type);
|
||||||
|
assert(it != payload_type_map_.end());
|
||||||
if (it == payload_type_map_.end()) {
|
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"%s failed to find payload_type:%d",
|
|
||||||
__FUNCTION__, payload_type);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
delete it->second;
|
delete it->second;
|
||||||
payload_type_map_.erase(it);
|
payload_type_map_.erase(it);
|
||||||
return 0;
|
return 0;
|
||||||
@ -194,11 +183,7 @@ int32_t RTPPayloadRegistry::ReceivePayloadType(
|
|||||||
const uint8_t channels,
|
const uint8_t channels,
|
||||||
const uint32_t rate,
|
const uint32_t rate,
|
||||||
int8_t* payload_type) const {
|
int8_t* payload_type) const {
|
||||||
if (payload_type == NULL) {
|
assert(payload_type);
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"%s invalid argument", __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
size_t payload_name_length = strlen(payload_name);
|
size_t payload_name_length = strlen(payload_name);
|
||||||
|
|
||||||
CriticalSectionScoped cs(crit_sect_.get());
|
CriticalSectionScoped cs(crit_sect_.get());
|
||||||
@ -296,8 +281,7 @@ bool RTPPayloadRegistry::RestoreOriginalPacket(uint8_t** restored_packet,
|
|||||||
(*restored_packet)[1] |= kRtpMarkerBitMask; // Marker bit is set.
|
(*restored_packet)[1] |= kRtpMarkerBitMask; // Marker bit is set.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Incorrect RTX configuration, dropping packet.";
|
||||||
"Incorrect RTX configuration, dropping packet.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,7 @@ class RtpPayloadRegistryTest : public ::testing::Test {
|
|||||||
void SetUp() {
|
void SetUp() {
|
||||||
// Note: the payload registry takes ownership of the strategy.
|
// Note: the payload registry takes ownership of the strategy.
|
||||||
mock_payload_strategy_ = new testing::NiceMock<MockRTPPayloadStrategy>();
|
mock_payload_strategy_ = new testing::NiceMock<MockRTPPayloadStrategy>();
|
||||||
rtp_payload_registry_.reset(
|
rtp_payload_registry_.reset(new RTPPayloadRegistry(mock_payload_strategy_));
|
||||||
new RTPPayloadRegistry(123, mock_payload_strategy_));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <string.h> // memcpy()
|
#include <string.h> // memcpy()
|
||||||
|
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -277,11 +277,8 @@ int32_t RTPReceiverAudio::InvokeOnInitializeDecoder(
|
|||||||
specific_payload.Audio.frequency,
|
specific_payload.Audio.frequency,
|
||||||
specific_payload.Audio.channels,
|
specific_payload.Audio.channels,
|
||||||
specific_payload.Audio.rate)) {
|
specific_payload.Audio.rate)) {
|
||||||
WEBRTC_TRACE(kTraceError,
|
LOG(LS_ERROR) << "Failed to create decoder for payload type: "
|
||||||
kTraceRtpRtcp,
|
<< payload_name << "/" << payload_type;
|
||||||
id,
|
|
||||||
"Failed to create video decoder for payload type:%d",
|
|
||||||
payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ RtpReceiver* RtpReceiver::CreateVideoReceiver(
|
|||||||
return new RtpReceiverImpl(
|
return new RtpReceiverImpl(
|
||||||
id, clock, NullObjectRtpAudioFeedback(), incoming_messages_callback,
|
id, clock, NullObjectRtpAudioFeedback(), incoming_messages_callback,
|
||||||
rtp_payload_registry,
|
rtp_payload_registry,
|
||||||
RTPReceiverStrategy::CreateVideoStrategy(id, incoming_payload_callback));
|
RTPReceiverStrategy::CreateVideoStrategy(incoming_payload_callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
RtpReceiver* RtpReceiver::CreateAudioReceiver(
|
RtpReceiver* RtpReceiver::CreateAudioReceiver(
|
||||||
@ -87,8 +87,6 @@ RtpReceiverImpl::RtpReceiverImpl(int32_t id,
|
|||||||
assert(incoming_messages_callback);
|
assert(incoming_messages_callback);
|
||||||
|
|
||||||
memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_));
|
memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_));
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RtpReceiverImpl::~RtpReceiverImpl() {
|
RtpReceiverImpl::~RtpReceiverImpl() {
|
||||||
@ -96,7 +94,6 @@ RtpReceiverImpl::~RtpReceiverImpl() {
|
|||||||
cb_rtp_feedback_->OnIncomingCSRCChanged(id_, current_remote_csrc_[i],
|
cb_rtp_feedback_->OnIncomingCSRCChanged(id_, current_remote_csrc_[i],
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s deleted", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPReceiverStrategy* RtpReceiverImpl::GetMediaReceiver() const {
|
RTPReceiverStrategy* RtpReceiverImpl::GetMediaReceiver() const {
|
||||||
@ -127,9 +124,8 @@ int32_t RtpReceiverImpl::RegisterReceivePayload(
|
|||||||
if (created_new_payload) {
|
if (created_new_payload) {
|
||||||
if (rtp_media_receiver_->OnNewPayloadTypeCreated(payload_name, payload_type,
|
if (rtp_media_receiver_->OnNewPayloadTypeCreated(payload_name, payload_type,
|
||||||
frequency) != 0) {
|
frequency) != 0) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_ERROR) << "Failed to register payload: " << payload_name << "/"
|
||||||
"%s failed to register payload",
|
<< payload_type;
|
||||||
__FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,19 +178,12 @@ bool RtpReceiverImpl::IncomingRtpPacket(
|
|||||||
PayloadUnion payload_specific,
|
PayloadUnion payload_specific,
|
||||||
bool in_order) {
|
bool in_order) {
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
if (payload_length < 0) {
|
assert(payload_length >= 0);
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"%s invalid argument",
|
|
||||||
__FUNCTION__);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int8_t first_payload_byte = 0;
|
|
||||||
if (payload_length > 0) {
|
|
||||||
first_payload_byte = payload[0];
|
|
||||||
}
|
|
||||||
// Trigger our callbacks.
|
// Trigger our callbacks.
|
||||||
CheckSSRCChanged(rtp_header);
|
CheckSSRCChanged(rtp_header);
|
||||||
|
|
||||||
|
int8_t first_payload_byte = payload_length > 0 ? payload[0] : 0;
|
||||||
bool is_red = false;
|
bool is_red = false;
|
||||||
bool should_reset_statistics = false;
|
bool should_reset_statistics = false;
|
||||||
|
|
||||||
@ -205,14 +194,9 @@ bool RtpReceiverImpl::IncomingRtpPacket(
|
|||||||
&should_reset_statistics) == -1) {
|
&should_reset_statistics) == -1) {
|
||||||
if (payload_length == 0) {
|
if (payload_length == 0) {
|
||||||
// OK, keep-alive packet.
|
// OK, keep-alive packet.
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
|
||||||
"%s received keepalive",
|
|
||||||
__FUNCTION__);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Receiving invalid payload type.";
|
||||||
"%s received invalid payloadtype",
|
|
||||||
__FUNCTION__);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,9 +331,8 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
|
|||||||
id_, rtp_header.payloadType, payload_name,
|
id_, rtp_header.payloadType, payload_name,
|
||||||
rtp_header.payload_type_frequency, channels, rate)) {
|
rtp_header.payload_type_frequency, channels, rate)) {
|
||||||
// New stream, same codec.
|
// New stream, same codec.
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_ERROR) << "Failed to create decoder for payload type: "
|
||||||
"Failed to create decoder for payload type:%d",
|
<< rtp_header.payloadType;
|
||||||
rtp_header.payloadType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,7 @@ class TelephoneEventHandler;
|
|||||||
// This class is not thread-safe and must be protected by its caller.
|
// This class is not thread-safe and must be protected by its caller.
|
||||||
class RTPReceiverStrategy {
|
class RTPReceiverStrategy {
|
||||||
public:
|
public:
|
||||||
static RTPReceiverStrategy* CreateVideoStrategy(int32_t id,
|
static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback);
|
||||||
RtpData* data_callback);
|
|
||||||
static RTPReceiverStrategy* CreateAudioStrategy(
|
static RTPReceiverStrategy* CreateAudioStrategy(
|
||||||
int32_t id, RtpData* data_callback,
|
int32_t id, RtpData* data_callback,
|
||||||
RtpAudioFeedback* incoming_messages_callback);
|
RtpAudioFeedback* incoming_messages_callback);
|
||||||
|
@ -17,19 +17,18 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
RTPReceiverStrategy* RTPReceiverStrategy::CreateVideoStrategy(
|
RTPReceiverStrategy* RTPReceiverStrategy::CreateVideoStrategy(
|
||||||
int32_t id, RtpData* data_callback) {
|
RtpData* data_callback) {
|
||||||
return new RTPReceiverVideo(id, data_callback);
|
return new RTPReceiverVideo(data_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPReceiverVideo::RTPReceiverVideo(int32_t id, RtpData* data_callback)
|
RTPReceiverVideo::RTPReceiverVideo(RtpData* data_callback)
|
||||||
: RTPReceiverStrategy(data_callback),
|
: RTPReceiverStrategy(data_callback) {}
|
||||||
id_(id) {}
|
|
||||||
|
|
||||||
RTPReceiverVideo::~RTPReceiverVideo() {
|
RTPReceiverVideo::~RTPReceiverVideo() {
|
||||||
}
|
}
|
||||||
@ -93,11 +92,8 @@ int32_t RTPReceiverVideo::InvokeOnInitializeDecoder(
|
|||||||
// For video we just go with default values.
|
// For video we just go with default values.
|
||||||
if (-1 == callback->OnInitializeDecoder(
|
if (-1 == callback->OnInitializeDecoder(
|
||||||
id, payload_type, payload_name, kVideoPayloadTypeFrequency, 1, 0)) {
|
id, payload_type, payload_name, kVideoPayloadTypeFrequency, 1, 0)) {
|
||||||
WEBRTC_TRACE(kTraceError,
|
LOG(LS_ERROR) << "Failed to created decoder for payload type: "
|
||||||
kTraceRtpRtcp,
|
<< payload_type;
|
||||||
id,
|
|
||||||
"Failed to create video decoder for payload type:%d",
|
|
||||||
payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -111,13 +107,6 @@ int32_t RTPReceiverVideo::ParseVideoCodecSpecific(
|
|||||||
RtpVideoCodecTypes video_type,
|
RtpVideoCodecTypes video_type,
|
||||||
int64_t now_ms,
|
int64_t now_ms,
|
||||||
bool is_first_packet) {
|
bool is_first_packet) {
|
||||||
WEBRTC_TRACE(kTraceStream,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"%s(timestamp:%u)",
|
|
||||||
__FUNCTION__,
|
|
||||||
rtp_header->header.timestamp);
|
|
||||||
|
|
||||||
switch (rtp_header->type.Video.codec) {
|
switch (rtp_header->type.Video.codec) {
|
||||||
case kRtpVideoGeneric:
|
case kRtpVideoGeneric:
|
||||||
rtp_header->type.Video.isFirstPacket = is_first_packet;
|
rtp_header->type.Video.isFirstPacket = is_first_packet;
|
||||||
@ -170,13 +159,8 @@ int32_t RTPReceiverVideo::ReceiveVp8Codec(WebRtcRTPHeader* rtp_header,
|
|||||||
const uint8_t* payload_data,
|
const uint8_t* payload_data,
|
||||||
uint16_t payload_data_length) {
|
uint16_t payload_data_length) {
|
||||||
ModuleRTPUtility::RTPPayload parsed_packet;
|
ModuleRTPUtility::RTPPayload parsed_packet;
|
||||||
uint32_t id;
|
|
||||||
{
|
|
||||||
CriticalSectionScoped cs(crit_sect_.get());
|
|
||||||
id = id_;
|
|
||||||
}
|
|
||||||
ModuleRTPUtility::RTPPayloadParser rtp_payload_parser(
|
ModuleRTPUtility::RTPPayloadParser rtp_payload_parser(
|
||||||
kRtpVideoVp8, payload_data, payload_data_length, id);
|
kRtpVideoVp8, payload_data, payload_data_length);
|
||||||
|
|
||||||
if (!rtp_payload_parser.Parse(parsed_packet))
|
if (!rtp_payload_parser.Parse(parsed_packet))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -22,7 +22,7 @@ namespace webrtc {
|
|||||||
|
|
||||||
class RTPReceiverVideo : public RTPReceiverStrategy {
|
class RTPReceiverVideo : public RTPReceiverStrategy {
|
||||||
public:
|
public:
|
||||||
RTPReceiverVideo(const int32_t id, RtpData* data_callback);
|
RTPReceiverVideo(RtpData* data_callback);
|
||||||
|
|
||||||
virtual ~RTPReceiverVideo();
|
virtual ~RTPReceiverVideo();
|
||||||
|
|
||||||
@ -80,8 +80,6 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
|
|||||||
RtpVideoCodecTypes video_type,
|
RtpVideoCodecTypes video_type,
|
||||||
int64_t now_ms,
|
int64_t now_ms,
|
||||||
bool is_first_packet);
|
bool is_first_packet);
|
||||||
|
|
||||||
int32_t id_;
|
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
|
@ -110,13 +110,9 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
|||||||
uint32_t SSRC = rtp_sender_.SSRC();
|
uint32_t SSRC = rtp_sender_.SSRC();
|
||||||
rtcp_sender_.SetSSRC(SSRC);
|
rtcp_sender_.SetSSRC(SSRC);
|
||||||
SetRtcpReceiverSsrcs(SSRC);
|
SetRtcpReceiverSsrcs(SSRC);
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s created", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() {
|
ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() {
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s deleted", __FUNCTION__);
|
|
||||||
|
|
||||||
// All child modules MUST be deleted before deleting the default.
|
// All child modules MUST be deleted before deleting the default.
|
||||||
assert(child_modules_.empty());
|
assert(child_modules_.empty());
|
||||||
|
|
||||||
@ -134,12 +130,6 @@ ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ModuleRtpRtcpImpl::RegisterChildModule(RtpRtcp* module) {
|
void ModuleRtpRtcpImpl::RegisterChildModule(RtpRtcp* module) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"RegisterChildModule(module:0x%x)",
|
|
||||||
module);
|
|
||||||
|
|
||||||
CriticalSectionScoped lock(
|
CriticalSectionScoped lock(
|
||||||
critical_section_module_ptrs_.get());
|
critical_section_module_ptrs_.get());
|
||||||
CriticalSectionScoped double_lock(
|
CriticalSectionScoped double_lock(
|
||||||
@ -153,11 +143,6 @@ void ModuleRtpRtcpImpl::RegisterChildModule(RtpRtcp* module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ModuleRtpRtcpImpl::DeRegisterChildModule(RtpRtcp* remove_module) {
|
void ModuleRtpRtcpImpl::DeRegisterChildModule(RtpRtcp* remove_module) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"DeRegisterChildModule(module:0x%x)", remove_module);
|
|
||||||
|
|
||||||
CriticalSectionScoped lock(
|
CriticalSectionScoped lock(
|
||||||
critical_section_module_ptrs_.get());
|
critical_section_module_ptrs_.get());
|
||||||
CriticalSectionScoped double_lock(
|
CriticalSectionScoped double_lock(
|
||||||
@ -282,29 +267,12 @@ void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type) {
|
|||||||
int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket(
|
int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket(
|
||||||
const uint8_t* rtcp_packet,
|
const uint8_t* rtcp_packet,
|
||||||
const uint16_t length) {
|
const uint16_t length) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
|
||||||
"IncomingRtcpPacket(packet_length:%u)", length);
|
|
||||||
// Minimum RTP is 12 bytes.
|
|
||||||
// Minimum RTCP is 8 bytes (RTCP BYE).
|
|
||||||
if (length == 8) {
|
|
||||||
WEBRTC_TRACE(kTraceDebug, kTraceRtpRtcp, -1,
|
|
||||||
"IncomingRtcpPacket invalid length");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check RTP version.
|
|
||||||
const uint8_t version = rtcp_packet[0] >> 6;
|
|
||||||
if (version != 2) {
|
|
||||||
WEBRTC_TRACE(kTraceDebug, kTraceRtpRtcp, -1,
|
|
||||||
"IncomingRtcpPacket invalid RTP version");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Allow receive of non-compound RTCP packets.
|
// Allow receive of non-compound RTCP packets.
|
||||||
RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true);
|
RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true);
|
||||||
|
|
||||||
const bool valid_rtcpheader = rtcp_parser.IsValid();
|
const bool valid_rtcpheader = rtcp_parser.IsValid();
|
||||||
if (!valid_rtcpheader) {
|
if (!valid_rtcpheader) {
|
||||||
WEBRTC_TRACE(kTraceDebug, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Incoming invalid RTCP packet";
|
||||||
"IncomingRtcpPacket invalid RTCP packet");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
RTCPHelp::RTCPPacketInformation rtcp_packet_information;
|
RTCPHelp::RTCPPacketInformation rtcp_packet_information;
|
||||||
@ -318,14 +286,6 @@ int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket(
|
|||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
||||||
const CodecInst& voice_codec) {
|
const CodecInst& voice_codec) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"RegisterSendPayload(pl_name:%s pl_type:%d frequency:%u)",
|
|
||||||
voice_codec.plname,
|
|
||||||
voice_codec.pltype,
|
|
||||||
voice_codec.plfreq);
|
|
||||||
|
|
||||||
return rtp_sender_.RegisterPayload(
|
return rtp_sender_.RegisterPayload(
|
||||||
voice_codec.plname,
|
voice_codec.plname,
|
||||||
voice_codec.pltype,
|
voice_codec.pltype,
|
||||||
@ -336,13 +296,6 @@ int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
|||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
||||||
const VideoCodec& video_codec) {
|
const VideoCodec& video_codec) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"RegisterSendPayload(pl_name:%s pl_type:%d)",
|
|
||||||
video_codec.plName,
|
|
||||||
video_codec.plType);
|
|
||||||
|
|
||||||
send_video_codec_ = video_codec;
|
send_video_codec_ = video_codec;
|
||||||
{
|
{
|
||||||
// simulcast_ is accessed when accessing child_modules_, so this write needs
|
// simulcast_ is accessed when accessing child_modules_, so this write needs
|
||||||
@ -359,11 +312,6 @@ int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
|||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(
|
int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(
|
||||||
const int8_t payload_type) {
|
const int8_t payload_type) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"DeRegisterSendPayload(%d)", payload_type);
|
|
||||||
|
|
||||||
return rtp_sender_.DeRegisterSendPayload(payload_type);
|
return rtp_sender_.DeRegisterSendPayload(payload_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,53 +320,34 @@ int8_t ModuleRtpRtcpImpl::SendPayloadType() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ModuleRtpRtcpImpl::StartTimestamp() const {
|
uint32_t ModuleRtpRtcpImpl::StartTimestamp() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "StartTimestamp()");
|
|
||||||
|
|
||||||
return rtp_sender_.StartTimestamp();
|
return rtp_sender_.StartTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure start timestamp, default is a random number.
|
// Configure start timestamp, default is a random number.
|
||||||
int32_t ModuleRtpRtcpImpl::SetStartTimestamp(
|
int32_t ModuleRtpRtcpImpl::SetStartTimestamp(
|
||||||
const uint32_t timestamp) {
|
const uint32_t timestamp) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetStartTimestamp(%d)",
|
|
||||||
timestamp);
|
|
||||||
rtcp_sender_.SetStartTimestamp(timestamp);
|
rtcp_sender_.SetStartTimestamp(timestamp);
|
||||||
rtp_sender_.SetStartTimestamp(timestamp, true);
|
rtp_sender_.SetStartTimestamp(timestamp, true);
|
||||||
return 0; // TODO(pwestin): change to void.
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ModuleRtpRtcpImpl::SequenceNumber() const {
|
uint16_t ModuleRtpRtcpImpl::SequenceNumber() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SequenceNumber()");
|
|
||||||
|
|
||||||
return rtp_sender_.SequenceNumber();
|
return rtp_sender_.SequenceNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set SequenceNumber, default is a random number.
|
// Set SequenceNumber, default is a random number.
|
||||||
int32_t ModuleRtpRtcpImpl::SetSequenceNumber(
|
int32_t ModuleRtpRtcpImpl::SetSequenceNumber(
|
||||||
const uint16_t seq_num) {
|
const uint16_t seq_num) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetSequenceNumber(%d)",
|
|
||||||
seq_num);
|
|
||||||
|
|
||||||
rtp_sender_.SetSequenceNumber(seq_num);
|
rtp_sender_.SetSequenceNumber(seq_num);
|
||||||
return 0; // TODO(pwestin): change to void.
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ModuleRtpRtcpImpl::SSRC() const {
|
uint32_t ModuleRtpRtcpImpl::SSRC() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SSRC()");
|
|
||||||
|
|
||||||
return rtp_sender_.SSRC();
|
return rtp_sender_.SSRC();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure SSRC, default is a random number.
|
// Configure SSRC, default is a random number.
|
||||||
int32_t ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) {
|
int32_t ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetSSRC(%d)", ssrc);
|
|
||||||
|
|
||||||
rtp_sender_.SetSSRC(ssrc);
|
rtp_sender_.SetSSRC(ssrc);
|
||||||
rtcp_sender_.SetSSRC(ssrc);
|
rtcp_sender_.SetSSRC(ssrc);
|
||||||
SetRtcpReceiverSsrcs(ssrc);
|
SetRtcpReceiverSsrcs(ssrc);
|
||||||
@ -434,20 +363,12 @@ int32_t ModuleRtpRtcpImpl::SetCSRCStatus(const bool include) {
|
|||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::CSRCs(
|
int32_t ModuleRtpRtcpImpl::CSRCs(
|
||||||
uint32_t arr_of_csrc[kRtpCsrcSize]) const {
|
uint32_t arr_of_csrc[kRtpCsrcSize]) const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "CSRCs()");
|
|
||||||
|
|
||||||
return rtp_sender_.CSRCs(arr_of_csrc);
|
return rtp_sender_.CSRCs(arr_of_csrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetCSRCs(
|
int32_t ModuleRtpRtcpImpl::SetCSRCs(
|
||||||
const uint32_t arr_of_csrc[kRtpCsrcSize],
|
const uint32_t arr_of_csrc[kRtpCsrcSize],
|
||||||
const uint8_t arr_length) {
|
const uint8_t arr_length) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetCSRCs(arr_length:%d)",
|
|
||||||
arr_length);
|
|
||||||
|
|
||||||
if (IsDefaultModule()) {
|
if (IsDefaultModule()) {
|
||||||
// For default we need to update all child modules too.
|
// For default we need to update all child modules too.
|
||||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||||
@ -461,10 +382,6 @@ int32_t ModuleRtpRtcpImpl::SetCSRCs(
|
|||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < arr_length; ++i) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "\tidx:%d CSRC:%u", i,
|
|
||||||
arr_of_csrc[i]);
|
|
||||||
}
|
|
||||||
rtcp_sender_.SetCSRCs(arr_of_csrc, arr_length);
|
rtcp_sender_.SetCSRCs(arr_of_csrc, arr_length);
|
||||||
rtp_sender_.SetCSRCs(arr_of_csrc, arr_length);
|
rtp_sender_.SetCSRCs(arr_of_csrc, arr_length);
|
||||||
}
|
}
|
||||||
@ -472,35 +389,23 @@ int32_t ModuleRtpRtcpImpl::SetCSRCs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ModuleRtpRtcpImpl::PacketCountSent() const {
|
uint32_t ModuleRtpRtcpImpl::PacketCountSent() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "PacketCountSent()");
|
|
||||||
return rtp_sender_.Packets();
|
return rtp_sender_.Packets();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ModuleRtpRtcpImpl::ByteCountSent() const {
|
uint32_t ModuleRtpRtcpImpl::ByteCountSent() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ByteCountSent()");
|
|
||||||
return rtp_sender_.Bytes();
|
return rtp_sender_.Bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModuleRtpRtcpImpl::CurrentSendFrequencyHz() const {
|
int ModuleRtpRtcpImpl::CurrentSendFrequencyHz() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"CurrentSendFrequencyHz()");
|
|
||||||
return rtp_sender_.SendPayloadFrequency();
|
return rtp_sender_.SendPayloadFrequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
|
int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
|
||||||
if (sending) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetSendingStatus(sending)");
|
|
||||||
} else {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetSendingStatus(stopped)");
|
|
||||||
}
|
|
||||||
if (rtcp_sender_.Sending() != sending) {
|
if (rtcp_sender_.Sending() != sending) {
|
||||||
// Sends RTCP BYE when going from true to false
|
// Sends RTCP BYE when going from true to false
|
||||||
RTCPSender::FeedbackState feedback_state(this);
|
RTCPSender::FeedbackState feedback_state(this);
|
||||||
if (rtcp_sender_.SetSendingStatus(feedback_state, sending) != 0) {
|
if (rtcp_sender_.SetSendingStatus(feedback_state, sending) != 0) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to send RTCP BYE";
|
||||||
"Failed to send RTCP BYE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
collision_detected_ = false;
|
collision_detected_ = false;
|
||||||
@ -525,25 +430,15 @@ int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleRtpRtcpImpl::Sending() const {
|
bool ModuleRtpRtcpImpl::Sending() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "Sending()");
|
|
||||||
return rtcp_sender_.Sending();
|
return rtcp_sender_.Sending();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
|
int32_t ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
|
||||||
if (sending) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetSendingMediaStatus(sending)");
|
|
||||||
} else {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetSendingMediaStatus(stopped)");
|
|
||||||
}
|
|
||||||
rtp_sender_.SetSendingMediaStatus(sending);
|
rtp_sender_.SetSendingMediaStatus(sending);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleRtpRtcpImpl::SendingMedia() const {
|
bool ModuleRtpRtcpImpl::SendingMedia() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "Sending()");
|
|
||||||
|
|
||||||
if (!IsDefaultModule()) {
|
if (!IsDefaultModule()) {
|
||||||
return rtp_sender_.SendingMedia();
|
return rtp_sender_.SendingMedia();
|
||||||
}
|
}
|
||||||
@ -569,13 +464,6 @@ int32_t ModuleRtpRtcpImpl::SendOutgoingData(
|
|||||||
uint32_t payload_size,
|
uint32_t payload_size,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
const RTPVideoHeader* rtp_video_hdr) {
|
const RTPVideoHeader* rtp_video_hdr) {
|
||||||
WEBRTC_TRACE(
|
|
||||||
kTraceStream,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SendOutgoingData(frame_type:%d payload_type:%d time_stamp:%u size:%u)",
|
|
||||||
frame_type, payload_type, time_stamp, payload_size);
|
|
||||||
|
|
||||||
rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
|
rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
|
||||||
|
|
||||||
if (!IsDefaultModule()) {
|
if (!IsDefaultModule()) {
|
||||||
@ -619,11 +507,6 @@ int32_t ModuleRtpRtcpImpl::SendOutgoingData(
|
|||||||
if (it == child_modules_.end()) {
|
if (it == child_modules_.end()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SendOutgoingData(SimulcastIdx:%u size:%u, ssrc:0x%x)",
|
|
||||||
idx, payload_size, (*it)->rtp_sender_.SSRC());
|
|
||||||
return (*it)->SendOutgoingData(frame_type,
|
return (*it)->SendOutgoingData(frame_type,
|
||||||
payload_type,
|
payload_type,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
@ -656,13 +539,6 @@ bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
|
|||||||
uint16_t sequence_number,
|
uint16_t sequence_number,
|
||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
bool retransmission) {
|
bool retransmission) {
|
||||||
WEBRTC_TRACE(
|
|
||||||
kTraceStream,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"TimeToSendPacket(ssrc:0x%x sequence_number:%u capture_time_ms:%ll)",
|
|
||||||
ssrc, sequence_number, capture_time_ms);
|
|
||||||
|
|
||||||
if (!IsDefaultModule()) {
|
if (!IsDefaultModule()) {
|
||||||
// Don't send from default module.
|
// Don't send from default module.
|
||||||
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
|
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
|
||||||
@ -686,9 +562,6 @@ bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ModuleRtpRtcpImpl::TimeToSendPadding(int bytes) {
|
int ModuleRtpRtcpImpl::TimeToSendPadding(int bytes) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_, "TimeToSendPadding(bytes: %d)",
|
|
||||||
bytes);
|
|
||||||
|
|
||||||
if (!IsDefaultModule()) {
|
if (!IsDefaultModule()) {
|
||||||
// Don't send from default module.
|
// Don't send from default module.
|
||||||
if (SendingMedia()) {
|
if (SendingMedia()) {
|
||||||
@ -721,16 +594,10 @@ bool ModuleRtpRtcpImpl::GetSendSideDelay(int* avg_send_delay_ms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const {
|
uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "MaxPayloadLength()");
|
|
||||||
return rtp_sender_.MaxPayloadLength();
|
return rtp_sender_.MaxPayloadLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ModuleRtpRtcpImpl::MaxDataPayloadLength() const {
|
uint16_t ModuleRtpRtcpImpl::MaxDataPayloadLength() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"MaxDataPayloadLength()");
|
|
||||||
|
|
||||||
// Assuming IP/UDP.
|
// Assuming IP/UDP.
|
||||||
uint16_t min_data_payload_length = IP_PACKET_SIZE - 28;
|
uint16_t min_data_payload_length = IP_PACKET_SIZE - 28;
|
||||||
|
|
||||||
@ -763,13 +630,6 @@ int32_t ModuleRtpRtcpImpl::SetTransportOverhead(
|
|||||||
const bool tcp,
|
const bool tcp,
|
||||||
const bool ipv6,
|
const bool ipv6,
|
||||||
const uint8_t authentication_overhead) {
|
const uint8_t authentication_overhead) {
|
||||||
WEBRTC_TRACE(
|
|
||||||
kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetTransportOverhead(TCP:%d, IPV6:%d authentication_overhead:%u)",
|
|
||||||
tcp, ipv6, authentication_overhead);
|
|
||||||
|
|
||||||
uint16_t packet_overhead = 0;
|
uint16_t packet_overhead = 0;
|
||||||
if (ipv6) {
|
if (ipv6) {
|
||||||
packet_overhead = 40;
|
packet_overhead = 40;
|
||||||
@ -801,11 +661,8 @@ int32_t ModuleRtpRtcpImpl::SetTransportOverhead(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(const uint16_t mtu) {
|
int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(const uint16_t mtu) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetMaxTransferUnit(%u)",
|
|
||||||
mtu);
|
|
||||||
if (mtu > IP_PACKET_SIZE) {
|
if (mtu > IP_PACKET_SIZE) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_ERROR) << "Invalid mtu: " << mtu;
|
||||||
"Invalid in argument to SetMaxTransferUnit(%u)", mtu);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return rtp_sender_.SetMaxPayloadLength(mtu - packet_overhead_,
|
return rtp_sender_.SetMaxPayloadLength(mtu - packet_overhead_,
|
||||||
@ -813,7 +670,6 @@ int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(const uint16_t mtu) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RTCPMethod ModuleRtpRtcpImpl::RTCP() const {
|
RTCPMethod ModuleRtpRtcpImpl::RTCP() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RTCP()");
|
|
||||||
if (rtcp_sender_.Status() != kRtcpOff) {
|
if (rtcp_sender_.Status() != kRtcpOff) {
|
||||||
return rtcp_receiver_.Status();
|
return rtcp_receiver_.Status();
|
||||||
}
|
}
|
||||||
@ -822,8 +678,6 @@ RTCPMethod ModuleRtpRtcpImpl::RTCP() const {
|
|||||||
|
|
||||||
// Configure RTCP status i.e on/off.
|
// Configure RTCP status i.e on/off.
|
||||||
int32_t ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) {
|
int32_t ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRTCPStatus(%d)",
|
|
||||||
method);
|
|
||||||
if (rtcp_sender_.SetRTCPStatus(method) == 0) {
|
if (rtcp_sender_.SetRTCPStatus(method) == 0) {
|
||||||
return rtcp_receiver_.SetRTCPStatus(method);
|
return rtcp_receiver_.SetRTCPStatus(method);
|
||||||
}
|
}
|
||||||
@ -837,34 +691,26 @@ uint32_t ModuleRtpRtcpImpl::LastSendReport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetCNAME(const char c_name[RTCP_CNAME_SIZE]) {
|
int32_t ModuleRtpRtcpImpl::SetCNAME(const char c_name[RTCP_CNAME_SIZE]) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetCNAME(%s)", c_name);
|
|
||||||
return rtcp_sender_.SetCNAME(c_name);
|
return rtcp_sender_.SetCNAME(c_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::CNAME(char c_name[RTCP_CNAME_SIZE]) {
|
int32_t ModuleRtpRtcpImpl::CNAME(char c_name[RTCP_CNAME_SIZE]) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "CNAME()");
|
|
||||||
return rtcp_sender_.CNAME(c_name);
|
return rtcp_sender_.CNAME(c_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::AddMixedCNAME(
|
int32_t ModuleRtpRtcpImpl::AddMixedCNAME(
|
||||||
const uint32_t ssrc,
|
const uint32_t ssrc,
|
||||||
const char c_name[RTCP_CNAME_SIZE]) {
|
const char c_name[RTCP_CNAME_SIZE]) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"AddMixedCNAME(SSRC:%u)", ssrc);
|
|
||||||
return rtcp_sender_.AddMixedCNAME(ssrc, c_name);
|
return rtcp_sender_.AddMixedCNAME(ssrc, c_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RemoveMixedCNAME(const uint32_t ssrc) {
|
int32_t ModuleRtpRtcpImpl::RemoveMixedCNAME(const uint32_t ssrc) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"RemoveMixedCNAME(SSRC:%u)", ssrc);
|
|
||||||
return rtcp_sender_.RemoveMixedCNAME(ssrc);
|
return rtcp_sender_.RemoveMixedCNAME(ssrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RemoteCNAME(
|
int32_t ModuleRtpRtcpImpl::RemoteCNAME(
|
||||||
const uint32_t remote_ssrc,
|
const uint32_t remote_ssrc,
|
||||||
char c_name[RTCP_CNAME_SIZE]) const {
|
char c_name[RTCP_CNAME_SIZE]) const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"RemoteCNAME(SSRC:%u)", remote_ssrc);
|
|
||||||
return rtcp_receiver_.CNAME(remote_ssrc, c_name);
|
return rtcp_receiver_.CNAME(remote_ssrc, c_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,7 +720,6 @@ int32_t ModuleRtpRtcpImpl::RemoteNTP(
|
|||||||
uint32_t* rtcp_arrival_time_secs,
|
uint32_t* rtcp_arrival_time_secs,
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
uint32_t* rtcp_arrival_time_frac,
|
||||||
uint32_t* rtcp_timestamp) const {
|
uint32_t* rtcp_timestamp) const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteNTP()");
|
|
||||||
return rtcp_receiver_.NTP(received_ntpsecs,
|
return rtcp_receiver_.NTP(received_ntpsecs,
|
||||||
received_ntpfrac,
|
received_ntpfrac,
|
||||||
rtcp_arrival_time_secs,
|
rtcp_arrival_time_secs,
|
||||||
@ -888,21 +733,16 @@ int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
|
|||||||
uint16_t* avg_rtt,
|
uint16_t* avg_rtt,
|
||||||
uint16_t* min_rtt,
|
uint16_t* min_rtt,
|
||||||
uint16_t* max_rtt) const {
|
uint16_t* max_rtt) const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RTT()");
|
|
||||||
return rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt);
|
return rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset RoundTripTime statistics.
|
// Reset RoundTripTime statistics.
|
||||||
int32_t ModuleRtpRtcpImpl::ResetRTT(const uint32_t remote_ssrc) {
|
int32_t ModuleRtpRtcpImpl::ResetRTT(const uint32_t remote_ssrc) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "ResetRTT(SSRC:%u)",
|
|
||||||
remote_ssrc);
|
|
||||||
return rtcp_receiver_.ResetRTT(remote_ssrc);
|
return rtcp_receiver_.ResetRTT(remote_ssrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset RTP data counters for the sending side.
|
// Reset RTP data counters for the sending side.
|
||||||
int32_t ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
|
int32_t ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"ResetSendDataCountersRTP()");
|
|
||||||
rtp_sender_.ResetDataCounters();
|
rtp_sender_.ResetDataCounters();
|
||||||
return 0; // TODO(pwestin): change to void.
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
@ -910,8 +750,6 @@ int32_t ModuleRtpRtcpImpl::ResetSendDataCountersRTP() {
|
|||||||
// Force a send of an RTCP packet.
|
// Force a send of an RTCP packet.
|
||||||
// Normal SR and RR are triggered via the process function.
|
// Normal SR and RR are triggered via the process function.
|
||||||
int32_t ModuleRtpRtcpImpl::SendRTCP(uint32_t rtcp_packet_type) {
|
int32_t ModuleRtpRtcpImpl::SendRTCP(uint32_t rtcp_packet_type) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SendRTCP(0x%x)",
|
|
||||||
rtcp_packet_type);
|
|
||||||
RTCPSender::FeedbackState feedback_state(this);
|
RTCPSender::FeedbackState feedback_state(this);
|
||||||
return rtcp_sender_.SendRTCP(feedback_state, rtcp_packet_type);
|
return rtcp_sender_.SendRTCP(feedback_state, rtcp_packet_type);
|
||||||
}
|
}
|
||||||
@ -921,23 +759,16 @@ int32_t ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData(
|
|||||||
const uint32_t name,
|
const uint32_t name,
|
||||||
const uint8_t* data,
|
const uint8_t* data,
|
||||||
const uint16_t length) {
|
const uint16_t length) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetRTCPApplicationSpecificData(sub_type:%d name:0x%x)",
|
|
||||||
sub_type, name);
|
|
||||||
return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
|
return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// (XR) VOIP metric.
|
// (XR) VOIP metric.
|
||||||
int32_t ModuleRtpRtcpImpl::SetRTCPVoIPMetrics(
|
int32_t ModuleRtpRtcpImpl::SetRTCPVoIPMetrics(
|
||||||
const RTCPVoIPMetric* voip_metric) {
|
const RTCPVoIPMetric* voip_metric) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetRTCPVoIPMetrics()");
|
|
||||||
|
|
||||||
return rtcp_sender_.SetRTCPVoIPMetrics(voip_metric);
|
return rtcp_sender_.SetRTCPVoIPMetrics(voip_metric);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) {
|
void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetRtcpXrRrtrStatus(%s)", enable ? "true" : "false");
|
|
||||||
return rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable);
|
return rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -948,7 +779,6 @@ bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const {
|
|||||||
int32_t ModuleRtpRtcpImpl::DataCountersRTP(
|
int32_t ModuleRtpRtcpImpl::DataCountersRTP(
|
||||||
uint32_t* bytes_sent,
|
uint32_t* bytes_sent,
|
||||||
uint32_t* packets_sent) const {
|
uint32_t* packets_sent) const {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_, "DataCountersRTP()");
|
|
||||||
if (bytes_sent) {
|
if (bytes_sent) {
|
||||||
*bytes_sent = rtp_sender_.Bytes();
|
*bytes_sent = rtp_sender_.Bytes();
|
||||||
}
|
}
|
||||||
@ -959,27 +789,23 @@ int32_t ModuleRtpRtcpImpl::DataCountersRTP(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) {
|
int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteRTCPStat()");
|
|
||||||
return rtcp_receiver_.SenderInfoReceived(sender_info);
|
return rtcp_receiver_.SenderInfoReceived(sender_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Received RTCP report.
|
// Received RTCP report.
|
||||||
int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
|
int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
|
||||||
std::vector<RTCPReportBlock>* receive_blocks) const {
|
std::vector<RTCPReportBlock>* receive_blocks) const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoteRTCPStat()");
|
|
||||||
return rtcp_receiver_.StatisticsReceived(receive_blocks);
|
return rtcp_receiver_.StatisticsReceived(receive_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::AddRTCPReportBlock(
|
int32_t ModuleRtpRtcpImpl::AddRTCPReportBlock(
|
||||||
const uint32_t ssrc,
|
const uint32_t ssrc,
|
||||||
const RTCPReportBlock* report_block) {
|
const RTCPReportBlock* report_block) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "AddRTCPReportBlock()");
|
|
||||||
return rtcp_sender_.AddExternalReportBlock(ssrc, report_block);
|
return rtcp_sender_.AddExternalReportBlock(ssrc, report_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RemoveRTCPReportBlock(
|
int32_t ModuleRtpRtcpImpl::RemoveRTCPReportBlock(
|
||||||
const uint32_t ssrc) {
|
const uint32_t ssrc) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "RemoveRTCPReportBlock()");
|
|
||||||
return rtcp_sender_.RemoveExternalReportBlock(ssrc);
|
return rtcp_sender_.RemoveExternalReportBlock(ssrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,44 +818,25 @@ void ModuleRtpRtcpImpl::GetRtcpPacketTypeCounters(
|
|||||||
|
|
||||||
// (REMB) Receiver Estimated Max Bitrate.
|
// (REMB) Receiver Estimated Max Bitrate.
|
||||||
bool ModuleRtpRtcpImpl::REMB() const {
|
bool ModuleRtpRtcpImpl::REMB() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "REMB()");
|
|
||||||
return rtcp_sender_.REMB();
|
return rtcp_sender_.REMB();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetREMBStatus(const bool enable) {
|
int32_t ModuleRtpRtcpImpl::SetREMBStatus(const bool enable) {
|
||||||
if (enable) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetREMBStatus(enable)");
|
|
||||||
} else {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetREMBStatus(disable)");
|
|
||||||
}
|
|
||||||
return rtcp_sender_.SetREMBStatus(enable);
|
return rtcp_sender_.SetREMBStatus(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate,
|
int32_t ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate,
|
||||||
const uint8_t number_of_ssrc,
|
const uint8_t number_of_ssrc,
|
||||||
const uint32_t* ssrc) {
|
const uint32_t* ssrc) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetREMBData(bitrate:%d,?,?)", bitrate);
|
|
||||||
return rtcp_sender_.SetREMBData(bitrate, number_of_ssrc, ssrc);
|
return rtcp_sender_.SetREMBData(bitrate, number_of_ssrc, ssrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// (IJ) Extended jitter report.
|
// (IJ) Extended jitter report.
|
||||||
bool ModuleRtpRtcpImpl::IJ() const {
|
bool ModuleRtpRtcpImpl::IJ() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "IJ()");
|
|
||||||
return rtcp_sender_.IJ();
|
return rtcp_sender_.IJ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetIJStatus(const bool enable) {
|
int32_t ModuleRtpRtcpImpl::SetIJStatus(const bool enable) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetIJStatus(%s)", enable ? "true" : "false");
|
|
||||||
return rtcp_sender_.SetIJStatus(enable);
|
return rtcp_sender_.SetIJStatus(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1046,23 +853,14 @@ int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
|
|||||||
|
|
||||||
// (TMMBR) Temporary Max Media Bit Rate.
|
// (TMMBR) Temporary Max Media Bit Rate.
|
||||||
bool ModuleRtpRtcpImpl::TMMBR() const {
|
bool ModuleRtpRtcpImpl::TMMBR() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "TMMBR()");
|
|
||||||
return rtcp_sender_.TMMBR();
|
return rtcp_sender_.TMMBR();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) {
|
int32_t ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) {
|
||||||
if (enable) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetTMMBRStatus(enable)");
|
|
||||||
} else {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetTMMBRStatus(disable)");
|
|
||||||
}
|
|
||||||
return rtcp_sender_.SetTMMBRStatus(enable);
|
return rtcp_sender_.SetTMMBRStatus(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetTMMBN(const TMMBRSet* bounding_set) {
|
int32_t ModuleRtpRtcpImpl::SetTMMBN(const TMMBRSet* bounding_set) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SetTMMBN()");
|
|
||||||
uint32_t max_bitrate_kbit =
|
uint32_t max_bitrate_kbit =
|
||||||
rtp_sender_.MaxConfiguredBitrateVideo() / 1000;
|
rtp_sender_.MaxConfiguredBitrateVideo() / 1000;
|
||||||
return rtcp_sender_.SetTMMBN(bounding_set, max_bitrate_kbit);
|
return rtcp_sender_.SetTMMBN(bounding_set, max_bitrate_kbit);
|
||||||
@ -1070,32 +868,18 @@ int32_t ModuleRtpRtcpImpl::SetTMMBN(const TMMBRSet* bounding_set) {
|
|||||||
|
|
||||||
// Returns the currently configured retransmission mode.
|
// Returns the currently configured retransmission mode.
|
||||||
int ModuleRtpRtcpImpl::SelectiveRetransmissions() const {
|
int ModuleRtpRtcpImpl::SelectiveRetransmissions() const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SelectiveRetransmissions()");
|
|
||||||
return rtp_sender_.SelectiveRetransmissions();
|
return rtp_sender_.SelectiveRetransmissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable or disable a retransmission mode, which decides which packets will
|
// Enable or disable a retransmission mode, which decides which packets will
|
||||||
// be retransmitted if NACKed.
|
// be retransmitted if NACKed.
|
||||||
int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
|
int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetSelectiveRetransmissions(%u)",
|
|
||||||
settings);
|
|
||||||
return rtp_sender_.SetSelectiveRetransmissions(settings);
|
return rtp_sender_.SetSelectiveRetransmissions(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a Negative acknowledgment packet.
|
// Send a Negative acknowledgment packet.
|
||||||
int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
|
int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
|
||||||
const uint16_t size) {
|
const uint16_t size) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SendNACK(size:%u)", size);
|
|
||||||
|
|
||||||
// Use RTT from RtcpRttStats class if provided.
|
// Use RTT from RtcpRttStats class if provided.
|
||||||
uint16_t rtt = rtt_ms();
|
uint16_t rtt = rtt_ms();
|
||||||
if (rtt == 0) {
|
if (rtt == 0) {
|
||||||
@ -1149,14 +933,6 @@ int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
|
|||||||
int32_t ModuleRtpRtcpImpl::SetStorePacketsStatus(
|
int32_t ModuleRtpRtcpImpl::SetStorePacketsStatus(
|
||||||
const bool enable,
|
const bool enable,
|
||||||
const uint16_t number_to_store) {
|
const uint16_t number_to_store) {
|
||||||
if (enable) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetStorePacketsStatus(enable, number_to_store:%d)",
|
|
||||||
number_to_store);
|
|
||||||
} else {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetStorePacketsStatus(disable)");
|
|
||||||
}
|
|
||||||
rtp_sender_.SetStorePacketsStatus(enable, number_to_store);
|
rtp_sender_.SetStorePacketsStatus(enable, number_to_store);
|
||||||
return 0; // TODO(pwestin): change to void.
|
return 0; // TODO(pwestin): change to void.
|
||||||
}
|
}
|
||||||
@ -1180,19 +956,11 @@ int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(
|
|||||||
const uint8_t key,
|
const uint8_t key,
|
||||||
const uint16_t time_ms,
|
const uint16_t time_ms,
|
||||||
const uint8_t level) {
|
const uint8_t level) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SendTelephoneEventOutband(key:%u, time_ms:%u, level:%u)", key,
|
|
||||||
time_ms, level);
|
|
||||||
return rtp_sender_.SendTelephoneEvent(key, time_ms, level);
|
return rtp_sender_.SendTelephoneEvent(key, time_ms, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleRtpRtcpImpl::SendTelephoneEventActive(
|
bool ModuleRtpRtcpImpl::SendTelephoneEventActive(
|
||||||
int8_t& telephone_event) const {
|
int8_t& telephone_event) const {
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SendTelephoneEventActive()");
|
|
||||||
return rtp_sender_.SendTelephoneEventActive(&telephone_event);
|
return rtp_sender_.SendTelephoneEventActive(&telephone_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1200,40 +968,23 @@ bool ModuleRtpRtcpImpl::SendTelephoneEventActive(
|
|||||||
// packet in silence (CNG).
|
// packet in silence (CNG).
|
||||||
int32_t ModuleRtpRtcpImpl::SetAudioPacketSize(
|
int32_t ModuleRtpRtcpImpl::SetAudioPacketSize(
|
||||||
const uint16_t packet_size_samples) {
|
const uint16_t packet_size_samples) {
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetAudioPacketSize(%u)",
|
|
||||||
packet_size_samples);
|
|
||||||
return rtp_sender_.SetAudioPacketSize(packet_size_samples);
|
return rtp_sender_.SetAudioPacketSize(packet_size_samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetAudioLevel(
|
int32_t ModuleRtpRtcpImpl::SetAudioLevel(
|
||||||
const uint8_t level_d_bov) {
|
const uint8_t level_d_bov) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetAudioLevel(level_d_bov:%u)",
|
|
||||||
level_d_bov);
|
|
||||||
return rtp_sender_.SetAudioLevel(level_d_bov);
|
return rtp_sender_.SetAudioLevel(level_d_bov);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198.
|
// Set payload type for Redundant Audio Data RFC 2198.
|
||||||
int32_t ModuleRtpRtcpImpl::SetSendREDPayloadType(
|
int32_t ModuleRtpRtcpImpl::SetSendREDPayloadType(
|
||||||
const int8_t payload_type) {
|
const int8_t payload_type) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetSendREDPayloadType(%d)",
|
|
||||||
payload_type);
|
|
||||||
return rtp_sender_.SetRED(payload_type);
|
return rtp_sender_.SetRED(payload_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198.
|
// Get payload type for Redundant Audio Data RFC 2198.
|
||||||
int32_t ModuleRtpRtcpImpl::SendREDPayloadType(
|
int32_t ModuleRtpRtcpImpl::SendREDPayloadType(
|
||||||
int8_t& payload_type) const {
|
int8_t& payload_type) const {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "SendREDPayloadType()");
|
|
||||||
return rtp_sender_.RED(&payload_type);
|
return rtp_sender_.RED(&payload_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,8 +994,6 @@ RtpVideoCodecTypes ModuleRtpRtcpImpl::SendVideoCodec() const {
|
|||||||
|
|
||||||
void ModuleRtpRtcpImpl::SetTargetSendBitrate(
|
void ModuleRtpRtcpImpl::SetTargetSendBitrate(
|
||||||
const std::vector<uint32_t>& stream_bitrates) {
|
const std::vector<uint32_t>& stream_bitrates) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
|
||||||
"SetTargetSendBitrate: %ld streams", stream_bitrates.size());
|
|
||||||
if (IsDefaultModule()) {
|
if (IsDefaultModule()) {
|
||||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||||
if (simulcast_) {
|
if (simulcast_) {
|
||||||
@ -1275,20 +1024,11 @@ void ModuleRtpRtcpImpl::SetTargetSendBitrate(
|
|||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
|
int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
|
||||||
const KeyFrameRequestMethod method) {
|
const KeyFrameRequestMethod method) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetKeyFrameRequestMethod(method:%u)",
|
|
||||||
method);
|
|
||||||
key_frame_req_method_ = method;
|
key_frame_req_method_ = method;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RequestKeyFrame() {
|
int32_t ModuleRtpRtcpImpl::RequestKeyFrame() {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"RequestKeyFrame");
|
|
||||||
switch (key_frame_req_method_) {
|
switch (key_frame_req_method_) {
|
||||||
case kKeyFrameReqFirRtp:
|
case kKeyFrameReqFirRtp:
|
||||||
return rtp_sender_.SendRTPIntraRequest();
|
return rtp_sender_.SendRTPIntraRequest();
|
||||||
@ -1302,22 +1042,12 @@ int32_t ModuleRtpRtcpImpl::RequestKeyFrame() {
|
|||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SendRTCPSliceLossIndication(
|
int32_t ModuleRtpRtcpImpl::SendRTCPSliceLossIndication(
|
||||||
const uint8_t picture_id) {
|
const uint8_t picture_id) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SendRTCPSliceLossIndication (picture_id:%d)",
|
|
||||||
picture_id);
|
|
||||||
RTCPSender::FeedbackState feedback_state(this);
|
RTCPSender::FeedbackState feedback_state(this);
|
||||||
return rtcp_sender_.SendRTCP(
|
return rtcp_sender_.SendRTCP(
|
||||||
feedback_state, kRtcpSli, 0, 0, false, picture_id);
|
feedback_state, kRtcpSli, 0, 0, false, picture_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetCameraDelay(const int32_t delay_ms) {
|
int32_t ModuleRtpRtcpImpl::SetCameraDelay(const int32_t delay_ms) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetCameraDelay(%d)",
|
|
||||||
delay_ms);
|
|
||||||
if (IsDefaultModule()) {
|
if (IsDefaultModule()) {
|
||||||
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
CriticalSectionScoped lock(critical_section_module_ptrs_.get());
|
||||||
std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
|
std::list<ModuleRtpRtcpImpl*>::iterator it = child_modules_.begin();
|
||||||
@ -1337,18 +1067,6 @@ int32_t ModuleRtpRtcpImpl::SetGenericFECStatus(
|
|||||||
const bool enable,
|
const bool enable,
|
||||||
const uint8_t payload_type_red,
|
const uint8_t payload_type_red,
|
||||||
const uint8_t payload_type_fec) {
|
const uint8_t payload_type_fec) {
|
||||||
if (enable) {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetGenericFECStatus(enable, %u)",
|
|
||||||
payload_type_red);
|
|
||||||
} else {
|
|
||||||
WEBRTC_TRACE(kTraceModuleCall,
|
|
||||||
kTraceRtpRtcp,
|
|
||||||
id_,
|
|
||||||
"SetGenericFECStatus(disable)");
|
|
||||||
}
|
|
||||||
return rtp_sender_.SetGenericFECStatus(enable,
|
return rtp_sender_.SetGenericFECStatus(enable,
|
||||||
payload_type_red,
|
payload_type_red,
|
||||||
payload_type_fec);
|
payload_type_fec);
|
||||||
@ -1358,8 +1076,6 @@ int32_t ModuleRtpRtcpImpl::GenericFECStatus(
|
|||||||
bool& enable,
|
bool& enable,
|
||||||
uint8_t& payload_type_red,
|
uint8_t& payload_type_red,
|
||||||
uint8_t& payload_type_fec) {
|
uint8_t& payload_type_fec) {
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "GenericFECStatus()");
|
|
||||||
|
|
||||||
bool child_enabled = false;
|
bool child_enabled = false;
|
||||||
if (IsDefaultModule()) {
|
if (IsDefaultModule()) {
|
||||||
// For default we need to check all child modules too.
|
// For default we need to check all child modules too.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -105,9 +105,8 @@ RTPSender::RTPSender(const int32_t id,
|
|||||||
audio_ = new RTPSenderAudio(id, clock_, this);
|
audio_ = new RTPSenderAudio(id, clock_, this);
|
||||||
audio_->RegisterAudioCallback(audio_feedback);
|
audio_->RegisterAudioCallback(audio_feedback);
|
||||||
} else {
|
} else {
|
||||||
video_ = new RTPSenderVideo(id, clock_, this);
|
video_ = new RTPSenderVideo(clock_, this);
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPSender::~RTPSender() {
|
RTPSender::~RTPSender() {
|
||||||
@ -126,8 +125,6 @@ RTPSender::~RTPSender() {
|
|||||||
}
|
}
|
||||||
delete audio_;
|
delete audio_;
|
||||||
delete video_;
|
delete video_;
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id_, "%s deleted", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPSender::SetTargetSendBitrate(const uint32_t bits) {
|
void RTPSender::SetTargetSendBitrate(const uint32_t bits) {
|
||||||
@ -290,16 +287,12 @@ int32_t RTPSender::SetMaxPayloadLength(
|
|||||||
const uint16_t packet_over_head) {
|
const uint16_t packet_over_head) {
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
if (max_payload_length < 100 || max_payload_length > IP_PACKET_SIZE) {
|
if (max_payload_length < 100 || max_payload_length > IP_PACKET_SIZE) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_, "%s invalid argument",
|
LOG(LS_ERROR) << "Invalid max payload length: " << max_payload_length;
|
||||||
__FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CriticalSectionScoped cs(send_critsect_);
|
CriticalSectionScoped cs(send_critsect_);
|
||||||
max_payload_length_ = max_payload_length;
|
max_payload_length_ = max_payload_length;
|
||||||
packet_over_head_ = packet_over_head;
|
packet_over_head_ = packet_over_head;
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceInfo, kTraceRtpRtcp, id_, "SetMaxPayloadLength to %d.",
|
|
||||||
max_payload_length);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,8 +343,7 @@ int32_t RTPSender::CheckPayloadType(const int8_t payload_type,
|
|||||||
CriticalSectionScoped cs(send_critsect_);
|
CriticalSectionScoped cs(send_critsect_);
|
||||||
|
|
||||||
if (payload_type < 0) {
|
if (payload_type < 0) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_, "\tinvalid payload_type (%d)",
|
LOG(LS_ERROR) << "Invalid payload_type " << payload_type;
|
||||||
payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (audio_configured_) {
|
if (audio_configured_) {
|
||||||
@ -373,8 +365,7 @@ int32_t RTPSender::CheckPayloadType(const int8_t payload_type,
|
|||||||
std::map<int8_t, ModuleRTPUtility::Payload *>::iterator it =
|
std::map<int8_t, ModuleRTPUtility::Payload *>::iterator it =
|
||||||
payload_type_map_.find(payload_type);
|
payload_type_map_.find(payload_type);
|
||||||
if (it == payload_type_map_.end()) {
|
if (it == payload_type_map_.end()) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Payload type " << payload_type << " not registered.";
|
||||||
"\tpayloadType:%d not registered", payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
payload_type_ = payload_type;
|
payload_type_ = payload_type;
|
||||||
@ -403,9 +394,7 @@ int32_t RTPSender::SendOutgoingData(
|
|||||||
}
|
}
|
||||||
RtpVideoCodecTypes video_type = kRtpVideoGeneric;
|
RtpVideoCodecTypes video_type = kRtpVideoGeneric;
|
||||||
if (CheckPayloadType(payload_type, &video_type) != 0) {
|
if (CheckPayloadType(payload_type, &video_type) != 0) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
LOG(LS_ERROR) << "Don't send data with unknown payload type.";
|
||||||
"%s invalid argument failed to find payload_type:%d",
|
|
||||||
__FUNCTION__, payload_type);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,8 +605,6 @@ int32_t RTPSender::ReSendPacket(uint16_t packet_id, uint32_t min_resend_time) {
|
|||||||
RTPHeader header;
|
RTPHeader header;
|
||||||
if (!rtp_parser.Parse(header)) {
|
if (!rtp_parser.Parse(header)) {
|
||||||
assert(false);
|
assert(false);
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, id_,
|
|
||||||
"Failed to parse RTP header of packet to be retransmitted.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!paced_sender_->SendPacket(PacedSender::kHighPriority,
|
if (!paced_sender_->SendPacket(PacedSender::kHighPriority,
|
||||||
@ -644,10 +631,9 @@ bool RTPSender::SendPacketToNetwork(const uint8_t *packet, uint32_t size) {
|
|||||||
}
|
}
|
||||||
TRACE_EVENT_INSTANT2("webrtc_rtp", "RTPSender::SendPacketToNetwork",
|
TRACE_EVENT_INSTANT2("webrtc_rtp", "RTPSender::SendPacketToNetwork",
|
||||||
"size", size, "sent", bytes_sent);
|
"size", size, "sent", bytes_sent);
|
||||||
// TODO(pwesin): Add a separate bitrate for sent bitrate after pacer.
|
// TODO(pwestin): Add a separate bitrate for sent bitrate after pacer.
|
||||||
if (bytes_sent <= 0) {
|
if (bytes_sent <= 0) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Transport failed to send packet";
|
||||||
"Transport failed to send packet");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -676,11 +662,8 @@ void RTPSender::OnReceivedNACK(
|
|||||||
|
|
||||||
// Enough bandwidth to send NACK?
|
// Enough bandwidth to send NACK?
|
||||||
if (!ProcessNACKBitRate(now)) {
|
if (!ProcessNACKBitRate(now)) {
|
||||||
WEBRTC_TRACE(kTraceStream,
|
LOG(LS_INFO) << "NACK bitrate reached. Skip sending NACK response. Target "
|
||||||
kTraceRtpRtcp,
|
<< target_bitrate_kbps;
|
||||||
id_,
|
|
||||||
"NACK bitrate reached. Skip sending NACK response. Target %d",
|
|
||||||
target_bitrate_kbps);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,9 +678,8 @@ void RTPSender::OnReceivedNACK(
|
|||||||
continue;
|
continue;
|
||||||
} else if (bytes_sent < 0) {
|
} else if (bytes_sent < 0) {
|
||||||
// Failed to send one Sequence number. Give up the rest in this nack.
|
// Failed to send one Sequence number. Give up the rest in this nack.
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed resending RTP packet " << *it
|
||||||
"Failed resending RTP packet %d, Discard rest of packets",
|
<< ", Discard rest of packets";
|
||||||
*it);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Delay bandwidth estimate (RTT * BW).
|
// Delay bandwidth estimate (RTT * BW).
|
||||||
@ -1258,39 +1240,36 @@ bool RTPSender::UpdateTransmissionTimeOffset(
|
|||||||
rtp_header_extension_map_.GetLengthUntilBlockStartInBytes(
|
rtp_header_extension_map_.GetLengthUntilBlockStartInBytes(
|
||||||
kRtpExtensionTransmissionTimeOffset);
|
kRtpExtensionTransmissionTimeOffset);
|
||||||
if (extension_block_pos < 0) {
|
if (extension_block_pos < 0) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING)
|
||||||
"Failed to update transmission time offset, not registered.");
|
<< "Failed to update transmission time offset, not registered.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int block_pos = 12 + rtp_header.numCSRCs + extension_block_pos;
|
int block_pos = 12 + rtp_header.numCSRCs + extension_block_pos;
|
||||||
if (rtp_packet_length < block_pos + kTransmissionTimeOffsetLength ||
|
if (rtp_packet_length < block_pos + kTransmissionTimeOffsetLength ||
|
||||||
rtp_header.headerLength <
|
rtp_header.headerLength <
|
||||||
block_pos + kTransmissionTimeOffsetLength) {
|
block_pos + kTransmissionTimeOffsetLength) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING)
|
||||||
"Failed to update transmission time offset, invalid length.");
|
<< "Failed to update transmission time offset, invalid length.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Verify that header contains extension.
|
// Verify that header contains extension.
|
||||||
if (!((rtp_packet[12 + rtp_header.numCSRCs] == 0xBE) &&
|
if (!((rtp_packet[12 + rtp_header.numCSRCs] == 0xBE) &&
|
||||||
(rtp_packet[12 + rtp_header.numCSRCs + 1] == 0xDE))) {
|
(rtp_packet[12 + rtp_header.numCSRCs + 1] == 0xDE))) {
|
||||||
WEBRTC_TRACE(
|
LOG(LS_WARNING) << "Failed to update transmission time offset, hdr "
|
||||||
kTraceStream, kTraceRtpRtcp, id_,
|
"extension not found.";
|
||||||
"Failed to update transmission time offset, hdr extension not found.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Get id.
|
// Get id.
|
||||||
uint8_t id = 0;
|
uint8_t id = 0;
|
||||||
if (rtp_header_extension_map_.GetId(kRtpExtensionTransmissionTimeOffset,
|
if (rtp_header_extension_map_.GetId(kRtpExtensionTransmissionTimeOffset,
|
||||||
&id) != 0) {
|
&id) != 0) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update transmission time offset, no id.";
|
||||||
"Failed to update transmission time offset, no id.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Verify first byte in block.
|
// Verify first byte in block.
|
||||||
const uint8_t first_block_byte = (id << 4) + 2;
|
const uint8_t first_block_byte = (id << 4) + 2;
|
||||||
if (rtp_packet[block_pos] != first_block_byte) {
|
if (rtp_packet[block_pos] != first_block_byte) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update transmission time offset.";
|
||||||
"Failed to update transmission time offset.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Update transmission offset field (converting to a 90 kHz timestamp).
|
// Update transmission offset field (converting to a 90 kHz timestamp).
|
||||||
@ -1311,37 +1290,31 @@ bool RTPSender::UpdateAudioLevel(uint8_t *rtp_packet,
|
|||||||
rtp_header_extension_map_.GetLengthUntilBlockStartInBytes(
|
rtp_header_extension_map_.GetLengthUntilBlockStartInBytes(
|
||||||
kRtpExtensionAudioLevel);
|
kRtpExtensionAudioLevel);
|
||||||
if (extension_block_pos < 0) {
|
if (extension_block_pos < 0) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update audio level, not registered.";
|
||||||
"Failed to update audio level, not registered.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int block_pos = 12 + rtp_header.numCSRCs + extension_block_pos;
|
int block_pos = 12 + rtp_header.numCSRCs + extension_block_pos;
|
||||||
if (rtp_packet_length < block_pos + kAudioLevelLength ||
|
if (rtp_packet_length < block_pos + kAudioLevelLength ||
|
||||||
rtp_header.headerLength < block_pos + kAudioLevelLength) {
|
rtp_header.headerLength < block_pos + kAudioLevelLength) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update audio level, invalid length.";
|
||||||
"Failed to update audio level, invalid length.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Verify that header contains extension.
|
// Verify that header contains extension.
|
||||||
if (!((rtp_packet[12 + rtp_header.numCSRCs] == 0xBE) &&
|
if (!((rtp_packet[12 + rtp_header.numCSRCs] == 0xBE) &&
|
||||||
(rtp_packet[12 + rtp_header.numCSRCs + 1] == 0xDE))) {
|
(rtp_packet[12 + rtp_header.numCSRCs + 1] == 0xDE))) {
|
||||||
WEBRTC_TRACE(
|
LOG(LS_WARNING) << "Failed to update audio level, hdr extension not found.";
|
||||||
kTraceStream, kTraceRtpRtcp, id_,
|
|
||||||
"Failed to update audio level, hdr extension not found.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Get id.
|
// Get id.
|
||||||
uint8_t id = 0;
|
uint8_t id = 0;
|
||||||
if (rtp_header_extension_map_.GetId(kRtpExtensionAudioLevel, &id) != 0) {
|
if (rtp_header_extension_map_.GetId(kRtpExtensionAudioLevel, &id) != 0) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update audio level, no id.";
|
||||||
"Failed to update audio level, no id.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Verify first byte in block.
|
// Verify first byte in block.
|
||||||
const uint8_t first_block_byte = (id << 4) + 0;
|
const uint8_t first_block_byte = (id << 4) + 0;
|
||||||
if (rtp_packet[block_pos] != first_block_byte) {
|
if (rtp_packet[block_pos] != first_block_byte) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update audio level.";
|
||||||
"Failed to update audio level.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rtp_packet[block_pos + 1] = (is_voiced ? 0x80 : 0x00) + (dBov & 0x7f);
|
rtp_packet[block_pos + 1] = (is_voiced ? 0x80 : 0x00) + (dBov & 0x7f);
|
||||||
@ -1358,38 +1331,33 @@ bool RTPSender::UpdateAbsoluteSendTime(
|
|||||||
rtp_header_extension_map_.GetLengthUntilBlockStartInBytes(
|
rtp_header_extension_map_.GetLengthUntilBlockStartInBytes(
|
||||||
kRtpExtensionAbsoluteSendTime);
|
kRtpExtensionAbsoluteSendTime);
|
||||||
if (extension_block_pos < 0) {
|
if (extension_block_pos < 0) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update absolute send time, not registered.";
|
||||||
"Failed to update absolute send time, not registered.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int block_pos = 12 + rtp_header.numCSRCs + extension_block_pos;
|
int block_pos = 12 + rtp_header.numCSRCs + extension_block_pos;
|
||||||
if (rtp_packet_length < block_pos + kAbsoluteSendTimeLength ||
|
if (rtp_packet_length < block_pos + kAbsoluteSendTimeLength ||
|
||||||
rtp_header.headerLength < block_pos + kAbsoluteSendTimeLength) {
|
rtp_header.headerLength < block_pos + kAbsoluteSendTimeLength) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update absolute send time, invalid length.";
|
||||||
"Failed to update absolute send time, invalid length.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Verify that header contains extension.
|
// Verify that header contains extension.
|
||||||
if (!((rtp_packet[12 + rtp_header.numCSRCs] == 0xBE) &&
|
if (!((rtp_packet[12 + rtp_header.numCSRCs] == 0xBE) &&
|
||||||
(rtp_packet[12 + rtp_header.numCSRCs + 1] == 0xDE))) {
|
(rtp_packet[12 + rtp_header.numCSRCs + 1] == 0xDE))) {
|
||||||
WEBRTC_TRACE(
|
LOG(LS_WARNING)
|
||||||
kTraceStream, kTraceRtpRtcp, id_,
|
<< "Failed to update absolute send time, hdr extension not found.";
|
||||||
"Failed to update absolute send time, hdr extension not found.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Get id.
|
// Get id.
|
||||||
uint8_t id = 0;
|
uint8_t id = 0;
|
||||||
if (rtp_header_extension_map_.GetId(kRtpExtensionAbsoluteSendTime,
|
if (rtp_header_extension_map_.GetId(kRtpExtensionAbsoluteSendTime,
|
||||||
&id) != 0) {
|
&id) != 0) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update absolute send time, no id.";
|
||||||
"Failed to update absolute send time, no id.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Verify first byte in block.
|
// Verify first byte in block.
|
||||||
const uint8_t first_block_byte = (id << 4) + 2;
|
const uint8_t first_block_byte = (id << 4) + 2;
|
||||||
if (rtp_packet[block_pos] != first_block_byte) {
|
if (rtp_packet[block_pos] != first_block_byte) {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, id_,
|
LOG(LS_WARNING) << "Failed to update absolute send time.";
|
||||||
"Failed to update absolute send time.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Update absolute send time field (convert ms to 24-bit unsigned with 18 bit
|
// Update absolute send time field (convert ms to 24-bit unsigned with 18 bit
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -31,11 +31,9 @@ struct RtpPacket {
|
|||||||
ForwardErrorCorrection::Packet* pkt;
|
ForwardErrorCorrection::Packet* pkt;
|
||||||
};
|
};
|
||||||
|
|
||||||
RTPSenderVideo::RTPSenderVideo(const int32_t id,
|
RTPSenderVideo::RTPSenderVideo(Clock* clock,
|
||||||
Clock* clock,
|
|
||||||
RTPSenderInterface* rtpSender)
|
RTPSenderInterface* rtpSender)
|
||||||
: _id(id),
|
: _rtpSender(*rtpSender),
|
||||||
_rtpSender(*rtpSender),
|
|
||||||
_sendVideoCritsect(CriticalSectionWrapper::CreateCriticalSection()),
|
_sendVideoCritsect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_videoType(kRtpVideoGeneric),
|
_videoType(kRtpVideoGeneric),
|
||||||
_videoCodecInformation(NULL),
|
_videoCodecInformation(NULL),
|
||||||
@ -43,7 +41,7 @@ RTPSenderVideo::RTPSenderVideo(const int32_t id,
|
|||||||
_retransmissionSettings(kRetransmitBaseLayer),
|
_retransmissionSettings(kRetransmitBaseLayer),
|
||||||
|
|
||||||
// Generic FEC
|
// Generic FEC
|
||||||
_fec(id),
|
_fec(),
|
||||||
_fecEnabled(false),
|
_fecEnabled(false),
|
||||||
_payloadTypeRED(-1),
|
_payloadTypeRED(-1),
|
||||||
_payloadTypeFEC(-1),
|
_payloadTypeFEC(-1),
|
||||||
@ -329,8 +327,6 @@ RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
|
|||||||
{
|
{
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id, "%s(timestamp:%u)",
|
|
||||||
__FUNCTION__, captureTimeStamp);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,9 +472,9 @@ RTPSenderVideo::SendVP8(const FrameType frameType,
|
|||||||
rtpHeaderLength, captureTimeStamp,
|
rtpHeaderLength, captureTimeStamp,
|
||||||
capture_time_ms, storage, protect))
|
capture_time_ms, storage, protect))
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_WARNING)
|
||||||
"RTPSenderVideo::SendVP8 failed to send packet number"
|
<< "RTPSenderVideo::SendVP8 failed to send packet number "
|
||||||
" %d", _rtpSender.SequenceNumber());
|
<< _rtpSender.SequenceNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE_EVENT_ASYNC_END1("webrtc", "Video", capture_time_ms,
|
TRACE_EVENT_ASYNC_END1("webrtc", "Video", capture_time_ms,
|
||||||
|
@ -31,7 +31,7 @@ struct RtpPacket;
|
|||||||
class RTPSenderVideo
|
class RTPSenderVideo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RTPSenderVideo(const int32_t id, Clock* clock,
|
RTPSenderVideo(Clock* clock,
|
||||||
RTPSenderInterface* rtpSender);
|
RTPSenderInterface* rtpSender);
|
||||||
virtual ~RTPSenderVideo();
|
virtual ~RTPSenderVideo();
|
||||||
|
|
||||||
@ -112,7 +112,6 @@ private:
|
|||||||
const RTPVideoTypeHeader* rtpTypeHdr);
|
const RTPVideoTypeHeader* rtpTypeHdr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t _id;
|
|
||||||
RTPSenderInterface& _rtpSender;
|
RTPSenderInterface& _rtpSender;
|
||||||
|
|
||||||
CriticalSectionWrapper* _sendVideoCritsect;
|
CriticalSectionWrapper* _sendVideoCritsect;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
#if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400))
|
#if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400))
|
||||||
#define DEBUG_PRINT(...) \
|
#define DEBUG_PRINT(...) \
|
||||||
@ -464,22 +464,21 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
|
|||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if (id == 15) {
|
if (id == 15) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING)
|
||||||
"Ext id: 15 encountered, parsing terminated.");
|
<< "RTP extension header 15 encountered. Terminate parsing.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPExtensionType type;
|
RTPExtensionType type;
|
||||||
if (ptrExtensionMap->GetType(id, &type) != 0) {
|
if (ptrExtensionMap->GetType(id, &type) != 0) {
|
||||||
// If we encounter an unknown extension, just skip over it.
|
// If we encounter an unknown extension, just skip over it.
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Failed to find extension id: " << id;
|
||||||
"Failed to find extension id: %d", id);
|
|
||||||
} else {
|
} else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kRtpExtensionTransmissionTimeOffset: {
|
case kRtpExtensionTransmissionTimeOffset: {
|
||||||
if (len != 2) {
|
if (len != 2) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Incorrect transmission time offset len: "
|
||||||
"Incorrect transmission time offset len: %d", len);
|
<< len;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
@ -502,8 +501,7 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
|
|||||||
}
|
}
|
||||||
case kRtpExtensionAudioLevel: {
|
case kRtpExtensionAudioLevel: {
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Incorrect audio level len: " << len;
|
||||||
"Incorrect audio level len: %d", len);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
@ -525,8 +523,7 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
|
|||||||
}
|
}
|
||||||
case kRtpExtensionAbsoluteSendTime: {
|
case kRtpExtensionAbsoluteSendTime: {
|
||||||
if (len != 2) {
|
if (len != 2) {
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Incorrect absolute send time len: " << len;
|
||||||
"Incorrect absolute send time len: %d", len);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
@ -543,8 +540,7 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
|
LOG(LS_WARNING) << "Extension type not implemented: " << type;
|
||||||
"Extension type not implemented.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,17 +566,12 @@ uint8_t RTPHeaderParser::ParsePaddingBytes(
|
|||||||
return num_zero_bytes;
|
return num_zero_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RTP payload parser
|
|
||||||
RTPPayloadParser::RTPPayloadParser(const RtpVideoCodecTypes videoType,
|
RTPPayloadParser::RTPPayloadParser(const RtpVideoCodecTypes videoType,
|
||||||
const uint8_t* payloadData,
|
const uint8_t* payloadData,
|
||||||
uint16_t payloadDataLength,
|
uint16_t payloadDataLength)
|
||||||
int32_t id)
|
: _dataPtr(payloadData),
|
||||||
:
|
_dataLength(payloadDataLength),
|
||||||
_id(id),
|
_videoType(videoType) {}
|
||||||
_dataPtr(payloadData),
|
|
||||||
_dataLength(payloadDataLength),
|
|
||||||
_videoType(videoType) {
|
|
||||||
}
|
|
||||||
|
|
||||||
RTPPayloadParser::~RTPPayloadParser() {
|
RTPPayloadParser::~RTPPayloadParser() {
|
||||||
}
|
}
|
||||||
@ -655,8 +646,7 @@ bool RTPPayloadParser::ParseVP8(RTPPayload& parsedPacket) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dataLength <= 0) {
|
if (dataLength <= 0) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
LOG(LS_ERROR) << "Error parsing VP8 payload descriptor!";
|
||||||
"Error parsing VP8 payload descriptor; payload too short");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ namespace ModuleRTPUtility
|
|||||||
public:
|
public:
|
||||||
RTPPayloadParser(const RtpVideoCodecTypes payloadType,
|
RTPPayloadParser(const RtpVideoCodecTypes payloadType,
|
||||||
const uint8_t* payloadData,
|
const uint8_t* payloadData,
|
||||||
const uint16_t payloadDataLength, // Length w/o padding.
|
// Length w/o padding.
|
||||||
const int32_t id);
|
const uint16_t payloadDataLength);
|
||||||
|
|
||||||
~RTPPayloadParser();
|
~RTPPayloadParser();
|
||||||
|
|
||||||
@ -202,7 +202,6 @@ namespace ModuleRTPUtility
|
|||||||
int dataLength) const;
|
int dataLength) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t _id;
|
|
||||||
const uint8_t* _dataPtr;
|
const uint8_t* _dataPtr;
|
||||||
const uint16_t _dataLength;
|
const uint16_t _dataLength;
|
||||||
const RtpVideoCodecTypes _videoType;
|
const RtpVideoCodecTypes _videoType;
|
||||||
|
@ -76,7 +76,7 @@ TEST(ParseVP8Test, BasicHeader) {
|
|||||||
payload[0] = 0x14; // Binary 0001 0100; S = 1, PartID = 4.
|
payload[0] = 0x14; // Binary 0001 0100; S = 1, PartID = 4.
|
||||||
payload[1] = 0x01; // P frame.
|
payload[1] = 0x01; // P frame.
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 4, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 4);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -97,7 +97,7 @@ TEST(ParseVP8Test, PictureID) {
|
|||||||
payload[1] = 0x80;
|
payload[1] = 0x80;
|
||||||
payload[2] = 17;
|
payload[2] = 17;
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -117,7 +117,7 @@ TEST(ParseVP8Test, PictureID) {
|
|||||||
// Re-use payload, but change to long PictureID.
|
// Re-use payload, but change to long PictureID.
|
||||||
payload[2] = 0x80 | 17;
|
payload[2] = 0x80 | 17;
|
||||||
payload[3] = 17;
|
payload[3] = 17;
|
||||||
RTPPayloadParser rtpPayloadParser2(kRtpVideoVp8, payload, 10, 0);
|
RTPPayloadParser rtpPayloadParser2(kRtpVideoVp8, payload, 10);
|
||||||
|
|
||||||
ASSERT_TRUE(rtpPayloadParser2.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser2.Parse(parsedPacket));
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ TEST(ParseVP8Test, Tl0PicIdx) {
|
|||||||
payload[1] = 0x40;
|
payload[1] = 0x40;
|
||||||
payload[2] = 17;
|
payload[2] = 17;
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 13, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 13);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -159,7 +159,7 @@ TEST(ParseVP8Test, TIDAndLayerSync) {
|
|||||||
payload[1] = 0x20;
|
payload[1] = 0x20;
|
||||||
payload[2] = 0x80; // TID(2) + LayerSync(false)
|
payload[2] = 0x80; // TID(2) + LayerSync(false)
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -183,7 +183,7 @@ TEST(ParseVP8Test, KeyIdx) {
|
|||||||
payload[1] = 0x10; // K = 1.
|
payload[1] = 0x10; // K = 1.
|
||||||
payload[2] = 0x11; // KEYIDX = 17 decimal.
|
payload[2] = 0x11; // KEYIDX = 17 decimal.
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -209,7 +209,7 @@ TEST(ParseVP8Test, MultipleExtensions) {
|
|||||||
payload[4] = 42; // Tl0PicIdx.
|
payload[4] = 42; // Tl0PicIdx.
|
||||||
payload[5] = 0x40 | 0x20 | 0x11; // TID(1) + LayerSync(true) + KEYIDX(17).
|
payload[5] = 0x40 | 0x20 | 0x11; // TID(1) + LayerSync(true) + KEYIDX(17).
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 10);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -236,7 +236,7 @@ TEST(ParseVP8Test, TooShortHeader) {
|
|||||||
payload[2] = 0x80 | 17; // ... but only 2 bytes PictureID is provided.
|
payload[2] = 0x80 | 17; // ... but only 2 bytes PictureID is provided.
|
||||||
payload[3] = 17; // PictureID, low 8 bits.
|
payload[3] = 17; // PictureID, low 8 bits.
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 4, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, payload, 4);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
EXPECT_FALSE(rtpPayloadParser.Parse(parsedPacket));
|
EXPECT_FALSE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
@ -258,7 +258,7 @@ TEST(ParseVP8Test, TestWithPacketizer) {
|
|||||||
ASSERT_EQ(0, packetizer.NextPacket(packet, &send_bytes, &last));
|
ASSERT_EQ(0, packetizer.NextPacket(packet, &send_bytes, &last));
|
||||||
ASSERT_TRUE(last);
|
ASSERT_TRUE(last);
|
||||||
|
|
||||||
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, packet, send_bytes, 0);
|
RTPPayloadParser rtpPayloadParser(kRtpVideoVp8, packet, send_bytes);
|
||||||
|
|
||||||
RTPPayload parsedPacket;
|
RTPPayload parsedPacket;
|
||||||
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
ASSERT_TRUE(rtpPayloadParser.Parse(parsedPacket));
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -185,8 +184,6 @@ SSRCDatabase::SSRCDatabase()
|
|||||||
_ssrcVector = new uint32_t[10];
|
_ssrcVector = new uint32_t[10];
|
||||||
#endif
|
#endif
|
||||||
_critSect = CriticalSectionWrapper::CreateCriticalSection();
|
_critSect = CriticalSectionWrapper::CreateCriticalSection();
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, -1, "%s created", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SSRCDatabase::~SSRCDatabase()
|
SSRCDatabase::~SSRCDatabase()
|
||||||
@ -197,8 +194,6 @@ SSRCDatabase::~SSRCDatabase()
|
|||||||
_ssrcMap.clear();
|
_ssrcMap.clear();
|
||||||
#endif
|
#endif
|
||||||
delete _critSect;
|
delete _critSect;
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, -1, "%s deleted", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t SSRCDatabase::GenerateRandom()
|
uint32_t SSRCDatabase::GenerateRandom()
|
||||||
|
@ -34,7 +34,7 @@ class RtpRtcpAPITest : public ::testing::Test {
|
|||||||
configuration.clock = &fake_clock;
|
configuration.clock = &fake_clock;
|
||||||
module = RtpRtcp::CreateRtpRtcp(configuration);
|
module = RtpRtcp::CreateRtpRtcp(configuration);
|
||||||
rtp_payload_registry_.reset(new RTPPayloadRegistry(
|
rtp_payload_registry_.reset(new RTPPayloadRegistry(
|
||||||
test_id, RTPPayloadStrategy::CreateStrategy(true)));
|
RTPPayloadStrategy::CreateStrategy(true)));
|
||||||
rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver(
|
rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver(
|
||||||
test_id, &fake_clock, NULL, NULL, NULL, rtp_payload_registry_.get()));
|
test_id, &fake_clock, NULL, NULL, NULL, rtp_payload_registry_.get()));
|
||||||
}
|
}
|
||||||
|
@ -122,9 +122,9 @@ class RtpRtcpAudioTest : public ::testing::Test {
|
|||||||
receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock));
|
receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock));
|
||||||
|
|
||||||
rtp_payload_registry1_.reset(new RTPPayloadRegistry(
|
rtp_payload_registry1_.reset(new RTPPayloadRegistry(
|
||||||
test_id, RTPPayloadStrategy::CreateStrategy(true)));
|
RTPPayloadStrategy::CreateStrategy(true)));
|
||||||
rtp_payload_registry2_.reset(new RTPPayloadRegistry(
|
rtp_payload_registry2_.reset(new RTPPayloadRegistry(
|
||||||
test_id, RTPPayloadStrategy::CreateStrategy(true)));
|
RTPPayloadStrategy::CreateStrategy(true)));
|
||||||
|
|
||||||
RtpRtcp::Configuration configuration;
|
RtpRtcp::Configuration configuration;
|
||||||
configuration.id = test_id;
|
configuration.id = test_id;
|
||||||
|
@ -116,9 +116,9 @@ class RtpRtcpRtcpTest : public ::testing::Test {
|
|||||||
configuration.intra_frame_callback = myRTCPFeedback1;
|
configuration.intra_frame_callback = myRTCPFeedback1;
|
||||||
|
|
||||||
rtp_payload_registry1_.reset(new RTPPayloadRegistry(
|
rtp_payload_registry1_.reset(new RTPPayloadRegistry(
|
||||||
test_id, RTPPayloadStrategy::CreateStrategy(true)));
|
RTPPayloadStrategy::CreateStrategy(true)));
|
||||||
rtp_payload_registry2_.reset(new RTPPayloadRegistry(
|
rtp_payload_registry2_.reset(new RTPPayloadRegistry(
|
||||||
test_id, RTPPayloadStrategy::CreateStrategy(true)));
|
RTPPayloadStrategy::CreateStrategy(true)));
|
||||||
|
|
||||||
module1 = RtpRtcp::CreateRtpRtcp(configuration);
|
module1 = RtpRtcp::CreateRtpRtcp(configuration);
|
||||||
|
|
||||||
@ -280,7 +280,6 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
|||||||
reportBlock.lastSR = 6;
|
reportBlock.lastSR = 6;
|
||||||
|
|
||||||
// Set report blocks.
|
// Set report blocks.
|
||||||
EXPECT_EQ(-1, module1->AddRTCPReportBlock(test_CSRC[0], NULL));
|
|
||||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[0], &reportBlock));
|
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[0], &reportBlock));
|
||||||
|
|
||||||
reportBlock.lastSR= 7;
|
reportBlock.lastSR= 7;
|
||||||
@ -319,7 +318,6 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
|||||||
|
|
||||||
// get all report blocks
|
// get all report blocks
|
||||||
std::vector<RTCPReportBlock> report_blocks;
|
std::vector<RTCPReportBlock> report_blocks;
|
||||||
EXPECT_EQ(-1, module1->RemoteRTCPStat(NULL));
|
|
||||||
EXPECT_EQ(0, module1->RemoteRTCPStat(&report_blocks));
|
EXPECT_EQ(0, module1->RemoteRTCPStat(&report_blocks));
|
||||||
ASSERT_EQ(1u, report_blocks.size());
|
ASSERT_EQ(1u, report_blocks.size());
|
||||||
const RTCPReportBlock& reportBlockReceived = report_blocks[0];
|
const RTCPReportBlock& reportBlockReceived = report_blocks[0];
|
||||||
|
@ -28,7 +28,7 @@ class RtpRtcpVideoTest : public ::testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
RtpRtcpVideoTest()
|
RtpRtcpVideoTest()
|
||||||
: test_id_(123),
|
: test_id_(123),
|
||||||
rtp_payload_registry_(0, RTPPayloadStrategy::CreateStrategy(false)),
|
rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)),
|
||||||
test_ssrc_(3456),
|
test_ssrc_(3456),
|
||||||
test_timestamp_(4567),
|
test_timestamp_(4567),
|
||||||
test_sequence_number_(2345),
|
test_sequence_number_(2345),
|
||||||
|
@ -105,9 +105,7 @@ TEST(FecTest, FecTest) {
|
|||||||
ASSERT_EQ(12, kMaxMediaPackets[1]) << "Max media packets for bursty mode not "
|
ASSERT_EQ(12, kMaxMediaPackets[1]) << "Max media packets for bursty mode not "
|
||||||
<< "equal to 12.";
|
<< "equal to 12.";
|
||||||
|
|
||||||
uint32_t id = 0;
|
ForwardErrorCorrection fec;
|
||||||
ForwardErrorCorrection fec(id);
|
|
||||||
|
|
||||||
ForwardErrorCorrection::PacketList mediaPacketList;
|
ForwardErrorCorrection::PacketList mediaPacketList;
|
||||||
ForwardErrorCorrection::PacketList fecPacketList;
|
ForwardErrorCorrection::PacketList fecPacketList;
|
||||||
ForwardErrorCorrection::ReceivedPacketList toDecodeList;
|
ForwardErrorCorrection::ReceivedPacketList toDecodeList;
|
||||||
|
@ -157,7 +157,7 @@ int MTRxTxTest(CmdArgs& args)
|
|||||||
configuration.outgoing_transport = outgoingTransport;
|
configuration.outgoing_transport = outgoingTransport;
|
||||||
RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(configuration);
|
RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(configuration);
|
||||||
scoped_ptr<RTPPayloadRegistry> registry(new RTPPayloadRegistry(
|
scoped_ptr<RTPPayloadRegistry> registry(new RTPPayloadRegistry(
|
||||||
-1, RTPPayloadStrategy::CreateStrategy(false)));
|
RTPPayloadStrategy::CreateStrategy(false)));
|
||||||
scoped_ptr<RtpReceiver> rtp_receiver(
|
scoped_ptr<RtpReceiver> rtp_receiver(
|
||||||
RtpReceiver::CreateVideoReceiver(-1, Clock::GetRealTimeClock(),
|
RtpReceiver::CreateVideoReceiver(-1, Clock::GetRealTimeClock(),
|
||||||
&dataCallback, NULL, registry.get()));
|
&dataCallback, NULL, registry.get()));
|
||||||
|
@ -273,7 +273,7 @@ class SsrcHandlers {
|
|||||||
LostPackets* lost_packets)
|
LostPackets* lost_packets)
|
||||||
: rtp_header_parser_(RtpHeaderParser::Create()),
|
: rtp_header_parser_(RtpHeaderParser::Create()),
|
||||||
rtp_payload_registry_(new RTPPayloadRegistry(
|
rtp_payload_registry_(new RTPPayloadRegistry(
|
||||||
0, RTPPayloadStrategy::CreateStrategy(false))),
|
RTPPayloadStrategy::CreateStrategy(false))),
|
||||||
rtp_module_(),
|
rtp_module_(),
|
||||||
payload_sink_(),
|
payload_sink_(),
|
||||||
ssrc_(ssrc),
|
ssrc_(ssrc),
|
||||||
|
@ -54,8 +54,7 @@ class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
|
|||||||
feedback_transport_(feedback_transport),
|
feedback_transport_(feedback_transport),
|
||||||
receive_stats_(ReceiveStatistics::Create(clock)),
|
receive_stats_(ReceiveStatistics::Create(clock)),
|
||||||
payload_registry_(
|
payload_registry_(
|
||||||
new RTPPayloadRegistry(-1,
|
new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(false))),
|
||||||
RTPPayloadStrategy::CreateStrategy(false))),
|
|
||||||
clock_(clock),
|
clock_(clock),
|
||||||
expected_bitrate_bps_(0),
|
expected_bitrate_bps_(0),
|
||||||
rtx_media_ssrcs_(rtx_media_ssrcs),
|
rtx_media_ssrcs_(rtx_media_ssrcs),
|
||||||
|
@ -643,11 +643,6 @@ int ViEChannel::SetSenderBufferingMode(int target_delay_ms) {
|
|||||||
nack_history_size_sender_ = kSendSidePacketHistorySize;
|
nack_history_size_sender_ = kSendSidePacketHistorySize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Setting nack_history_size_.
|
|
||||||
// First disabling (forcing free) and then resetting to desired value.
|
|
||||||
if (rtp_rtcp_->SetStorePacketsStatus(false, 0) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_) != 0) {
|
if (rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -35,13 +35,13 @@ ViEReceiver::ViEReceiver(const int32_t channel_id,
|
|||||||
channel_id_(channel_id),
|
channel_id_(channel_id),
|
||||||
rtp_header_parser_(RtpHeaderParser::Create()),
|
rtp_header_parser_(RtpHeaderParser::Create()),
|
||||||
rtp_payload_registry_(new RTPPayloadRegistry(
|
rtp_payload_registry_(new RTPPayloadRegistry(
|
||||||
channel_id, RTPPayloadStrategy::CreateStrategy(false))),
|
RTPPayloadStrategy::CreateStrategy(false))),
|
||||||
rtp_receiver_(RtpReceiver::CreateVideoReceiver(
|
rtp_receiver_(RtpReceiver::CreateVideoReceiver(
|
||||||
channel_id, Clock::GetRealTimeClock(), this, rtp_feedback,
|
channel_id, Clock::GetRealTimeClock(), this, rtp_feedback,
|
||||||
rtp_payload_registry_.get())),
|
rtp_payload_registry_.get())),
|
||||||
rtp_receive_statistics_(ReceiveStatistics::Create(
|
rtp_receive_statistics_(ReceiveStatistics::Create(
|
||||||
Clock::GetRealTimeClock())),
|
Clock::GetRealTimeClock())),
|
||||||
fec_receiver_(FecReceiver::Create(channel_id, this)),
|
fec_receiver_(FecReceiver::Create(this)),
|
||||||
rtp_rtcp_(NULL),
|
rtp_rtcp_(NULL),
|
||||||
vcm_(module_vcm),
|
vcm_(module_vcm),
|
||||||
remote_bitrate_estimator_(remote_bitrate_estimator),
|
remote_bitrate_estimator_(remote_bitrate_estimator),
|
||||||
|
@ -837,8 +837,7 @@ Channel::Channel(int32_t channelId,
|
|||||||
_channelId(channelId),
|
_channelId(channelId),
|
||||||
rtp_header_parser_(RtpHeaderParser::Create()),
|
rtp_header_parser_(RtpHeaderParser::Create()),
|
||||||
rtp_payload_registry_(
|
rtp_payload_registry_(
|
||||||
new RTPPayloadRegistry(channelId,
|
new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
|
||||||
RTPPayloadStrategy::CreateStrategy(true))),
|
|
||||||
rtp_receive_statistics_(ReceiveStatistics::Create(
|
rtp_receive_statistics_(ReceiveStatistics::Create(
|
||||||
Clock::GetRealTimeClock())),
|
Clock::GetRealTimeClock())),
|
||||||
rtp_receiver_(RtpReceiver::CreateAudioReceiver(
|
rtp_receiver_(RtpReceiver::CreateAudioReceiver(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user