Remove the send-side cname getter APIs from voice and video engine.

These APIs aren't being used, and introduces deadlocks when using GetStats() in the new Call api. Having getters for cname at the send-side is pointless, as it's always the user who sets the cname.

R=henrika@webrtc.org, pbos@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6659 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2014-07-11 09:55:30 +00:00
parent 0f426685e1
commit 4ef438e2de
26 changed files with 16 additions and 129 deletions

View File

@ -31,7 +31,6 @@ struct RtpStatistics {
int fraction_loss;
int cumulative_loss;
int extended_max_sequence_number;
std::string c_name;
};
struct StreamStats {

View File

@ -377,13 +377,6 @@ class RtpRtcp : public Module {
*/
virtual int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
/*
* Get RTCP CName (i.e unique identifier)
*
* return -1 on failure else 0
*/
virtual int32_t CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
/*
* Get remote CName
*

View File

@ -135,8 +135,6 @@ class MockRtpRtcp : public RtpRtcp {
int32_t(const RTCPMethod method));
MOCK_METHOD1(SetCNAME,
int32_t(const char cName[RTCP_CNAME_SIZE]));
MOCK_METHOD1(CNAME,
int32_t(char cName[RTCP_CNAME_SIZE]));
MOCK_CONST_METHOD2(RemoteCNAME,
int32_t(const uint32_t remoteSSRC,
char cName[RTCP_CNAME_SIZE]));

View File

@ -330,17 +330,17 @@ RTCPSender::SetREMBData(const uint32_t bitrate,
{
CriticalSectionScoped lock(_criticalSectionRTCPSender);
_rembBitrate = bitrate;
if(_sizeRembSSRC < numberOfSSRC)
{
delete [] _rembSSRC;
_rembSSRC = new uint32_t[numberOfSSRC];
_sizeRembSSRC = numberOfSSRC;
}
}
_lengthRembSSRC = numberOfSSRC;
for (int i = 0; i < numberOfSSRC; i++)
{
{
_rembSSRC[i] = SSRC[i];
}
_sendREMB = true;
@ -431,14 +431,6 @@ RTCPSender::SetCameraDelay(const int32_t delayMS)
return 0;
}
int32_t RTCPSender::CNAME(char cName[RTCP_CNAME_SIZE]) {
assert(cName);
CriticalSectionScoped lock(_criticalSectionRTCPSender);
cName[RTCP_CNAME_SIZE - 1] = 0;
strncpy(cName, _CNAME, RTCP_CNAME_SIZE - 1);
return 0;
}
int32_t RTCPSender::SetCNAME(const char cName[RTCP_CNAME_SIZE]) {
if (!cName)
return -1;
@ -1175,7 +1167,7 @@ RTCPSender::BuildREMB(uint8_t* rtcpbuffer, int& pos)
rtcpbuffer[pos++]=(uint8_t)(brMantissa >> 8);
rtcpbuffer[pos++]=(uint8_t)(brMantissa);
for (int i = 0; i < _lengthRembSSRC; i++)
for (int i = 0; i < _lengthRembSSRC; i++)
{
RtpUtility::AssignUWord32ToBuffer(rtcpbuffer + pos, _rembSSRC[i]);
pos += 4;

View File

@ -100,7 +100,6 @@ public:
int32_t SetCameraDelay(const int32_t delayMS);
int32_t CNAME(char cName[RTCP_CNAME_SIZE]);
int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]);
int32_t AddMixedCNAME(const uint32_t SSRC,
@ -320,7 +319,7 @@ private:
// Full intra request
uint8_t _sequenceNumberFIR;
// REMB
// REMB
uint8_t _lengthRembSSRC;
uint8_t _sizeRembSSRC;
uint32_t* _rembSSRC;

View File

@ -724,10 +724,6 @@ int32_t ModuleRtpRtcpImpl::SetCNAME(const char c_name[RTCP_CNAME_SIZE]) {
return rtcp_sender_.SetCNAME(c_name);
}
int32_t ModuleRtpRtcpImpl::CNAME(char c_name[RTCP_CNAME_SIZE]) {
return rtcp_sender_.CNAME(c_name);
}
int32_t ModuleRtpRtcpImpl::AddMixedCNAME(
const uint32_t ssrc,
const char c_name[RTCP_CNAME_SIZE]) {

View File

@ -148,9 +148,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
// Set RTCP CName.
virtual int32_t SetCNAME(const char c_name[RTCP_CNAME_SIZE]) OVERRIDE;
// Get RTCP CName.
virtual int32_t CNAME(char c_name[RTCP_CNAME_SIZE]) OVERRIDE;
// Get remote CName.
virtual int32_t RemoteCNAME(const uint32_t remote_ssrc,
char c_name[RTCP_CNAME_SIZE]) const OVERRIDE;

View File

@ -99,10 +99,6 @@ TEST_F(RtpRtcpAPITest, RTCP) {
EXPECT_EQ(0, module->SetCNAME("john.doe@test.test"));
char cName[RTCP_CNAME_SIZE];
EXPECT_EQ(0, module->CNAME(cName));
EXPECT_STRCASEEQ(cName, "john.doe@test.test");
EXPECT_FALSE(module->TMMBR());
EXPECT_EQ(0, module->SetTMMBRStatus(true));
EXPECT_TRUE(module->TMMBR());

View File

@ -1335,8 +1335,6 @@ TEST_F(EndToEndTest, GetStats) {
stats.avg_delay_ms != 0 || stats.discarded_packets != 0 ||
stats.key_frames != 0 || stats.delta_frames != 0;
receive_stats_filled_["CName"] |= stats.c_name == expected_cname_;
return AllStatsFilled(receive_stats_filled_);
}
@ -1350,8 +1348,6 @@ TEST_F(EndToEndTest, GetStats) {
send_stats_filled_["Delay"] |=
stats.avg_delay_ms != 0 || stats.max_delay_ms != 0;
receive_stats_filled_["CName"] |= stats.c_name == expected_cname_;
for (std::map<uint32_t, StreamStats>::const_iterator it =
stats.substreams.begin();
it != stats.substreams.end();

View File

@ -51,7 +51,6 @@ VideoSendStream::Stats SendStatisticsProxy::GetStats() const {
stats = stats_;
}
stats_provider_->GetSendSideDelay(&stats);
stats.c_name = stats_provider_->GetCName();
return stats;
}

View File

@ -38,7 +38,6 @@ class SendStatisticsProxy : public RtcpStatisticsCallback,
public:
virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) = 0;
virtual std::string GetCName() = 0;
};
SendStatisticsProxy(const VideoSendStream::Config& config,

View File

@ -46,8 +46,6 @@ class SendStatisticsProxyTest : public ::testing::Test,
return true;
}
virtual std::string GetCName() { return cname_; }
void ExpectEqual(VideoSendStream::Stats one, VideoSendStream::Stats other) {
EXPECT_EQ(one.avg_delay_ms, other.avg_delay_ms);
EXPECT_EQ(one.input_frame_rate, other.input_frame_rate);
@ -55,7 +53,6 @@ class SendStatisticsProxyTest : public ::testing::Test,
EXPECT_EQ(one.avg_delay_ms, other.avg_delay_ms);
EXPECT_EQ(one.max_delay_ms, other.max_delay_ms);
EXPECT_EQ(one.suspended, other.suspended);
EXPECT_EQ(one.c_name, other.c_name);
EXPECT_EQ(one.substreams.size(), other.substreams.size());
for (std::map<uint32_t, StreamStats>::const_iterator it =
@ -92,7 +89,6 @@ class SendStatisticsProxyTest : public ::testing::Test,
VideoSendStream::Config config_;
int avg_delay_ms_;
int max_delay_ms_;
std::string cname_;
VideoSendStream::Stats expected_;
typedef std::map<uint32_t, StreamStats>::const_iterator StreamIterator;
};
@ -206,13 +202,11 @@ TEST_F(SendStatisticsProxyTest, Bitrate) {
TEST_F(SendStatisticsProxyTest, StreamStats) {
avg_delay_ms_ = 1;
max_delay_ms_ = 2;
cname_ = "qwertyuiop";
VideoSendStream::Stats stats = statistics_proxy_->GetStats();
EXPECT_EQ(avg_delay_ms_, stats.avg_delay_ms);
EXPECT_EQ(max_delay_ms_, stats.max_delay_ms);
EXPECT_EQ(cname_, stats.c_name);
}
TEST_F(SendStatisticsProxyTest, NoSubstreams) {

View File

@ -403,12 +403,6 @@ bool VideoSendStream::GetSendSideDelay(VideoSendStream::Stats* stats) {
channel_, &stats->avg_delay_ms, &stats->max_delay_ms);
}
std::string VideoSendStream::GetCName() {
char rtcp_cname[ViERTP_RTCP::KMaxRTCPCNameLength];
rtp_rtcp_->GetRTCPCName(channel_, rtcp_cname);
return rtcp_cname;
}
void VideoSendStream::ConfigureSsrcs() {
for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) {
uint32_t ssrc = config_.rtp.ssrcs[i];

View File

@ -75,7 +75,6 @@ class VideoSendStream : public webrtc::VideoSendStream,
protected:
// From SendStatisticsProxy::StreamStatsProvider.
virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
virtual std::string GetCName() OVERRIDE;
private:
void ConfigureSsrcs();

View File

@ -924,8 +924,6 @@ TEST_F(VideoSendStreamTest, NoPaddingWhenVideoIsMuted) {
}
TEST_F(VideoSendStreamTest, ProducesStats) {
static const std::string kCName =
"PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo=";
class ProducesStats : public test::SendTest {
public:
ProducesStats()
@ -959,8 +957,7 @@ TEST_F(VideoSendStreamTest, ProducesStats) {
VideoSendStream::Stats stats = stream_->GetStats();
// Check that all applicable data sources have been used.
if (stats.input_frame_rate > 0 && stats.encode_frame_rate > 0 &&
stats.avg_delay_ms > 0 && stats.c_name == kCName &&
!stats.substreams.empty()) {
stats.avg_delay_ms > 0 && !stats.substreams.empty()) {
uint32_t ssrc = stats.substreams.begin()->first;
EXPECT_NE(
config_.rtp.ssrcs.end(),
@ -983,7 +980,6 @@ TEST_F(VideoSendStreamTest, ProducesStats) {
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
std::vector<VideoStream>* video_streams) OVERRIDE {
send_config->rtp.c_name = kCName;
SetConfig(*send_config);
}

View File

@ -177,10 +177,12 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
virtual int SetRTCPCName(const int video_channel,
const char rtcp_cname[KMaxRTCPCNameLength]) = 0;
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
// sent the specified channel.
// TODO(holmer): Remove this API once it has been removed from
// fakewebrtcvideoengine.h.
virtual int GetRTCPCName(const int video_channel,
char rtcp_cname[KMaxRTCPCNameLength]) const = 0;
char rtcp_cname[KMaxRTCPCNameLength]) const {
return -1;
}
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
// received on the specified channel.

View File

@ -909,10 +909,6 @@ int32_t ViEChannel::SetRTCPCName(const char rtcp_cname[]) {
return rtp_rtcp_->SetCNAME(rtcp_cname);
}
int32_t ViEChannel::GetRTCPCName(char rtcp_cname[]) {
return rtp_rtcp_->CNAME(rtcp_cname);
}
int32_t ViEChannel::GetRemoteRTCPCName(char rtcp_cname[]) {
uint32_t remoteSSRC = vie_receiver_.GetRemoteSsrc();
return rtp_rtcp_->RemoteCNAME(remoteSSRC, rtcp_cname);

View File

@ -159,9 +159,6 @@ class ViEChannel
// Sets the CName for the outgoing stream on the channel.
int32_t SetRTCPCName(const char rtcp_cname[]);
// Gets the CName for the outgoing stream on the channel.
int32_t GetRTCPCName(char rtcp_cname[]);
// Gets the CName of the incoming stream.
int32_t GetRemoteRTCPCName(char rtcp_cname[]);
int32_t RegisterRtpObserver(ViERTPObserver* observer);

View File

@ -338,21 +338,6 @@ int ViERTP_RTCPImpl::SetRTCPCName(const int video_channel,
return 0;
}
int ViERTP_RTCPImpl::GetRTCPCName(const int video_channel,
char rtcp_cname[KMaxRTCPCNameLength]) const {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) {
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
if (vie_channel->GetRTCPCName(rtcp_cname) != 0) {
shared_data_->SetLastError(kViERtpRtcpUnknownError);
return -1;
}
return 0;
}
int ViERTP_RTCPImpl::GetRemoteRTCPCName(
const int video_channel,
char rtcp_cname[KMaxRTCPCNameLength]) const {

View File

@ -57,8 +57,6 @@ class ViERTP_RTCPImpl
ViERTCPMode& rtcp_mode) const;
virtual int SetRTCPCName(const int video_channel,
const char rtcp_cname[KMaxRTCPCNameLength]);
virtual int GetRTCPCName(const int video_channel,
char rtcp_cname[KMaxRTCPCNameLength]) const;
virtual int GetRemoteRTCPCName(const int video_channel,
char rtcp_cname[KMaxRTCPCNameLength]) const;
virtual int SendApplicationDefinedRTCPPacket(

View File

@ -50,7 +50,6 @@ class VideoSendStream {
int avg_delay_ms;
int max_delay_ms;
bool suspended;
std::string c_name;
std::map<uint32_t, StreamStats> substreams;
};

View File

@ -3178,22 +3178,6 @@ Channel::SetRTCP_CNAME(const char cName[256])
return 0;
}
int
Channel::GetRTCP_CNAME(char cName[256])
{
if (_rtpRtcpModule->CNAME(cName) != 0)
{
_engineStatisticsPtr->SetLastError(
VE_RTP_RTCP_MODULE_ERROR, kTraceError,
"GetRTCP_CNAME() failed to retrieve RTCP CNAME");
return -1;
}
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
VoEId(_instanceId, _channelId),
"GetRTCP_CNAME() => cName=%s", cName);
return 0;
}
int
Channel::GetRemoteRTCP_CNAME(char cName[256])
{

View File

@ -327,7 +327,6 @@ public:
int SetRTCPStatus(bool enable);
int GetRTCPStatus(bool& enabled);
int SetRTCP_CNAME(const char cName[256]);
int GetRTCP_CNAME(char cName[256]);
int GetRemoteRTCP_CNAME(char cName[256]);
int GetRemoteRTCPData(unsigned int& NTPHigh, unsigned int& NTPLow,
unsigned int& timestamp,

View File

@ -171,9 +171,11 @@ public:
// specific |channel|.
virtual int SetRTCP_CNAME(int channel, const char cName[256]) = 0;
// Gets the canonical name (CNAME) parameter for RTCP reports on a
// specific |channel|.
virtual int GetRTCP_CNAME(int channel, char cName[256]) = 0;
// TODO(holmer): Remove this API once it has been removed from
// fakewebrtcvoiceengine.h.
virtual int GetRTCP_CNAME(int channel, char cName[256]) {
return -1;
}
// Gets the canonical name (CNAME) parameter for incoming RTCP reports
// on a specific channel.

View File

@ -292,26 +292,6 @@ int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256])
return channelPtr->SetRTCP_CNAME(cName);
}
int VoERTP_RTCPImpl::GetRTCP_CNAME(int channel, char cName[256])
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"GetRTCP_CNAME(channel=%d, cName=?)", channel);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetRTCP_CNAME() failed to locate channel");
return -1;
}
return channelPtr->GetRTCP_CNAME(cName);
}
int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256])
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),

View File

@ -27,8 +27,6 @@ public:
virtual int SetRTCP_CNAME(int channel, const char cName[256]);
virtual int GetRTCP_CNAME(int channel, char cName[256]);
virtual int GetRemoteRTCP_CNAME(int channel, char cName[256]);
virtual int GetRemoteRTCPData(int channel,