Remove intermediate RTCP CNAME buffers.
Sets CNAME using a pointer to only perform a copy inside the RTCP sender. BUG= R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50169005 Cr-Commit-Position: refs/heads/master@{#9346}
This commit is contained in:
parent
aff1c8489f
commit
9ba52f89ac
@ -338,7 +338,7 @@ class RtpRtcp : public Module {
|
||||
*
|
||||
* return -1 on failure else 0
|
||||
*/
|
||||
virtual int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
|
||||
virtual int32_t SetCNAME(const char* c_name) = 0;
|
||||
|
||||
/*
|
||||
* Get remote CName
|
||||
|
||||
@ -315,13 +315,14 @@ void RTCPSender::SetRemoteSSRC(uint32_t ssrc) {
|
||||
remote_ssrc_ = ssrc;
|
||||
}
|
||||
|
||||
int32_t RTCPSender::SetCNAME(const char cName[RTCP_CNAME_SIZE]) {
|
||||
if (!cName)
|
||||
int32_t RTCPSender::SetCNAME(const char* c_name) {
|
||||
if (!c_name)
|
||||
return -1;
|
||||
|
||||
DCHECK_LT(strlen(c_name), static_cast<size_t>(RTCP_CNAME_SIZE));
|
||||
CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
||||
cname_[RTCP_CNAME_SIZE - 1] = 0;
|
||||
strncpy(cname_, cName, RTCP_CNAME_SIZE - 1);
|
||||
strncpy(cname_, c_name, RTCP_CNAME_SIZE - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
void SetRemoteSSRC(uint32_t ssrc);
|
||||
|
||||
int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]);
|
||||
int32_t SetCNAME(const char* cName);
|
||||
|
||||
int32_t AddMixedCNAME(uint32_t SSRC, const char cName[RTCP_CNAME_SIZE]);
|
||||
|
||||
|
||||
@ -493,7 +493,7 @@ void ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) {
|
||||
rtcp_receiver_.SetRTCPStatus(method);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::SetCNAME(const char c_name[RTCP_CNAME_SIZE]) {
|
||||
int32_t ModuleRtpRtcpImpl::SetCNAME(const char* c_name) {
|
||||
return rtcp_sender_.SetCNAME(c_name);
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
void SetRTCPStatus(RTCPMethod method) override;
|
||||
|
||||
// Set RTCP CName.
|
||||
int32_t SetCNAME(const char c_name[RTCP_CNAME_SIZE]) override;
|
||||
int32_t SetCNAME(const char* c_name) override;
|
||||
|
||||
// Get remote CName.
|
||||
int32_t RemoteCNAME(uint32_t remote_ssrc,
|
||||
|
||||
@ -172,12 +172,7 @@ VideoSendStream::VideoSendStream(
|
||||
|
||||
ConfigureSsrcs();
|
||||
|
||||
char rtcp_cname[RTCP_CNAME_SIZE];
|
||||
DCHECK_LT(config_.rtp.c_name.length(), sizeof(rtcp_cname));
|
||||
strncpy(rtcp_cname, config_.rtp.c_name.c_str(), sizeof(rtcp_cname) - 1);
|
||||
rtcp_cname[sizeof(rtcp_cname) - 1] = '\0';
|
||||
|
||||
vie_channel_->SetRTCPCName(rtcp_cname);
|
||||
vie_channel_->SetRTCPCName(config_.rtp.c_name.c_str());
|
||||
|
||||
vie_capturer_ = new ViECapturer(module_process_thread_, vie_encoder_);
|
||||
|
||||
|
||||
@ -1075,7 +1075,7 @@ RtpState ViEChannel::GetRtpStateForSsrc(uint32_t ssrc) {
|
||||
return rtp_state;
|
||||
}
|
||||
|
||||
int32_t ViEChannel::SetRTCPCName(const char rtcp_cname[]) {
|
||||
int32_t ViEChannel::SetRTCPCName(const char* rtcp_cname) {
|
||||
if (rtp_rtcp_->Sending()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ class ViEChannel : public VCMFrameTypeCallback,
|
||||
RtpState GetRtpStateForSsrc(uint32_t ssrc);
|
||||
|
||||
// Sets the CName for the outgoing stream on the channel.
|
||||
int32_t SetRTCPCName(const char rtcp_cname[]);
|
||||
int32_t SetRTCPCName(const char* rtcp_cname);
|
||||
|
||||
// Gets the CName of the incoming stream.
|
||||
int32_t GetRemoteRTCPCName(char rtcp_cname[]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user