Update talk to 58127566 together with
https://webrtc-codereview.appspot.com/5309005/.

R=mallinath@webrtc.org, niklas.enbom@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5277 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/localaudiosource.cc b/talk/app/webrtc/localaudiosource.cc
index 2cd472a..3dc5c6c 100644
--- a/talk/app/webrtc/localaudiosource.cc
+++ b/talk/app/webrtc/localaudiosource.cc
@@ -54,8 +54,6 @@
 const char MediaConstraintsInterface::kTypingNoiseDetection[] =
     "googTypingNoiseDetection";
 const char MediaConstraintsInterface::kAudioMirroring[] = "googAudioMirroring";
-// TODO(perkj): Remove kInternalAecDump once its not used by Chrome.
-const char MediaConstraintsInterface::kInternalAecDump[] = "deprecatedAecDump";
 
 namespace {
 
@@ -129,8 +127,6 @@
     return;
   }
   options_.SetAll(audio_options);
-  if (options.enable_aec_dump)
-    options_.aec_dump.Set(true);
   source_state_ = kLive;
 }
 
diff --git a/talk/app/webrtc/mediaconstraintsinterface.h b/talk/app/webrtc/mediaconstraintsinterface.h
index ba6b09b..5cf2184 100644
--- a/talk/app/webrtc/mediaconstraintsinterface.h
+++ b/talk/app/webrtc/mediaconstraintsinterface.h
@@ -117,13 +117,6 @@
   // stripped by Chrome before passed down to Libjingle.
   static const char kInternalConstraintPrefix[];
 
-  // These constraints are for internal use only, representing Chrome command
-  // line flags. So they are prefixed with "internal" so JS values will be
-  // removed.
-  // Used by a local audio source.
-  // TODO(perkj): Remove once Chrome use PeerConnectionFactory::SetOptions.
-  static const char kInternalAecDump[];  // internalAecDump
-
  protected:
   // Dtor protected as objects shouldn't be deleted via this interface
   virtual ~MediaConstraintsInterface() {}
diff --git a/talk/app/webrtc/peerconnectionfactory.cc b/talk/app/webrtc/peerconnectionfactory.cc
index e8b8f63..ee15b5d 100644
--- a/talk/app/webrtc/peerconnectionfactory.cc
+++ b/talk/app/webrtc/peerconnectionfactory.cc
@@ -105,12 +105,21 @@
   scoped_refptr<webrtc::VideoSourceInterface> source;
 };
 
+struct StartAecDumpParams : public talk_base::MessageData {
+  explicit StartAecDumpParams(FILE* aec_dump_file)
+      : aec_dump_file(aec_dump_file) {
+  }
+  FILE* aec_dump_file;
+  bool result;
+};
+
 enum {
   MSG_INIT_FACTORY = 1,
   MSG_TERMINATE_FACTORY,
   MSG_CREATE_PEERCONNECTION,
   MSG_CREATE_AUDIOSOURCE,
   MSG_CREATE_VIDEOSOURCE,
+  MSG_START_AEC_DUMP,
 };
 
 }  // namespace
@@ -223,6 +232,12 @@
       pdata->source = CreateVideoSource_s(pdata->capturer, pdata->constraints);
       break;
     }
+    case MSG_START_AEC_DUMP: {
+      StartAecDumpParams* pdata =
+          static_cast<StartAecDumpParams*>(msg->pdata);
+      pdata->result = StartAecDump_s(pdata->aec_dump_file);
+      break;
+    }
   }
 }
 
@@ -274,6 +289,10 @@
   return VideoSourceProxy::Create(signaling_thread_, source);
 }
 
+bool PeerConnectionFactory::StartAecDump_s(FILE* file) {
+  return channel_manager_->StartAecDump(file);
+}
+
 scoped_refptr<PeerConnectionInterface>
 PeerConnectionFactory::CreatePeerConnection(
     const PeerConnectionInterface::IceServers& configuration,
@@ -361,6 +380,12 @@
   return AudioTrackProxy::Create(signaling_thread_, track);
 }
 
+bool PeerConnectionFactory::StartAecDump(FILE* file) {
+  StartAecDumpParams params(file);
+  signaling_thread_->Send(this, MSG_START_AEC_DUMP, &params);
+  return params.result;
+}
+
 cricket::ChannelManager* PeerConnectionFactory::channel_manager() {
   return channel_manager_.get();
 }
diff --git a/talk/app/webrtc/peerconnectionfactory.h b/talk/app/webrtc/peerconnectionfactory.h
index dff885d..63d37f0 100644
--- a/talk/app/webrtc/peerconnectionfactory.h
+++ b/talk/app/webrtc/peerconnectionfactory.h
@@ -78,6 +78,8 @@
       CreateAudioTrack(const std::string& id,
                        AudioSourceInterface* audio_source);
 
+  virtual bool StartAecDump(FILE* file);
+
   virtual cricket::ChannelManager* channel_manager();
   virtual talk_base::Thread* signaling_thread();
   virtual talk_base::Thread* worker_thread();
@@ -93,7 +95,6 @@
       cricket::WebRtcVideoDecoderFactory* video_decoder_factory);
   virtual ~PeerConnectionFactory();
 
-
  private:
   bool Initialize_s();
   void Terminate_s();
@@ -108,6 +109,8 @@
       PortAllocatorFactoryInterface* allocator_factory,
       DTLSIdentityServiceInterface* dtls_identity_service,
       PeerConnectionObserver* observer);
+  bool StartAecDump_s(FILE* file);
+
   // Implements talk_base::MessageHandler.
   void OnMessage(talk_base::Message* msg);
 
diff --git a/talk/app/webrtc/peerconnectioninterface.h b/talk/app/webrtc/peerconnectioninterface.h
index a127dad..01f1e1c 100644
--- a/talk/app/webrtc/peerconnectioninterface.h
+++ b/talk/app/webrtc/peerconnectioninterface.h
@@ -393,11 +393,9 @@
   class Options {
    public:
     Options() :
-      enable_aec_dump(false),
       disable_encryption(false),
       disable_sctp_data_channels(false) {
     }
-    bool enable_aec_dump;
     bool disable_encryption;
     bool disable_sctp_data_channels;
   };
@@ -442,6 +440,12 @@
       CreateAudioTrack(const std::string& label,
                        AudioSourceInterface* source) = 0;
 
+  // Starts AEC dump using existing file. Takes ownership of |file| and passes
+  // it on to VoiceEngine (via other objects) immediately, which will take
+  // the ownerhip.
+  // TODO(grunell): Remove when Chromium has started to use AEC in each source.
+  virtual bool StartAecDump(FILE* file) = 0;
+
  protected:
   // Dtor and ctor protected as objects shouldn't be created or deleted via
   // this interface.