Revert "Remove VideoSendStreamInput::PutFrame."

This reverts r6229.

Test WebRtcVideoChannel2BaseTest.MuteStream fails after r6229.

BUG=
R=stefan@webrtc.org
TBR=mflodman@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6230 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/video/full_stack.cc b/video/full_stack.cc
index cb97cd8..cb0ba55 100644
--- a/video/full_stack.cc
+++ b/video/full_stack.cc
@@ -125,6 +125,10 @@
     return receiver_->DeliverPacket(packet, length);
   }
 
+  virtual void PutFrame(const I420VideoFrame& video_frame) OVERRIDE {
+    ADD_FAILURE() << "PutFrame() should not have been called in this test.";
+  }
+
   virtual void SwapFrame(I420VideoFrame* video_frame) OVERRIDE {
     I420VideoFrame* copy = NULL;
     {
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index ced0b69..7cdb353 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -280,12 +280,24 @@
   rtp_rtcp_->Release();
 }
 
+void VideoSendStream::PutFrame(const I420VideoFrame& frame) {
+  input_frame_.CopyFrame(frame);
+  SwapFrame(&input_frame_);
+}
+
 void VideoSendStream::SwapFrame(I420VideoFrame* frame) {
+  // TODO(pbos): Warn if frame is "too far" into the future, or too old. This
+  //             would help detect if frame's being used without NTP.
+  //             TO REVIEWER: Is there any good check for this? Should it be
+  //             skipped?
+  if (frame != &input_frame_)
+    input_frame_.SwapFrame(frame);
+
   // TODO(pbos): Local rendering should not be done on the capture thread.
   if (config_.local_renderer != NULL)
-    config_.local_renderer->RenderFrame(*frame, 0);
+    config_.local_renderer->RenderFrame(input_frame_, 0);
 
-  external_capture_->SwapFrame(frame);
+  external_capture_->SwapFrame(&input_frame_);
 }
 
 VideoSendStreamInput* VideoSendStream::Input() { return this; }
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index a7e2267..b8f5661 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -57,6 +57,7 @@
   bool DeliverRtcp(const uint8_t* packet, size_t length);
 
   // From VideoSendStreamInput.
+  virtual void PutFrame(const I420VideoFrame& frame) OVERRIDE;
   virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
 
   // From webrtc::VideoSendStream.
@@ -68,6 +69,7 @@
   virtual std::string GetCName() OVERRIDE;
 
  private:
+  I420VideoFrame input_frame_;
   TransportAdapter transport_adapter_;
   EncodedFrameCallbackAdapter encoded_frame_proxy_;
   scoped_ptr<CriticalSectionWrapper> codec_lock_;
diff --git a/video_send_stream.h b/video_send_stream.h
index 87c0dac..1a94121 100644
--- a/video_send_stream.h
+++ b/video_send_stream.h
@@ -29,6 +29,7 @@
   // These methods do not lock internally and must be called sequentially.
   // If your application switches input sources synchronization must be done
   // externally to make sure that any old frames are not delivered concurrently.
+  virtual void PutFrame(const I420VideoFrame& video_frame) = 0;
   virtual void SwapFrame(I420VideoFrame* video_frame) = 0;
 
  protected: