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/webrtc@6659 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/config.h b/config.h
index 7717bba..9c8a902 100644
--- a/config.h
+++ b/config.h
@@ -31,7 +31,6 @@
   int fraction_loss;
   int cumulative_loss;
   int extended_max_sequence_number;
-  std::string c_name;
 };
 
 struct StreamStats {
diff --git a/modules/rtp_rtcp/interface/rtp_rtcp.h b/modules/rtp_rtcp/interface/rtp_rtcp.h
index 34f4d3f..b662849 100644
--- a/modules/rtp_rtcp/interface/rtp_rtcp.h
+++ b/modules/rtp_rtcp/interface/rtp_rtcp.h
@@ -378,13 +378,6 @@
     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
     *
     *   return -1 on failure else 0
diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
index fe20c6a..c954aa2 100644
--- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
+++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
@@ -135,8 +135,6 @@
       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]));
diff --git a/modules/rtp_rtcp/source/rtcp_sender.cc b/modules/rtp_rtcp/source/rtcp_sender.cc
index b9ab0c1..fa129ab 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -330,17 +330,17 @@
 {
     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 @@
     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 @@
     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;
diff --git a/modules/rtp_rtcp/source/rtcp_sender.h b/modules/rtp_rtcp/source/rtcp_sender.h
index cbbc32a..71d92c8 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.h
+++ b/modules/rtp_rtcp/source/rtcp_sender.h
@@ -100,7 +100,6 @@
 
     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 @@
     // Full intra request
     uint8_t         _sequenceNumberFIR;
 
-    // REMB    
+    // REMB
     uint8_t       _lengthRembSSRC;
     uint8_t       _sizeRembSSRC;
     uint32_t*     _rembSSRC;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index a7f81c6..f706b42 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -724,10 +724,6 @@
   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]) {
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 37a0fa4..7e7ea02 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -148,9 +148,6 @@
   // 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;
diff --git a/modules/rtp_rtcp/test/testAPI/test_api.cc b/modules/rtp_rtcp/test/testAPI/test_api.cc
index ac2c5ca..3885eb0 100644
--- a/modules/rtp_rtcp/test/testAPI/test_api.cc
+++ b/modules/rtp_rtcp/test/testAPI/test_api.cc
@@ -99,10 +99,6 @@
 
   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());
diff --git a/video/end_to_end_tests.cc b/video/end_to_end_tests.cc
index 8946f89..cdb0fc6 100644
--- a/video/end_to_end_tests.cc
+++ b/video/end_to_end_tests.cc
@@ -1335,8 +1335,6 @@
           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 @@
       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();
diff --git a/video/send_statistics_proxy.cc b/video/send_statistics_proxy.cc
index c9bd05c..cb81d5a 100644
--- a/video/send_statistics_proxy.cc
+++ b/video/send_statistics_proxy.cc
@@ -51,7 +51,6 @@
     stats = stats_;
   }
   stats_provider_->GetSendSideDelay(&stats);
-  stats.c_name = stats_provider_->GetCName();
   return stats;
 }
 
diff --git a/video/send_statistics_proxy.h b/video/send_statistics_proxy.h
index a1ff14c..a313c13 100644
--- a/video/send_statistics_proxy.h
+++ b/video/send_statistics_proxy.h
@@ -38,7 +38,6 @@
 
    public:
     virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) = 0;
-    virtual std::string GetCName() = 0;
   };
 
   SendStatisticsProxy(const VideoSendStream::Config& config,
diff --git a/video/send_statistics_proxy_unittest.cc b/video/send_statistics_proxy_unittest.cc
index 8f35ee4..d800761 100644
--- a/video/send_statistics_proxy_unittest.cc
+++ b/video/send_statistics_proxy_unittest.cc
@@ -46,8 +46,6 @@
     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 @@
     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 @@
   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, 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) {
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index be3fa5c..2a2adbf 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -403,12 +403,6 @@
       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];
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index e177062..fc4a865 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -75,7 +75,6 @@
  protected:
   // From SendStatisticsProxy::StreamStatsProvider.
   virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
-  virtual std::string GetCName() OVERRIDE;
 
  private:
   void ConfigureSsrcs();
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index 52c96d1..ba95d4d 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -924,8 +924,6 @@
 }
 
 TEST_F(VideoSendStreamTest, ProducesStats) {
-  static const std::string kCName =
-      "PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo=";
   class ProducesStats : public test::SendTest {
    public:
     ProducesStats()
@@ -959,8 +957,7 @@
       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 @@
         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);
     }
 
diff --git a/video_engine/include/vie_rtp_rtcp.h b/video_engine/include/vie_rtp_rtcp.h
index 3a56561..f32a9f6 100644
--- a/video_engine/include/vie_rtp_rtcp.h
+++ b/video_engine/include/vie_rtp_rtcp.h
@@ -177,10 +177,12 @@
   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.
diff --git a/video_engine/vie_channel.cc b/video_engine/vie_channel.cc
index 64c2692..1f983e7 100644
--- a/video_engine/vie_channel.cc
+++ b/video_engine/vie_channel.cc
@@ -909,10 +909,6 @@
   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);
diff --git a/video_engine/vie_channel.h b/video_engine/vie_channel.h
index 50ec8ea..ac417ec 100644
--- a/video_engine/vie_channel.h
+++ b/video_engine/vie_channel.h
@@ -159,9 +159,6 @@
   // 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);
diff --git a/video_engine/vie_rtp_rtcp_impl.cc b/video_engine/vie_rtp_rtcp_impl.cc
index 04f5e9b..ffc6d0b 100644
--- a/video_engine/vie_rtp_rtcp_impl.cc
+++ b/video_engine/vie_rtp_rtcp_impl.cc
@@ -338,21 +338,6 @@
   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 {
diff --git a/video_engine/vie_rtp_rtcp_impl.h b/video_engine/vie_rtp_rtcp_impl.h
index 4afe1c5..5566069 100644
--- a/video_engine/vie_rtp_rtcp_impl.h
+++ b/video_engine/vie_rtp_rtcp_impl.h
@@ -57,8 +57,6 @@
                             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(
diff --git a/video_send_stream.h b/video_send_stream.h
index a1bc178..bb4cff2 100644
--- a/video_send_stream.h
+++ b/video_send_stream.h
@@ -50,7 +50,6 @@
     int avg_delay_ms;
     int max_delay_ms;
     bool suspended;
-    std::string c_name;
     std::map<uint32_t, StreamStats> substreams;
   };
 
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc
index f99e590..72dd51a 100644
--- a/voice_engine/channel.cc
+++ b/voice_engine/channel.cc
@@ -3179,22 +3179,6 @@
 }
 
 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])
 {
     if (cName == NULL)
diff --git a/voice_engine/channel.h b/voice_engine/channel.h
index 3c49d9b..5cb2b9c 100644
--- a/voice_engine/channel.h
+++ b/voice_engine/channel.h
@@ -327,7 +327,6 @@
     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,
diff --git a/voice_engine/include/voe_rtp_rtcp.h b/voice_engine/include/voe_rtp_rtcp.h
index ce6f849..6223bd6 100644
--- a/voice_engine/include/voe_rtp_rtcp.h
+++ b/voice_engine/include/voe_rtp_rtcp.h
@@ -171,9 +171,11 @@
     // 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.
diff --git a/voice_engine/voe_rtp_rtcp_impl.cc b/voice_engine/voe_rtp_rtcp_impl.cc
index 8f0e717..370e600 100644
--- a/voice_engine/voe_rtp_rtcp_impl.cc
+++ b/voice_engine/voe_rtp_rtcp_impl.cc
@@ -292,26 +292,6 @@
     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),
diff --git a/voice_engine/voe_rtp_rtcp_impl.h b/voice_engine/voe_rtp_rtcp_impl.h
index c73fcdd..c2599a2 100644
--- a/voice_engine/voe_rtp_rtcp_impl.h
+++ b/voice_engine/voe_rtp_rtcp_impl.h
@@ -27,8 +27,6 @@
 
     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,