Remove old_factory from WebRtcVideoEngine.

Minor pending cleanup.

R=pthatcher@webrtc.org
BUG=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7875 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/media/webrtc/webrtcvideoengine.cc b/talk/media/webrtc/webrtcvideoengine.cc
index a072eb7..139d508 100644
--- a/talk/media/webrtc/webrtcvideoengine.cc
+++ b/talk/media/webrtc/webrtcvideoengine.cc
@@ -1153,10 +1153,6 @@
     Terminate();
   }
 
-  if (simulcast_encoder_factory_) {
-    SetExternalEncoderFactory(NULL);
-  }
-
   tracing_->SetTraceCallback(NULL);
   // Test to see if the media processor was deregistered properly.
   ASSERT(SignalMediaFrame.is_empty());
@@ -1675,10 +1671,13 @@
 
 void WebRtcVideoEngine::SetExternalEncoderFactory(
     WebRtcVideoEncoderFactory* encoder_factory) {
-  // Deleted after WebRtcVideoEngine::SetExternalEncoderFactory is
-  // completed, which will remove the references to it.
-  rtc::scoped_ptr<WebRtcVideoEncoderFactory> old_factory(
-      simulcast_encoder_factory_.release());
+  if (encoder_factory_ == encoder_factory)
+    return;
+
+  // No matter what happens we shouldn't hold on to a stale
+  // SimulcastEncoderFactory.
+  simulcast_encoder_factory_.reset();
+
   if (encoder_factory) {
     const std::vector<WebRtcVideoEncoderFactory::VideoCodec>& codecs =
         encoder_factory->codecs();
@@ -1689,9 +1688,6 @@
     }
   }
 
-  if (encoder_factory_ == encoder_factory)
-    return;
-
   encoder_factory_ = encoder_factory;
 
   // Rebuild codec list while reapplying the current default codec format.