Use vector of CSRCs for DeliverFrame & SetCSRCs.
BUG= R=pbos@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/28029004 Patch from Changbin Shao <changbin.shao@intel.com>. git-svn-id: http://webrtc.googlecode.com/svn/trunk@7734 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -219,38 +219,12 @@ class RtpRtcp : public Module {
|
|||||||
*/
|
*/
|
||||||
virtual void SetSSRC(const uint32_t ssrc) = 0;
|
virtual void SetSSRC(const uint32_t ssrc) = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
* Get CSRC
|
|
||||||
*
|
|
||||||
* arrOfCSRC - array of CSRCs
|
|
||||||
*
|
|
||||||
* return -1 on failure else number of valid entries in the array
|
|
||||||
*/
|
|
||||||
virtual int32_t CSRCs(
|
|
||||||
uint32_t arrOfCSRC[kRtpCsrcSize]) const = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set CSRC
|
* Set CSRC
|
||||||
*
|
*
|
||||||
* arrOfCSRC - array of CSRCs
|
* csrcs - vector of CSRCs
|
||||||
* arrLength - number of valid entries in the array
|
|
||||||
*
|
|
||||||
* return -1 on failure else 0
|
|
||||||
*/
|
*/
|
||||||
virtual int32_t SetCSRCs(
|
virtual void SetCsrcs(const std::vector<uint32_t>& csrcs) = 0;
|
||||||
const uint32_t arrOfCSRC[kRtpCsrcSize],
|
|
||||||
const uint8_t arrLength) = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* includes CSRCs in RTP header if enabled
|
|
||||||
*
|
|
||||||
* include CSRC - on/off
|
|
||||||
*
|
|
||||||
* default:on
|
|
||||||
*
|
|
||||||
* return -1 on failure else 0
|
|
||||||
*/
|
|
||||||
virtual int32_t SetCSRCStatus(const bool include) = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn on/off sending RTX (RFC 4588). The modes can be set as a combination
|
* Turn on/off sending RTX (RFC 4588). The modes can be set as a combination
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ class MockRtpRtcp : public RtpRtcp {
|
|||||||
void(const uint32_t ssrc));
|
void(const uint32_t ssrc));
|
||||||
MOCK_CONST_METHOD1(CSRCs,
|
MOCK_CONST_METHOD1(CSRCs,
|
||||||
int32_t(uint32_t arrOfCSRC[kRtpCsrcSize]));
|
int32_t(uint32_t arrOfCSRC[kRtpCsrcSize]));
|
||||||
MOCK_METHOD2(SetCSRCs,
|
MOCK_METHOD1(SetCsrcs, void(const std::vector<uint32_t>& csrcs));
|
||||||
int32_t(const uint32_t arrOfCSRC[kRtpCsrcSize], const uint8_t arrLength));
|
|
||||||
MOCK_METHOD1(SetCSRCStatus,
|
MOCK_METHOD1(SetCSRCStatus,
|
||||||
int32_t(const bool include));
|
int32_t(const bool include));
|
||||||
MOCK_METHOD1(SetRTXSendStatus,
|
MOCK_METHOD1(SetRTXSendStatus,
|
||||||
|
|||||||
@@ -114,10 +114,6 @@ RTCPSender::RTCPSender(const int32_t id,
|
|||||||
|
|
||||||
last_xr_rr_(),
|
last_xr_rr_(),
|
||||||
|
|
||||||
_CSRCs(0),
|
|
||||||
_CSRC(),
|
|
||||||
_includeCSRCs(true),
|
|
||||||
|
|
||||||
_sequenceNumberFIR(0),
|
_sequenceNumberFIR(0),
|
||||||
|
|
||||||
_rembBitrate(0),
|
_rembBitrate(0),
|
||||||
@@ -1383,48 +1379,31 @@ RTCPSender::BuildNACK(uint8_t* rtcpbuffer,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t RTCPSender::BuildBYE(uint8_t* rtcpbuffer, int& pos) {
|
||||||
RTCPSender::BuildBYE(uint8_t* rtcpbuffer, int& pos)
|
|
||||||
{
|
|
||||||
// sanity
|
// sanity
|
||||||
if(pos + 8 >= IP_PACKET_SIZE)
|
if (pos + 8 >= IP_PACKET_SIZE) {
|
||||||
{
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
if(_includeCSRCs)
|
|
||||||
{
|
|
||||||
// Add a bye packet
|
// Add a bye packet
|
||||||
rtcpbuffer[pos++]=(uint8_t)0x80 + 1 + _CSRCs; // number of SSRC+CSRCs
|
// Number of SSRC + CSRCs.
|
||||||
rtcpbuffer[pos++]=(uint8_t)203;
|
rtcpbuffer[pos++] = (uint8_t)0x80 + 1 + csrcs_.size();
|
||||||
|
rtcpbuffer[pos++] = (uint8_t)203;
|
||||||
|
|
||||||
// length
|
// length
|
||||||
rtcpbuffer[pos++]=(uint8_t)0;
|
rtcpbuffer[pos++] = (uint8_t)0;
|
||||||
rtcpbuffer[pos++]=(uint8_t)(1 + _CSRCs);
|
rtcpbuffer[pos++] = (uint8_t)(1 + csrcs_.size());
|
||||||
|
|
||||||
// Add our own SSRC
|
// Add our own SSRC
|
||||||
RtpUtility::AssignUWord32ToBuffer(rtcpbuffer + pos, _SSRC);
|
RtpUtility::AssignUWord32ToBuffer(rtcpbuffer + pos, _SSRC);
|
||||||
pos += 4;
|
pos += 4;
|
||||||
|
|
||||||
// add CSRCs
|
// add CSRCs
|
||||||
for(int i = 0; i < _CSRCs; i++)
|
for (size_t i = 0; i < csrcs_.size(); i++) {
|
||||||
{
|
RtpUtility::AssignUWord32ToBuffer(rtcpbuffer + pos, csrcs_[i]);
|
||||||
RtpUtility::AssignUWord32ToBuffer(rtcpbuffer + pos, _CSRC[i]);
|
|
||||||
pos += 4;
|
pos += 4;
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
{
|
|
||||||
// Add a bye packet
|
|
||||||
rtcpbuffer[pos++]=(uint8_t)0x80 + 1; // number of SSRC+CSRCs
|
|
||||||
rtcpbuffer[pos++]=(uint8_t)203;
|
|
||||||
|
|
||||||
// length
|
|
||||||
rtcpbuffer[pos++]=(uint8_t)0;
|
|
||||||
rtcpbuffer[pos++]=(uint8_t)1;
|
|
||||||
|
|
||||||
// Add our own SSRC
|
|
||||||
RtpUtility::AssignUWord32ToBuffer(rtcpbuffer + pos, _SSRC);
|
|
||||||
pos += 4;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2013,27 +1992,10 @@ RTCPSender::SendToNetwork(const uint8_t* dataBuffer,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
||||||
RTCPSender::SetCSRCStatus(const bool include)
|
assert(csrcs.size() <= kRtpCsrcSize);
|
||||||
{
|
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
_includeCSRCs = include;
|
csrcs_ = csrcs;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t
|
|
||||||
RTCPSender::SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize],
|
|
||||||
const uint8_t arrLength)
|
|
||||||
{
|
|
||||||
assert(arrLength <= kRtpCsrcSize);
|
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
|
||||||
|
|
||||||
for(int i = 0; i < arrLength;i++)
|
|
||||||
{
|
|
||||||
_CSRC[i] = arrOfCSRC[i];
|
|
||||||
}
|
|
||||||
_CSRCs = arrLength;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
|
|||||||
@@ -167,10 +167,7 @@ public:
|
|||||||
|
|
||||||
bool RtcpXrReceiverReferenceTime() const;
|
bool RtcpXrReceiverReferenceTime() const;
|
||||||
|
|
||||||
int32_t SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize],
|
void SetCsrcs(const std::vector<uint32_t>& csrcs);
|
||||||
const uint8_t arrLength);
|
|
||||||
|
|
||||||
int32_t SetCSRCStatus(const bool include);
|
|
||||||
|
|
||||||
void SetTargetBitrate(unsigned int target_bitrate);
|
void SetTargetBitrate(unsigned int target_bitrate);
|
||||||
|
|
||||||
@@ -325,9 +322,7 @@ private:
|
|||||||
GUARDED_BY(_criticalSectionRTCPSender);
|
GUARDED_BY(_criticalSectionRTCPSender);
|
||||||
|
|
||||||
// send CSRCs
|
// send CSRCs
|
||||||
uint8_t _CSRCs GUARDED_BY(_criticalSectionRTCPSender);
|
std::vector<uint32_t> csrcs_ GUARDED_BY(_criticalSectionRTCPSender);
|
||||||
uint32_t _CSRC[kRtpCsrcSize] GUARDED_BY(_criticalSectionRTCPSender);
|
|
||||||
bool _includeCSRCs GUARDED_BY(_criticalSectionRTCPSender);
|
|
||||||
|
|
||||||
// Full intra request
|
// Full intra request
|
||||||
uint8_t _sequenceNumberFIR GUARDED_BY(_criticalSectionRTCPSender);
|
uint8_t _sequenceNumberFIR GUARDED_BY(_criticalSectionRTCPSender);
|
||||||
|
|||||||
@@ -382,20 +382,7 @@ void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) {
|
|||||||
SetRtcpReceiverSsrcs(ssrc);
|
SetRtcpReceiverSsrcs(ssrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetCSRCStatus(const bool include) {
|
void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
||||||
rtcp_sender_.SetCSRCStatus(include);
|
|
||||||
rtp_sender_.SetCSRCStatus(include);
|
|
||||||
return 0; // TODO(pwestin): change to void.
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::CSRCs(
|
|
||||||
uint32_t arr_of_csrc[kRtpCsrcSize]) const {
|
|
||||||
return rtp_sender_.CSRCs(arr_of_csrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetCSRCs(
|
|
||||||
const uint32_t arr_of_csrc[kRtpCsrcSize],
|
|
||||||
const uint8_t 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());
|
||||||
@@ -404,15 +391,15 @@ int32_t ModuleRtpRtcpImpl::SetCSRCs(
|
|||||||
while (it != child_modules_.end()) {
|
while (it != child_modules_.end()) {
|
||||||
RtpRtcp* module = *it;
|
RtpRtcp* module = *it;
|
||||||
if (module) {
|
if (module) {
|
||||||
module->SetCSRCs(arr_of_csrc, arr_length);
|
module->SetCsrcs(csrcs);
|
||||||
}
|
}
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
rtcp_sender_.SetCSRCs(arr_of_csrc, arr_length);
|
|
||||||
rtp_sender_.SetCSRCs(arr_of_csrc, arr_length);
|
|
||||||
}
|
}
|
||||||
return 0; // TODO(pwestin): change to void.
|
|
||||||
|
rtcp_sender_.SetCsrcs(csrcs);
|
||||||
|
rtp_sender_.SetCsrcs(csrcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(pbos): Handle media and RTX streams separately (separate RTCP
|
// TODO(pbos): Handle media and RTX streams separately (separate RTCP
|
||||||
|
|||||||
@@ -82,12 +82,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
|||||||
// Configure SSRC, default is a random number.
|
// Configure SSRC, default is a random number.
|
||||||
virtual void SetSSRC(const uint32_t ssrc) OVERRIDE;
|
virtual void SetSSRC(const uint32_t ssrc) OVERRIDE;
|
||||||
|
|
||||||
virtual int32_t CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const OVERRIDE;
|
virtual void SetCsrcs(const std::vector<uint32_t>& csrcs) OVERRIDE;
|
||||||
|
|
||||||
virtual int32_t SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
|
|
||||||
const uint8_t arr_length) OVERRIDE;
|
|
||||||
|
|
||||||
virtual int32_t SetCSRCStatus(const bool include) OVERRIDE;
|
|
||||||
|
|
||||||
RTCPSender::FeedbackState GetFeedbackState();
|
RTCPSender::FeedbackState GetFeedbackState();
|
||||||
|
|
||||||
|
|||||||
@@ -145,16 +145,13 @@ RTPSender::RTPSender(const int32_t id,
|
|||||||
last_timestamp_time_ms_(0),
|
last_timestamp_time_ms_(0),
|
||||||
media_has_been_sent_(false),
|
media_has_been_sent_(false),
|
||||||
last_packet_marker_bit_(false),
|
last_packet_marker_bit_(false),
|
||||||
num_csrcs_(0),
|
|
||||||
csrcs_(),
|
csrcs_(),
|
||||||
include_csrcs_(true),
|
|
||||||
rtx_(kRtxOff),
|
rtx_(kRtxOff),
|
||||||
payload_type_rtx_(-1),
|
payload_type_rtx_(-1),
|
||||||
target_bitrate_critsect_(CriticalSectionWrapper::CreateCriticalSection()),
|
target_bitrate_critsect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
target_bitrate_(0) {
|
target_bitrate_(0) {
|
||||||
memset(nack_byte_count_times_, 0, sizeof(nack_byte_count_times_));
|
memset(nack_byte_count_times_, 0, sizeof(nack_byte_count_times_));
|
||||||
memset(nack_byte_count_, 0, sizeof(nack_byte_count_));
|
memset(nack_byte_count_, 0, sizeof(nack_byte_count_));
|
||||||
memset(csrcs_, 0, sizeof(csrcs_));
|
|
||||||
// We need to seed the random generator.
|
// We need to seed the random generator.
|
||||||
srand(static_cast<uint32_t>(clock_->TimeInMilliseconds()));
|
srand(static_cast<uint32_t>(clock_->TimeInMilliseconds()));
|
||||||
ssrc_ = ssrc_db_.CreateSSRC(); // Can't be 0.
|
ssrc_ = ssrc_db_.CreateSSRC(); // Can't be 0.
|
||||||
@@ -615,14 +612,9 @@ size_t RTPSender::SendPadData(uint32_t timestamp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t padding_packet[IP_PACKET_SIZE];
|
uint8_t padding_packet[IP_PACKET_SIZE];
|
||||||
size_t header_length = CreateRTPHeader(padding_packet,
|
size_t header_length =
|
||||||
payload_type,
|
CreateRtpHeader(padding_packet, payload_type, ssrc, false, timestamp,
|
||||||
ssrc,
|
sequence_number, std::vector<uint32_t>());
|
||||||
false,
|
|
||||||
timestamp,
|
|
||||||
sequence_number,
|
|
||||||
NULL,
|
|
||||||
0);
|
|
||||||
assert(header_length != static_cast<size_t>(-1));
|
assert(header_length != static_cast<size_t>(-1));
|
||||||
padding_bytes_in_packet = BuildPaddingPacket(padding_packet, header_length);
|
padding_bytes_in_packet = BuildPaddingPacket(padding_packet, header_length);
|
||||||
assert(padding_bytes_in_packet <= bytes);
|
assert(padding_bytes_in_packet <= bytes);
|
||||||
@@ -1057,9 +1049,7 @@ void RTPSender::ProcessBitrate() {
|
|||||||
size_t RTPSender::RTPHeaderLength() const {
|
size_t RTPSender::RTPHeaderLength() const {
|
||||||
CriticalSectionScoped lock(send_critsect_);
|
CriticalSectionScoped lock(send_critsect_);
|
||||||
size_t rtp_header_length = 12;
|
size_t rtp_header_length = 12;
|
||||||
if (include_csrcs_) {
|
rtp_header_length += sizeof(uint32_t) * csrcs_.size();
|
||||||
rtp_header_length += sizeof(uint32_t) * num_csrcs_;
|
|
||||||
}
|
|
||||||
rtp_header_length += RtpHeaderExtensionTotalLength();
|
rtp_header_length += RtpHeaderExtensionTotalLength();
|
||||||
return rtp_header_length;
|
return rtp_header_length;
|
||||||
}
|
}
|
||||||
@@ -1093,10 +1083,13 @@ void RTPSender::GetDataCounters(StreamDataCounters* rtp_stats,
|
|||||||
*rtx_stats = rtx_rtp_stats_;
|
*rtx_stats = rtx_rtp_stats_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSender::CreateRTPHeader(
|
size_t RTPSender::CreateRtpHeader(uint8_t* header,
|
||||||
uint8_t* header, int8_t payload_type, uint32_t ssrc, bool marker_bit,
|
int8_t payload_type,
|
||||||
uint32_t timestamp, uint16_t sequence_number, const uint32_t* csrcs,
|
uint32_t ssrc,
|
||||||
uint8_t num_csrcs) const {
|
bool marker_bit,
|
||||||
|
uint32_t timestamp,
|
||||||
|
uint16_t sequence_number,
|
||||||
|
const std::vector<uint32_t>& csrcs) const {
|
||||||
header[0] = 0x80; // version 2.
|
header[0] = 0x80; // version 2.
|
||||||
header[1] = static_cast<uint8_t>(payload_type);
|
header[1] = static_cast<uint8_t>(payload_type);
|
||||||
if (marker_bit) {
|
if (marker_bit) {
|
||||||
@@ -1107,22 +1100,16 @@ int RTPSender::CreateRTPHeader(
|
|||||||
RtpUtility::AssignUWord32ToBuffer(header + 8, ssrc);
|
RtpUtility::AssignUWord32ToBuffer(header + 8, ssrc);
|
||||||
int32_t rtp_header_length = 12;
|
int32_t rtp_header_length = 12;
|
||||||
|
|
||||||
// Add the CSRCs if any.
|
if (csrcs.size() > 0) {
|
||||||
if (num_csrcs > 0) {
|
|
||||||
if (num_csrcs > kRtpCsrcSize) {
|
|
||||||
// error
|
|
||||||
assert(false);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
uint8_t *ptr = &header[rtp_header_length];
|
uint8_t *ptr = &header[rtp_header_length];
|
||||||
for (int i = 0; i < num_csrcs; ++i) {
|
for (size_t i = 0; i < csrcs.size(); ++i) {
|
||||||
RtpUtility::AssignUWord32ToBuffer(ptr, csrcs[i]);
|
RtpUtility::AssignUWord32ToBuffer(ptr, csrcs[i]);
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
}
|
}
|
||||||
header[0] = (header[0] & 0xf0) | num_csrcs;
|
header[0] = (header[0] & 0xf0) | csrcs.size();
|
||||||
|
|
||||||
// Update length of header.
|
// Update length of header.
|
||||||
rtp_header_length += sizeof(uint32_t) * num_csrcs;
|
rtp_header_length += sizeof(uint32_t) * csrcs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t len = BuildRTPHeaderExtension(header + rtp_header_length);
|
uint16_t len = BuildRTPHeaderExtension(header + rtp_header_length);
|
||||||
@@ -1155,11 +1142,8 @@ int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer,
|
|||||||
uint32_t sequence_number = sequence_number_++;
|
uint32_t sequence_number = sequence_number_++;
|
||||||
capture_time_ms_ = capture_time_ms;
|
capture_time_ms_ = capture_time_ms;
|
||||||
last_packet_marker_bit_ = marker_bit;
|
last_packet_marker_bit_ = marker_bit;
|
||||||
int csrcs_length = 0;
|
return CreateRtpHeader(data_buffer, payload_type, ssrc_, marker_bit,
|
||||||
if (include_csrcs_)
|
timestamp_, sequence_number, csrcs_);
|
||||||
csrcs_length = num_csrcs_;
|
|
||||||
return CreateRTPHeader(data_buffer, payload_type, ssrc_, marker_bit,
|
|
||||||
timestamp_, sequence_number, csrcs_, csrcs_length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t RTPSender::BuildRTPHeaderExtension(uint8_t* data_buffer) const {
|
uint16_t RTPSender::BuildRTPHeaderExtension(uint8_t* data_buffer) const {
|
||||||
@@ -1547,29 +1531,10 @@ uint32_t RTPSender::SSRC() const {
|
|||||||
return ssrc_;
|
return ssrc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPSender::SetCSRCStatus(const bool include) {
|
void RTPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
||||||
CriticalSectionScoped lock(send_critsect_);
|
assert(csrcs.size() <= kRtpCsrcSize);
|
||||||
include_csrcs_ = include;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RTPSender::SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
|
|
||||||
const uint8_t arr_length) {
|
|
||||||
assert(arr_length <= kRtpCsrcSize);
|
|
||||||
CriticalSectionScoped cs(send_critsect_);
|
CriticalSectionScoped cs(send_critsect_);
|
||||||
|
csrcs_ = csrcs;
|
||||||
for (int i = 0; i < arr_length; i++) {
|
|
||||||
csrcs_[i] = arr_of_csrc[i];
|
|
||||||
}
|
|
||||||
num_csrcs_ = arr_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t RTPSender::CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const {
|
|
||||||
assert(arr_of_csrc);
|
|
||||||
CriticalSectionScoped cs(send_critsect_);
|
|
||||||
for (int i = 0; i < num_csrcs_ && i < kRtpCsrcSize; i++) {
|
|
||||||
arr_of_csrc[i] = csrcs_[i];
|
|
||||||
}
|
|
||||||
return num_csrcs_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPSender::SetSequenceNumber(uint16_t seq) {
|
void RTPSender::SetSequenceNumber(uint16_t seq) {
|
||||||
|
|||||||
@@ -126,12 +126,7 @@ class RTPSender : public RTPSenderInterface {
|
|||||||
virtual uint16_t SequenceNumber() const OVERRIDE;
|
virtual uint16_t SequenceNumber() const OVERRIDE;
|
||||||
void SetSequenceNumber(uint16_t seq);
|
void SetSequenceNumber(uint16_t seq);
|
||||||
|
|
||||||
int32_t CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const;
|
void SetCsrcs(const std::vector<uint32_t>& csrcs);
|
||||||
|
|
||||||
void SetCSRCStatus(const bool include);
|
|
||||||
|
|
||||||
void SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
|
|
||||||
const uint8_t arr_length);
|
|
||||||
|
|
||||||
int32_t SetMaxPayloadLength(const size_t length,
|
int32_t SetMaxPayloadLength(const size_t length,
|
||||||
const uint16_t packet_over_head);
|
const uint16_t packet_over_head);
|
||||||
@@ -292,10 +287,13 @@ class RTPSender : public RTPSenderInterface {
|
|||||||
// time.
|
// time.
|
||||||
typedef std::map<int64_t, int> SendDelayMap;
|
typedef std::map<int64_t, int> SendDelayMap;
|
||||||
|
|
||||||
int CreateRTPHeader(uint8_t* header, int8_t payload_type,
|
size_t CreateRtpHeader(uint8_t* header,
|
||||||
uint32_t ssrc, bool marker_bit,
|
int8_t payload_type,
|
||||||
uint32_t timestamp, uint16_t sequence_number,
|
uint32_t ssrc,
|
||||||
const uint32_t* csrcs, uint8_t csrcs_length) const;
|
bool marker_bit,
|
||||||
|
uint32_t timestamp,
|
||||||
|
uint16_t sequence_number,
|
||||||
|
const std::vector<uint32_t>& csrcs) const;
|
||||||
|
|
||||||
void UpdateNACKBitRate(const size_t bytes, const uint32_t now);
|
void UpdateNACKBitRate(const size_t bytes, const uint32_t now);
|
||||||
|
|
||||||
@@ -395,9 +393,7 @@ class RTPSender : public RTPSenderInterface {
|
|||||||
int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_);
|
int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_);
|
||||||
bool media_has_been_sent_ GUARDED_BY(send_critsect_);
|
bool media_has_been_sent_ GUARDED_BY(send_critsect_);
|
||||||
bool last_packet_marker_bit_ GUARDED_BY(send_critsect_);
|
bool last_packet_marker_bit_ GUARDED_BY(send_critsect_);
|
||||||
uint8_t num_csrcs_ GUARDED_BY(send_critsect_);
|
std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_);
|
||||||
uint32_t csrcs_[kRtpCsrcSize] GUARDED_BY(send_critsect_);
|
|
||||||
bool include_csrcs_ GUARDED_BY(send_critsect_);
|
|
||||||
int rtx_ GUARDED_BY(send_critsect_);
|
int rtx_ GUARDED_BY(send_critsect_);
|
||||||
uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_);
|
uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_);
|
||||||
int payload_type_rtx_ GUARDED_BY(send_critsect_);
|
int payload_type_rtx_ GUARDED_BY(send_critsect_);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ using namespace webrtc;
|
|||||||
class RtpRtcpAPITest : public ::testing::Test {
|
class RtpRtcpAPITest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
RtpRtcpAPITest() : module(NULL), fake_clock(123456) {
|
RtpRtcpAPITest() : module(NULL), fake_clock(123456) {
|
||||||
test_CSRC[0] = 1234;
|
test_csrcs.push_back(1234);
|
||||||
test_CSRC[1] = 2345;
|
test_csrcs.push_back(2345);
|
||||||
test_id = 123;
|
test_id = 123;
|
||||||
test_ssrc = 3456;
|
test_ssrc = 3456;
|
||||||
test_timestamp = 4567;
|
test_timestamp = 4567;
|
||||||
@@ -50,7 +50,7 @@ class RtpRtcpAPITest : public ::testing::Test {
|
|||||||
uint32_t test_ssrc;
|
uint32_t test_ssrc;
|
||||||
uint32_t test_timestamp;
|
uint32_t test_timestamp;
|
||||||
uint16_t test_sequence_number;
|
uint16_t test_sequence_number;
|
||||||
uint32_t test_CSRC[webrtc::kRtpCsrcSize];
|
std::vector<uint32_t> test_csrcs;
|
||||||
SimulatedClock fake_clock;
|
SimulatedClock fake_clock;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,14 +84,6 @@ TEST_F(RtpRtcpAPITest, SSRC) {
|
|||||||
EXPECT_EQ(test_ssrc, module->SSRC());
|
EXPECT_EQ(test_ssrc, module->SSRC());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(RtpRtcpAPITest, CSRC) {
|
|
||||||
EXPECT_EQ(0, module->SetCSRCs(test_CSRC, 2));
|
|
||||||
uint32_t testOfCSRC[webrtc::kRtpCsrcSize];
|
|
||||||
EXPECT_EQ(2, module->CSRCs(testOfCSRC));
|
|
||||||
EXPECT_EQ(test_CSRC[0], testOfCSRC[0]);
|
|
||||||
EXPECT_EQ(test_CSRC[1], testOfCSRC[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(RtpRtcpAPITest, RTCP) {
|
TEST_F(RtpRtcpAPITest, RTCP) {
|
||||||
EXPECT_EQ(kRtcpOff, module->RTCP());
|
EXPECT_EQ(kRtcpOff, module->RTCP());
|
||||||
EXPECT_EQ(0, module->SetRTCPStatus(kRtcpCompound));
|
EXPECT_EQ(0, module->SetRTCPStatus(kRtcpCompound));
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ class TestRtpFeedback : public NullRtpFeedback {
|
|||||||
class RtpRtcpRtcpTest : public ::testing::Test {
|
class RtpRtcpRtcpTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
RtpRtcpRtcpTest() : fake_clock(123456) {
|
RtpRtcpRtcpTest() : fake_clock(123456) {
|
||||||
test_CSRC[0] = 1234;
|
test_csrcs.push_back(1234);
|
||||||
test_CSRC[1] = 2345;
|
test_csrcs.push_back(2345);
|
||||||
test_id = 123;
|
test_id = 123;
|
||||||
test_ssrc = 3456;
|
test_ssrc = 3456;
|
||||||
test_timestamp = 4567;
|
test_timestamp = 4567;
|
||||||
@@ -133,7 +133,8 @@ class RtpRtcpRtcpTest : public ::testing::Test {
|
|||||||
module1->SetSSRC(test_ssrc);
|
module1->SetSSRC(test_ssrc);
|
||||||
EXPECT_EQ(0, module1->SetSequenceNumber(test_sequence_number));
|
EXPECT_EQ(0, module1->SetSequenceNumber(test_sequence_number));
|
||||||
EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp));
|
EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp));
|
||||||
EXPECT_EQ(0, module1->SetCSRCs(test_CSRC, 2));
|
|
||||||
|
module1->SetCsrcs(test_csrcs);
|
||||||
EXPECT_EQ(0, module1->SetCNAME("john.doe@test.test"));
|
EXPECT_EQ(0, module1->SetCNAME("john.doe@test.test"));
|
||||||
|
|
||||||
EXPECT_EQ(0, module1->SetSendingStatus(true));
|
EXPECT_EQ(0, module1->SetSendingStatus(true));
|
||||||
@@ -197,7 +198,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
|
|||||||
uint32_t test_ssrc;
|
uint32_t test_ssrc;
|
||||||
uint32_t test_timestamp;
|
uint32_t test_timestamp;
|
||||||
uint16_t test_sequence_number;
|
uint16_t test_sequence_number;
|
||||||
uint32_t test_CSRC[webrtc::kRtpCsrcSize];
|
std::vector<uint32_t> test_csrcs;
|
||||||
SimulatedClock fake_clock;
|
SimulatedClock fake_clock;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -209,16 +210,16 @@ TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
|
|||||||
TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
|
TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
|
||||||
uint32_t testOfCSRC[webrtc::kRtpCsrcSize];
|
uint32_t testOfCSRC[webrtc::kRtpCsrcSize];
|
||||||
EXPECT_EQ(2, rtp_receiver2_->CSRCs(testOfCSRC));
|
EXPECT_EQ(2, rtp_receiver2_->CSRCs(testOfCSRC));
|
||||||
EXPECT_EQ(test_CSRC[0], testOfCSRC[0]);
|
EXPECT_EQ(test_csrcs[0], testOfCSRC[0]);
|
||||||
EXPECT_EQ(test_CSRC[1], testOfCSRC[1]);
|
EXPECT_EQ(test_csrcs[1], testOfCSRC[1]);
|
||||||
|
|
||||||
// Set cname of mixed.
|
// Set cname of mixed.
|
||||||
EXPECT_EQ(0, module1->AddMixedCNAME(test_CSRC[0], "john@192.168.0.1"));
|
EXPECT_EQ(0, module1->AddMixedCNAME(test_csrcs[0], "john@192.168.0.1"));
|
||||||
EXPECT_EQ(0, module1->AddMixedCNAME(test_CSRC[1], "jane@192.168.0.2"));
|
EXPECT_EQ(0, module1->AddMixedCNAME(test_csrcs[1], "jane@192.168.0.2"));
|
||||||
|
|
||||||
EXPECT_EQ(-1, module1->RemoveMixedCNAME(test_CSRC[0] + 1));
|
EXPECT_EQ(-1, module1->RemoveMixedCNAME(test_csrcs[0] + 1));
|
||||||
EXPECT_EQ(0, module1->RemoveMixedCNAME(test_CSRC[1]));
|
EXPECT_EQ(0, module1->RemoveMixedCNAME(test_csrcs[1]));
|
||||||
EXPECT_EQ(0, module1->AddMixedCNAME(test_CSRC[1], "jane@192.168.0.2"));
|
EXPECT_EQ(0, module1->AddMixedCNAME(test_csrcs[1], "jane@192.168.0.2"));
|
||||||
|
|
||||||
// send RTCP packet, triggered by timer
|
// send RTCP packet, triggered by timer
|
||||||
fake_clock.AdvanceTimeMilliseconds(7500);
|
fake_clock.AdvanceTimeMilliseconds(7500);
|
||||||
@@ -233,10 +234,10 @@ TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
|
|||||||
EXPECT_EQ(0, module2->RemoteCNAME(rtp_receiver2_->SSRC(), cName));
|
EXPECT_EQ(0, module2->RemoteCNAME(rtp_receiver2_->SSRC(), cName));
|
||||||
EXPECT_EQ(0, strncmp(cName, "john.doe@test.test", RTCP_CNAME_SIZE));
|
EXPECT_EQ(0, strncmp(cName, "john.doe@test.test", RTCP_CNAME_SIZE));
|
||||||
|
|
||||||
EXPECT_EQ(0, module2->RemoteCNAME(test_CSRC[0], cName));
|
EXPECT_EQ(0, module2->RemoteCNAME(test_csrcs[0], cName));
|
||||||
EXPECT_EQ(0, strncmp(cName, "john@192.168.0.1", RTCP_CNAME_SIZE));
|
EXPECT_EQ(0, strncmp(cName, "john@192.168.0.1", RTCP_CNAME_SIZE));
|
||||||
|
|
||||||
EXPECT_EQ(0, module2->RemoteCNAME(test_CSRC[1], cName));
|
EXPECT_EQ(0, module2->RemoteCNAME(test_csrcs[1], cName));
|
||||||
EXPECT_EQ(0, strncmp(cName, "jane@192.168.0.2", RTCP_CNAME_SIZE));
|
EXPECT_EQ(0, strncmp(cName, "jane@192.168.0.2", RTCP_CNAME_SIZE));
|
||||||
|
|
||||||
EXPECT_EQ(0, module1->SetSendingStatus(false));
|
EXPECT_EQ(0, module1->SetSendingStatus(false));
|
||||||
@@ -257,10 +258,10 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
|||||||
reportBlock.lastSR = 6;
|
reportBlock.lastSR = 6;
|
||||||
|
|
||||||
// Set report blocks.
|
// Set report blocks.
|
||||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[0], &reportBlock));
|
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_csrcs[0], &reportBlock));
|
||||||
|
|
||||||
reportBlock.lastSR= 7;
|
reportBlock.lastSR= 7;
|
||||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[1], &reportBlock));
|
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_csrcs[1], &reportBlock));
|
||||||
|
|
||||||
uint32_t name = 't' << 24;
|
uint32_t name = 't' << 24;
|
||||||
name += 'e' << 16;
|
name += 'e' << 16;
|
||||||
@@ -331,7 +332,7 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
|||||||
EXPECT_GE(10, maxRTT);
|
EXPECT_GE(10, maxRTT);
|
||||||
|
|
||||||
// Set report blocks.
|
// Set report blocks.
|
||||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_CSRC[0], &reportBlock));
|
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_csrcs[0], &reportBlock));
|
||||||
|
|
||||||
// Test receive report.
|
// Test receive report.
|
||||||
EXPECT_EQ(0, module1->SetSendingStatus(false));
|
EXPECT_EQ(0, module1->SetSendingStatus(false));
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ namespace webrtc {
|
|||||||
|
|
||||||
class MockViEFrameCallback : public ViEFrameCallback {
|
class MockViEFrameCallback : public ViEFrameCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD4(DeliverFrame,
|
MOCK_METHOD3(DeliverFrame,
|
||||||
void(int id,
|
void(int id,
|
||||||
I420VideoFrame* video_frame,
|
I420VideoFrame* video_frame,
|
||||||
int num_csrcs,
|
const std::vector<uint32_t>& csrcs));
|
||||||
const uint32_t CSRC[kRtpCsrcSize]));
|
|
||||||
MOCK_METHOD2(DelayChanged, void(int id, int frame_delay));
|
MOCK_METHOD2(DelayChanged, void(int id, int frame_delay));
|
||||||
MOCK_METHOD3(GetPreferedFrameSettings,
|
MOCK_METHOD3(GetPreferedFrameSettings,
|
||||||
int(int* width, int* height, int* frame_rate));
|
int(int* width, int* height, int* frame_rate));
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ bool ViECapturer::ViECaptureProcess() {
|
|||||||
|
|
||||||
void ViECapturer::DeliverI420Frame(I420VideoFrame* video_frame) {
|
void ViECapturer::DeliverI420Frame(I420VideoFrame* video_frame) {
|
||||||
if (video_frame->native_handle() != NULL) {
|
if (video_frame->native_handle() != NULL) {
|
||||||
ViEFrameProviderBase::DeliverFrame(video_frame);
|
ViEFrameProviderBase::DeliverFrame(video_frame, std::vector<uint32_t>());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +534,7 @@ void ViECapturer::DeliverI420Frame(I420VideoFrame* video_frame) {
|
|||||||
video_frame->height());
|
video_frame->height());
|
||||||
}
|
}
|
||||||
// Deliver the captured frame to all observers (channels, renderer or file).
|
// Deliver the captured frame to all observers (channels, renderer or file).
|
||||||
ViEFrameProviderBase::DeliverFrame(video_frame);
|
ViEFrameProviderBase::DeliverFrame(video_frame, std::vector<uint32_t>());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ViECapturer::DeregisterFrameCallback(
|
int ViECapturer::DeregisterFrameCallback(
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class ViECapturerTest : public ::testing::Test {
|
|||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
EXPECT_CALL(*mock_capture_module_, RegisterCaptureDataCallback(_))
|
EXPECT_CALL(*mock_capture_module_, RegisterCaptureDataCallback(_))
|
||||||
.WillRepeatedly(Invoke(this, &ViECapturerTest::SetCaptureDataCallback));
|
.WillRepeatedly(Invoke(this, &ViECapturerTest::SetCaptureDataCallback));
|
||||||
EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_, _, _, _))
|
EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_, _, _))
|
||||||
.WillRepeatedly(
|
.WillRepeatedly(
|
||||||
WithArg<1>(Invoke(this, &ViECapturerTest::AddOutputFrame)));
|
WithArg<1>(Invoke(this, &ViECapturerTest::AddOutputFrame)));
|
||||||
|
|
||||||
|
|||||||
@@ -1497,7 +1497,9 @@ int32_t ViEChannel::FrameToRender(
|
|||||||
arr_ofCSRC[0] = vie_receiver_.GetRemoteSsrc();
|
arr_ofCSRC[0] = vie_receiver_.GetRemoteSsrc();
|
||||||
no_of_csrcs = 1;
|
no_of_csrcs = 1;
|
||||||
}
|
}
|
||||||
DeliverFrame(&video_frame, no_of_csrcs, arr_ofCSRC);
|
std::vector<uint32_t> csrcs(arr_ofCSRC, arr_ofCSRC + no_of_csrcs);
|
||||||
|
DeliverFrame(&video_frame, csrcs);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -501,8 +501,7 @@ RtpRtcp* ViEEncoder::SendRtpRtcpModule() {
|
|||||||
|
|
||||||
void ViEEncoder::DeliverFrame(int id,
|
void ViEEncoder::DeliverFrame(int id,
|
||||||
I420VideoFrame* video_frame,
|
I420VideoFrame* video_frame,
|
||||||
int num_csrcs,
|
const std::vector<uint32_t>& csrcs) {
|
||||||
const uint32_t CSRC[kRtpCsrcSize]) {
|
|
||||||
if (default_rtp_rtcp_->SendingMedia() == false) {
|
if (default_rtp_rtcp_->SendingMedia() == false) {
|
||||||
// We've paused or we have no channels attached, don't encode.
|
// We've paused or we have no channels attached, don't encode.
|
||||||
return;
|
return;
|
||||||
@@ -528,16 +527,16 @@ void ViEEncoder::DeliverFrame(int id,
|
|||||||
video_frame->set_timestamp(time_stamp);
|
video_frame->set_timestamp(time_stamp);
|
||||||
|
|
||||||
// Make sure the CSRC list is correct.
|
// Make sure the CSRC list is correct.
|
||||||
if (num_csrcs > 0) {
|
if (csrcs.size() > 0) {
|
||||||
uint32_t tempCSRC[kRtpCsrcSize];
|
std::vector<uint32_t> temp_csrcs(csrcs.size());
|
||||||
for (int i = 0; i < num_csrcs; i++) {
|
for (size_t i = 0; i < csrcs.size(); i++) {
|
||||||
if (CSRC[i] == 1) {
|
if (csrcs[i] == 1) {
|
||||||
tempCSRC[i] = default_rtp_rtcp_->SSRC();
|
temp_csrcs[i] = default_rtp_rtcp_->SSRC();
|
||||||
} else {
|
} else {
|
||||||
tempCSRC[i] = CSRC[i];
|
temp_csrcs[i] = csrcs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default_rtp_rtcp_->SetCSRCs(tempCSRC, (uint8_t) num_csrcs);
|
default_rtp_rtcp_->SetCsrcs(temp_csrcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
I420VideoFrame* decimated_frame = NULL;
|
I420VideoFrame* decimated_frame = NULL;
|
||||||
|
|||||||
@@ -95,8 +95,7 @@ class ViEEncoder
|
|||||||
// Implementing ViEFrameCallback.
|
// Implementing ViEFrameCallback.
|
||||||
virtual void DeliverFrame(int id,
|
virtual void DeliverFrame(int id,
|
||||||
I420VideoFrame* video_frame,
|
I420VideoFrame* video_frame,
|
||||||
int num_csrcs = 0,
|
const std::vector<uint32_t>& csrcs) OVERRIDE;
|
||||||
const uint32_t CSRC[kRtpCsrcSize] = NULL) OVERRIDE;
|
|
||||||
virtual void DelayChanged(int id, int frame_delay) OVERRIDE;
|
virtual void DelayChanged(int id, int frame_delay) OVERRIDE;
|
||||||
virtual int GetPreferedFrameSettings(int* width,
|
virtual int GetPreferedFrameSettings(int* width,
|
||||||
int* height,
|
int* height,
|
||||||
|
|||||||
@@ -44,10 +44,8 @@ int ViEFrameProviderBase::Id() {
|
|||||||
return id_;
|
return id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViEFrameProviderBase::DeliverFrame(
|
void ViEFrameProviderBase::DeliverFrame(I420VideoFrame* video_frame,
|
||||||
I420VideoFrame* video_frame,
|
const std::vector<uint32_t>& csrcs) {
|
||||||
int num_csrcs,
|
|
||||||
const uint32_t CSRC[kRtpCsrcSize]) {
|
|
||||||
#ifdef DEBUG_
|
#ifdef DEBUG_
|
||||||
const TickTime start_process_time = TickTime::Now();
|
const TickTime start_process_time = TickTime::Now();
|
||||||
#endif
|
#endif
|
||||||
@@ -57,19 +55,19 @@ void ViEFrameProviderBase::DeliverFrame(
|
|||||||
if (frame_callbacks_.size() > 0) {
|
if (frame_callbacks_.size() > 0) {
|
||||||
if (frame_callbacks_.size() == 1) {
|
if (frame_callbacks_.size() == 1) {
|
||||||
// We don't have to copy the frame.
|
// We don't have to copy the frame.
|
||||||
frame_callbacks_.front()->DeliverFrame(id_, video_frame, num_csrcs, CSRC);
|
frame_callbacks_.front()->DeliverFrame(id_, video_frame, csrcs);
|
||||||
} else {
|
} else {
|
||||||
for (FrameCallbacks::iterator it = frame_callbacks_.begin();
|
for (FrameCallbacks::iterator it = frame_callbacks_.begin();
|
||||||
it != frame_callbacks_.end(); ++it) {
|
it != frame_callbacks_.end(); ++it) {
|
||||||
if (video_frame->native_handle() != NULL) {
|
if (video_frame->native_handle() != NULL) {
|
||||||
(*it)->DeliverFrame(id_, video_frame, num_csrcs, CSRC);
|
(*it)->DeliverFrame(id_, video_frame, csrcs);
|
||||||
} else {
|
} else {
|
||||||
// Make a copy of the frame for all callbacks.
|
// Make a copy of the frame for all callbacks.
|
||||||
if (!extra_frame_.get()) {
|
if (!extra_frame_.get()) {
|
||||||
extra_frame_.reset(new I420VideoFrame());
|
extra_frame_.reset(new I420VideoFrame());
|
||||||
}
|
}
|
||||||
extra_frame_->CopyFrame(*video_frame);
|
extra_frame_->CopyFrame(*video_frame);
|
||||||
(*it)->DeliverFrame(id_, extra_frame_.get(), num_csrcs, CSRC);
|
(*it)->DeliverFrame(id_, extra_frame_.get(), csrcs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ class ViEFrameCallback {
|
|||||||
public:
|
public:
|
||||||
virtual void DeliverFrame(int id,
|
virtual void DeliverFrame(int id,
|
||||||
I420VideoFrame* video_frame,
|
I420VideoFrame* video_frame,
|
||||||
int num_csrcs = 0,
|
const std::vector<uint32_t>& csrcs) = 0;
|
||||||
const uint32_t CSRC[kRtpCsrcSize] = NULL) = 0;
|
|
||||||
|
|
||||||
// The capture delay has changed from the provider. |frame_delay| is given in
|
// The capture delay has changed from the provider. |frame_delay| is given in
|
||||||
// ms.
|
// ms.
|
||||||
@@ -76,8 +75,7 @@ class ViEFrameProviderBase {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DeliverFrame(I420VideoFrame* video_frame,
|
void DeliverFrame(I420VideoFrame* video_frame,
|
||||||
int num_csrcs = 0,
|
const std::vector<uint32_t>& csrcs);
|
||||||
const uint32_t CSRC[kRtpCsrcSize] = NULL);
|
|
||||||
void SetFrameDelay(int frame_delay);
|
void SetFrameDelay(int frame_delay);
|
||||||
int FrameDelay();
|
int FrameDelay();
|
||||||
int GetBestFormat(int* best_width,
|
int GetBestFormat(int* best_width,
|
||||||
|
|||||||
@@ -137,8 +137,7 @@ int32_t ViERenderer::Init(const uint32_t z_order,
|
|||||||
|
|
||||||
void ViERenderer::DeliverFrame(int id,
|
void ViERenderer::DeliverFrame(int id,
|
||||||
I420VideoFrame* video_frame,
|
I420VideoFrame* video_frame,
|
||||||
int num_csrcs,
|
const std::vector<uint32_t>& csrcs) {
|
||||||
const uint32_t CSRC[kRtpCsrcSize]) {
|
|
||||||
render_callback_->RenderFrame(render_id_, *video_frame);
|
render_callback_->RenderFrame(render_id_, *video_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ class ViERenderer: public ViEFrameCallback {
|
|||||||
// Implement ViEFrameCallback
|
// Implement ViEFrameCallback
|
||||||
virtual void DeliverFrame(int id,
|
virtual void DeliverFrame(int id,
|
||||||
I420VideoFrame* video_frame,
|
I420VideoFrame* video_frame,
|
||||||
int num_csrcs = 0,
|
const std::vector<uint32_t>& csrcs);
|
||||||
const uint32_t CSRC[kRtpCsrcSize] = NULL);
|
|
||||||
virtual void DelayChanged(int id, int frame_delay);
|
virtual void DelayChanged(int id, int frame_delay);
|
||||||
virtual int GetPreferedFrameSettings(int* width,
|
virtual int GetPreferedFrameSettings(int* width,
|
||||||
int* height,
|
int* height,
|
||||||
|
|||||||
Reference in New Issue
Block a user