Prepare for removal of PeerConnectionObserver::OnError.
Prepare for removal of constraints to PeerConnection::AddStream.

OnError has never been implemented and has been removed from the spec.
Also, constraints to PeerConnection::AddStream has also been removed from the spec and have never been implemented.

R=pbos@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7605 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index d82a54f..fb36cf8 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -586,13 +586,6 @@
     CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
   }
 
-  virtual void OnError() OVERRIDE {
-    ScopedLocalRefFrame local_ref_frame(jni());
-    jmethodID m = GetMethodID(jni(), *j_observer_class_, "onError", "()V");
-    jni()->CallVoidMethod(*j_observer_global_, m);
-    CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
-  }
-
   virtual void OnSignalingChange(
       PeerConnectionInterface::SignalingState new_state) OVERRIDE {
     ScopedLocalRefFrame local_ref_frame(jni());
@@ -3144,12 +3137,9 @@
 }
 
 JOW(jboolean, PeerConnection_nativeAddLocalStream)(
-    JNIEnv* jni, jobject j_pc, jlong native_stream, jobject j_constraints) {
-  scoped_ptr<ConstraintsWrapper> constraints(
-      new ConstraintsWrapper(jni, j_constraints));
+    JNIEnv* jni, jobject j_pc, jlong native_stream) {
   return ExtractNativePC(jni, j_pc)->AddStream(
-      reinterpret_cast<MediaStreamInterface*>(native_stream),
-      constraints.get());
+      reinterpret_cast<MediaStreamInterface*>(native_stream));
 }
 
 JOW(void, PeerConnection_nativeRemoveLocalStream)(
diff --git a/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java b/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java
index c2617de..3aef6ff 100644
--- a/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java
+++ b/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java
@@ -71,9 +71,6 @@
     /** Triggered when a new ICE candidate has been found. */
     public void onIceCandidate(IceCandidate candidate);
 
-    /** Triggered on any error. */
-    public void onError();
-
     /** Triggered when media is received on a new stream from remote peer. */
     public void onAddStream(MediaStream stream);
 
@@ -147,9 +144,8 @@
         candidate.sdpMid, candidate.sdpMLineIndex, candidate.sdp);
   }
 
-  public boolean addStream(
-      MediaStream stream, MediaConstraints constraints) {
-    boolean ret = nativeAddLocalStream(stream.nativeStream, constraints);
+  public boolean addStream(MediaStream stream) {
+    boolean ret = nativeAddLocalStream(stream.nativeStream);
     if (!ret) {
       return false;
     }
@@ -194,8 +190,7 @@
   private native boolean nativeAddIceCandidate(
       String sdpMid, int sdpMLineIndex, String iceCandidateSdp);
 
-  private native boolean nativeAddLocalStream(
-      long nativeStream, MediaConstraints constraints);
+  private native boolean nativeAddLocalStream(long nativeStream);
 
   private native void nativeRemoveLocalStream(long nativeStream);
 
diff --git a/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java b/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java
index 240e996..048d92b 100644
--- a/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java
+++ b/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java
@@ -117,11 +117,6 @@
       ++expectedErrors;
     }
 
-    @Override
-    public synchronized void onError() {
-      assertTrue(--expectedErrors >= 0);
-    }
-
     public synchronized void expectSetSize() {
       if (RENDER_TO_GUI) {
         // When new frames are delivered to the GUI renderer we don't get
@@ -489,7 +484,7 @@
     lMS.addTrack(videoTrack);
     lMS.addTrack(factory.createAudioTrack(
         audioTrackId, factory.createAudioSource(new MediaConstraints())));
-    pc.addStream(lMS, new MediaConstraints());
+    pc.addStream(lMS);
     return new WeakReference<MediaStream>(lMS);
   }
 
diff --git a/talk/app/webrtc/objc/RTCPeerConnection.mm b/talk/app/webrtc/objc/RTCPeerConnection.mm
index 72ba373..925de73 100644
--- a/talk/app/webrtc/objc/RTCPeerConnection.mm
+++ b/talk/app/webrtc/objc/RTCPeerConnection.mm
@@ -151,10 +151,8 @@
   return self.peerConnection->AddIceCandidate(iceCandidate.get());
 }
 
-- (BOOL)addStream:(RTCMediaStream*)stream
-      constraints:(RTCMediaConstraints*)constraints {
-  BOOL ret = self.peerConnection->AddStream(stream.mediaStream,
-                                            constraints.constraints);
+- (BOOL)addStream:(RTCMediaStream*)stream {
+  BOOL ret = self.peerConnection->AddStream(stream.mediaStream);
   if (!ret) {
     return NO;
   }
diff --git a/talk/app/webrtc/objc/RTCPeerConnectionObserver.h b/talk/app/webrtc/objc/RTCPeerConnectionObserver.h
index f66b567..8378ff8 100644
--- a/talk/app/webrtc/objc/RTCPeerConnectionObserver.h
+++ b/talk/app/webrtc/objc/RTCPeerConnectionObserver.h
@@ -41,8 +41,6 @@
   RTCPeerConnectionObserver(RTCPeerConnection* peerConnection);
   virtual ~RTCPeerConnectionObserver();
 
-  virtual void OnError() OVERRIDE;
-
   // Triggered when the SignalingState changed.
   virtual void OnSignalingChange(
       PeerConnectionInterface::SignalingState new_state) OVERRIDE;
diff --git a/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm b/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm
index a0206e5..f4cab7f 100644
--- a/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm
+++ b/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm
@@ -46,10 +46,6 @@
 RTCPeerConnectionObserver::~RTCPeerConnectionObserver() {
 }
 
-void RTCPeerConnectionObserver::OnError() {
-  [_peerConnection.delegate peerConnectionOnError:_peerConnection];
-}
-
 void RTCPeerConnectionObserver::OnSignalingChange(
     PeerConnectionInterface::SignalingState new_state) {
   RTCSignalingState state =
diff --git a/talk/app/webrtc/objc/public/RTCPeerConnection.h b/talk/app/webrtc/objc/public/RTCPeerConnection.h
index 32a9830..6d47f77 100644
--- a/talk/app/webrtc/objc/public/RTCPeerConnection.h
+++ b/talk/app/webrtc/objc/public/RTCPeerConnection.h
@@ -64,8 +64,7 @@
 // Add a new MediaStream to be sent on this PeerConnection.
 // Note that a SessionDescription negotiation is needed before the
 // remote peer can receive the stream.
-- (BOOL)addStream:(RTCMediaStream *)stream
-      constraints:(RTCMediaConstraints *)constraints;
+- (BOOL)addStream:(RTCMediaStream *)stream;
 
 // Remove a MediaStream from this PeerConnection.
 // Note that a SessionDescription negotiation is need before the
diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h b/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h
index 4b177d5..ee6ec7a 100644
--- a/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h
+++ b/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h
@@ -38,9 +38,6 @@
 // implemented to get messages from PeerConnection.
 @protocol RTCPeerConnectionDelegate<NSObject>
 
-// Triggered when there is an error.
-- (void)peerConnectionOnError:(RTCPeerConnection *)peerConnection;
-
 // Triggered when the SignalingState changed.
 - (void)peerConnection:(RTCPeerConnection *)peerConnection
  signalingStateChanged:(RTCSignalingState)stateChanged;
diff --git a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
index c3f898a..fbcf217 100644
--- a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
+++ b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
@@ -151,11 +151,6 @@
 
 #pragma mark - RTCPeerConnectionDelegate methods
 
-- (void)peerConnectionOnError:(RTCPeerConnection*)peerConnection {
-  NSLog(@"RTCPeerConnectionDelegate::onError");
-  NSAssert(--_expectedErrors >= 0, @"Unexpected error");
-}
-
 - (void)peerConnection:(RTCPeerConnection*)peerConnection
     signalingStateChanged:(RTCSignalingState)stateChanged {
   int expectedState = [self popFirstElementAsInt:_expectedSignalingChanges];
diff --git a/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm b/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm
index 909503a..6c5950b 100644
--- a/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm
+++ b/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm
@@ -89,8 +89,7 @@
   [localMediaStream addVideoTrack:videoTrack];
   RTCAudioTrack* audioTrack = [factory audioTrackWithID:audioTrackID];
   [localMediaStream addAudioTrack:audioTrack];
-  RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] init];
-  [pc addStream:localMediaStream constraints:constraints];
+  [pc addStream:localMediaStream];
   return localMediaStream;
 }
 
diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc
index 4799489..64ddcad 100644
--- a/talk/app/webrtc/peerconnection.cc
+++ b/talk/app/webrtc/peerconnection.cc
@@ -404,8 +404,7 @@
   return mediastream_signaling_->remote_streams();
 }
 
-bool PeerConnection::AddStream(MediaStreamInterface* local_stream,
-                               const MediaConstraintsInterface* constraints) {
+bool PeerConnection::AddStream(MediaStreamInterface* local_stream) {
   if (IsClosed()) {
     return false;
   }
@@ -413,7 +412,6 @@
                               local_stream))
     return false;
 
-  // TODO(perkj): Implement support for MediaConstraints in AddStream.
   if (!mediastream_signaling_->AddLocalStream(local_stream)) {
     return false;
   }
diff --git a/talk/app/webrtc/peerconnection.h b/talk/app/webrtc/peerconnection.h
index fb03802..68aa154 100644
--- a/talk/app/webrtc/peerconnection.h
+++ b/talk/app/webrtc/peerconnection.h
@@ -65,8 +65,7 @@
       PeerConnectionObserver* observer);
   virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams();
   virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams();
-  virtual bool AddStream(MediaStreamInterface* local_stream,
-                         const MediaConstraintsInterface* constraints);
+  virtual bool AddStream(MediaStreamInterface* local_stream);
   virtual void RemoveStream(MediaStreamInterface* local_stream);
 
   virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
diff --git a/talk/app/webrtc/peerconnection_unittest.cc b/talk/app/webrtc/peerconnection_unittest.cc
index ce745de..c250eea 100644
--- a/talk/app/webrtc/peerconnection_unittest.cc
+++ b/talk/app/webrtc/peerconnection_unittest.cc
@@ -179,7 +179,7 @@
       stream->AddTrack(CreateLocalVideoTrack(stream_label));
     }
 
-    EXPECT_TRUE(peer_connection_->AddStream(stream, NULL));
+    EXPECT_TRUE(peer_connection_->AddStream(stream));
   }
 
   size_t NumberOfLocalMediaStreams() {
@@ -426,7 +426,6 @@
   }
 
   // PeerConnectionObserver callbacks.
-  virtual void OnError() {}
   virtual void OnMessage(const std::string&) {}
   virtual void OnSignalingMessage(const std::string& /*msg*/) {}
   virtual void OnSignalingChange(
diff --git a/talk/app/webrtc/peerconnectionfactory_unittest.cc b/talk/app/webrtc/peerconnectionfactory_unittest.cc
index 5995c46..e687b8b 100644
--- a/talk/app/webrtc/peerconnectionfactory_unittest.cc
+++ b/talk/app/webrtc/peerconnectionfactory_unittest.cc
@@ -40,6 +40,7 @@
 #include "webrtc/base/thread.h"
 
 using webrtc::FakeVideoTrackRenderer;
+using webrtc::DataChannelInterface;
 using webrtc::MediaStreamInterface;
 using webrtc::PeerConnectionFactoryInterface;
 using webrtc::PeerConnectionInterface;
@@ -83,13 +84,13 @@
 
 class NullPeerConnectionObserver : public PeerConnectionObserver {
  public:
-  virtual void OnError() {}
   virtual void OnMessage(const std::string& msg) {}
   virtual void OnSignalingMessage(const std::string& msg) {}
   virtual void OnSignalingChange(
       PeerConnectionInterface::SignalingState new_state) {}
   virtual void OnAddStream(MediaStreamInterface* stream) {}
   virtual void OnRemoveStream(MediaStreamInterface* stream) {}
+  virtual void OnDataChannel(DataChannelInterface* data_channel) {}
   virtual void OnRenegotiationNeeded() {}
   virtual void OnIceConnectionChange(
       PeerConnectionInterface::IceConnectionState new_state) {}
diff --git a/talk/app/webrtc/peerconnectioninterface.h b/talk/app/webrtc/peerconnectioninterface.h
index 6ef4847..edbf6e3 100644
--- a/talk/app/webrtc/peerconnectioninterface.h
+++ b/talk/app/webrtc/peerconnectioninterface.h
@@ -252,11 +252,17 @@
   virtual rtc::scoped_refptr<StreamCollectionInterface>
       remote_streams() = 0;
 
+  // Deprecated:
+  // TODO(perkj): Remove once its not used by Chrome.
+  virtual bool AddStream(MediaStreamInterface* stream,
+                           const MediaConstraintsInterface* constraints) {
+    return AddStream(stream);
+  }
+
   // Add a new MediaStream to be sent on this PeerConnection.
   // Note that a SessionDescription negotiation is needed before the
   // remote peer can receive the stream.
-  virtual bool AddStream(MediaStreamInterface* stream,
-                         const MediaConstraintsInterface* constraints) = 0;
+  virtual bool AddStream(MediaStreamInterface* stream) = 0;
 
   // Remove a MediaStream from this PeerConnection.
   // Note that a SessionDescription negotiation is need before the
@@ -344,7 +350,9 @@
     kIceState,
   };
 
-  virtual void OnError() = 0;
+  // Deprecated.
+  // TODO(perkj): Remove once its not used by Chrome.
+  virtual void OnError() {}
 
   // Triggered when the SignalingState changed.
   virtual void OnSignalingChange(
@@ -361,8 +369,7 @@
   virtual void OnRemoveStream(MediaStreamInterface* stream) = 0;
 
   // Triggered when a remote peer open a data channel.
-  // TODO(perkj): Make pure virtual.
-  virtual void OnDataChannel(DataChannelInterface* data_channel) {}
+  virtual void OnDataChannel(DataChannelInterface* data_channel) = 0;
 
   // Triggered when renegotiation is needed, for example the ICE has restarted.
   virtual void OnRenegotiationNeeded() = 0;
diff --git a/talk/app/webrtc/peerconnectioninterface_unittest.cc b/talk/app/webrtc/peerconnectioninterface_unittest.cc
index bf60673..3be6280 100644
--- a/talk/app/webrtc/peerconnectioninterface_unittest.cc
+++ b/talk/app/webrtc/peerconnectioninterface_unittest.cc
@@ -132,7 +132,6 @@
       state_ = pc_->signaling_state();
     }
   }
-  virtual void OnError() {}
   virtual void OnSignalingChange(
       PeerConnectionInterface::SignalingState new_state) {
     EXPECT_EQ(pc_->signaling_state(), new_state);
@@ -320,7 +319,7 @@
     scoped_refptr<VideoTrackInterface> video_track(
         pc_factory_->CreateVideoTrack(label + "v0", video_source));
     stream->AddTrack(video_track.get());
-    EXPECT_TRUE(pc_->AddStream(stream, NULL));
+    EXPECT_TRUE(pc_->AddStream(stream));
     EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
     observer_.renegotiation_needed_ = false;
   }
@@ -332,7 +331,7 @@
     scoped_refptr<AudioTrackInterface> audio_track(
         pc_factory_->CreateAudioTrack(label + "a0", NULL));
     stream->AddTrack(audio_track.get());
-    EXPECT_TRUE(pc_->AddStream(stream, NULL));
+    EXPECT_TRUE(pc_->AddStream(stream));
     EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
     observer_.renegotiation_needed_ = false;
   }
@@ -350,7 +349,7 @@
     scoped_refptr<VideoTrackInterface> video_track(
         pc_factory_->CreateVideoTrack(video_track_label, NULL));
     stream->AddTrack(video_track.get());
-    EXPECT_TRUE(pc_->AddStream(stream, NULL));
+    EXPECT_TRUE(pc_->AddStream(stream));
     EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
     observer_.renegotiation_needed_ = false;
   }
@@ -574,7 +573,7 @@
       pc_factory_->CreateAudioTrack(
           kStreamLabel3, static_cast<AudioSourceInterface*>(NULL)));
   stream->AddTrack(audio_track.get());
-  EXPECT_TRUE(pc_->AddStream(stream, NULL));
+  EXPECT_TRUE(pc_->AddStream(stream));
   EXPECT_EQ(3u, pc_->local_streams()->count());
 
   // Remove the third stream.
@@ -1180,7 +1179,7 @@
   pc_->Close();
 
   pc_->RemoveStream(local_stream);
-  EXPECT_FALSE(pc_->AddStream(local_stream, NULL));
+  EXPECT_FALSE(pc_->AddStream(local_stream));
 
   ASSERT_FALSE(local_stream->GetAudioTracks().empty());
   rtc::scoped_refptr<webrtc::DtmfSenderInterface> dtmf_sender(
diff --git a/talk/app/webrtc/peerconnectionproxy.h b/talk/app/webrtc/peerconnectionproxy.h
index ed26eb8..852d852 100644
--- a/talk/app/webrtc/peerconnectionproxy.h
+++ b/talk/app/webrtc/peerconnectionproxy.h
@@ -39,8 +39,7 @@
                 local_streams)
   PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>,
                 remote_streams)
-  PROXY_METHOD2(bool, AddStream, MediaStreamInterface*,
-                const MediaConstraintsInterface*)
+  PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
   PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
   PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
                 CreateDtmfSender, AudioTrackInterface*)
diff --git a/talk/app/webrtc/test/peerconnectiontestwrapper.cc b/talk/app/webrtc/test/peerconnectiontestwrapper.cc
index 24932b8..e3b8015 100644
--- a/talk/app/webrtc/test/peerconnectiontestwrapper.cc
+++ b/talk/app/webrtc/test/peerconnectiontestwrapper.cc
@@ -253,7 +253,7 @@
     bool video, const webrtc::FakeConstraints& video_constraints) {
   rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
       GetUserMedia(audio, audio_constraints, video, video_constraints);
-  EXPECT_TRUE(peer_connection_->AddStream(stream, NULL));
+  EXPECT_TRUE(peer_connection_->AddStream(stream));
 }
 
 rtc::scoped_refptr<webrtc::MediaStreamInterface>
diff --git a/talk/app/webrtc/test/peerconnectiontestwrapper.h b/talk/app/webrtc/test/peerconnectiontestwrapper.h
index d4a0e4e..d8299ec 100644
--- a/talk/app/webrtc/test/peerconnectiontestwrapper.h
+++ b/talk/app/webrtc/test/peerconnectiontestwrapper.h
@@ -57,7 +57,6 @@
       const webrtc::DataChannelInit& init);
 
   // Implements PeerConnectionObserver.
-  virtual void OnError() {}
   virtual void OnSignalingChange(
      webrtc::PeerConnectionInterface::SignalingState new_state) {}
   virtual void OnStateChange(
diff --git a/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java b/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java
index daea5fb..9c917bb 100644
--- a/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java
+++ b/talk/examples/android/src/org/appspot/apprtc/PeerConnectionClient.java
@@ -110,7 +110,7 @@
     if (videoConstraints != null) {
       videoMediaStream = factory.createLocalMediaStream("ARDAMSVideo");
       videoMediaStream.addTrack(createVideoTrack(useFrontFacingCamera));
-      pc.addStream(videoMediaStream, new MediaConstraints());
+      pc.addStream(videoMediaStream);
     }
 
     if (appRtcParameters.audioConstraints != null) {
@@ -118,7 +118,7 @@
       lMS.addTrack(factory.createAudioTrack(
           "ARDAMSa0",
           factory.createAudioSource(appRtcParameters.audioConstraints)));
-      pc.addStream(lMS, new MediaConstraints());
+      pc.addStream(lMS);
     }
   }
 
@@ -409,7 +409,7 @@
     useFrontFacingCamera = !useFrontFacingCamera;
     VideoTrack newTrack = createVideoTrack(useFrontFacingCamera);
     videoMediaStream.addTrack(newTrack);
-    pc.addStream(videoMediaStream, new MediaConstraints());
+    pc.addStream(videoMediaStream);
 
     SessionDescription remoteDesc = pc.getRemoteDescription();
     if (localSdp == null || remoteDesc == null) {
@@ -441,11 +441,6 @@
     }
 
     @Override
-    public void onError() {
-      reportError("PeerConnection error!");
-    }
-
-    @Override
     public void onSignalingChange(
         PeerConnection.SignalingState newState) {
       Log.d(TAG, "SignalingState: " + newState);
diff --git a/talk/examples/objc/AppRTCDemo/APPRTCConnectionManager.m b/talk/examples/objc/AppRTCDemo/APPRTCConnectionManager.m
index b411a62..9a39528 100644
--- a/talk/examples/objc/AppRTCDemo/APPRTCConnectionManager.m
+++ b/talk/examples/objc/AppRTCDemo/APPRTCConnectionManager.m
@@ -170,7 +170,7 @@
 #endif
 
   [lms addAudioTrack:[self.peerConnectionFactory audioTrackWithID:@"ARDAMSa0"]];
-  [self.peerConnection addStream:lms constraints:constraints];
+  [self.peerConnection addStream:lms];
   [self.logger logMessage:@"onICEServers - added local stream."];
 }
 
@@ -243,16 +243,6 @@
 
 #pragma mark - RTCPeerConnectionDelegate
 
-- (void)peerConnectionOnError:(RTCPeerConnection*)peerConnection {
-  dispatch_async(dispatch_get_main_queue(), ^{
-    NSString* message = @"PeerConnection error";
-    NSLog(@"%@", message);
-    NSAssert(NO, @"PeerConnection failed.");
-    [self.delegate connectionManager:self
-                 didErrorWithMessage:message];
-  });
-}
-
 - (void)peerConnection:(RTCPeerConnection*)peerConnection
     signalingStateChanged:(RTCSignalingState)stateChanged {
   dispatch_async(dispatch_get_main_queue(), ^{
diff --git a/talk/examples/peerconnection/client/conductor.cc b/talk/examples/peerconnection/client/conductor.cc
index f49aee6..e81f7fc 100644
--- a/talk/examples/peerconnection/client/conductor.cc
+++ b/talk/examples/peerconnection/client/conductor.cc
@@ -137,11 +137,6 @@
 // PeerConnectionObserver implementation.
 //
 
-void Conductor::OnError() {
-  LOG(LS_ERROR) << __FUNCTION__;
-  main_wnd_->QueueUIThreadCallback(PEER_CONNECTION_ERROR, NULL);
-}
-
 // Called when a remote stream is added
 void Conductor::OnAddStream(webrtc::MediaStreamInterface* stream) {
   LOG(INFO) << __FUNCTION__ << " " << stream->label();
@@ -373,7 +368,7 @@
 
   stream->AddTrack(audio_track);
   stream->AddTrack(video_track);
-  if (!peer_connection_->AddStream(stream, NULL)) {
+  if (!peer_connection_->AddStream(stream)) {
     LOG(LS_ERROR) << "Adding stream to PeerConnection failed";
   }
   typedef std::pair<std::string,
@@ -440,10 +435,6 @@
       break;
     }
 
-    case PEER_CONNECTION_ERROR:
-      main_wnd_->MessageBox("Error", "an unknown error occurred", true);
-      break;
-
     case NEW_STREAM_ADDED: {
       webrtc::MediaStreamInterface* stream =
           reinterpret_cast<webrtc::MediaStreamInterface*>(
diff --git a/talk/examples/peerconnection/client/conductor.h b/talk/examples/peerconnection/client/conductor.h
index 0aff531..3ef5253 100644
--- a/talk/examples/peerconnection/client/conductor.h
+++ b/talk/examples/peerconnection/client/conductor.h
@@ -58,7 +58,6 @@
     MEDIA_CHANNELS_INITIALIZED = 1,
     PEER_CONNECTION_CLOSED,
     SEND_MESSAGE_TO_PEER,
-    PEER_CONNECTION_ERROR,
     NEW_STREAM_ADDED,
     STREAM_REMOVED,
   };
@@ -80,11 +79,11 @@
   //
   // PeerConnectionObserver implementation.
   //
-  virtual void OnError();
   virtual void OnStateChange(
       webrtc::PeerConnectionObserver::StateType state_changed) {}
   virtual void OnAddStream(webrtc::MediaStreamInterface* stream);
   virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream);
+  virtual void OnDataChannel(webrtc::DataChannelInterface* channel) {}
   virtual void OnRenegotiationNeeded() {}
   virtual void OnIceChange() {}
   virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate);