Video engine - removing unused functionality.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2959 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/video_capture/main/interface/video_capture.h b/src/modules/video_capture/main/interface/video_capture.h
index 43380ec..38e0e07 100644
--- a/src/modules/video_capture/main/interface/video_capture.h
+++ b/src/modules/video_capture/main/interface/video_capture.h
@@ -122,12 +122,6 @@
 
   virtual WebRtc_Word32 StopCapture() = 0;
 
-  // Send an image when the capture device is not running.
-  virtual WebRtc_Word32 StartSendImage(const VideoFrame& videoFrame,
-                                       WebRtc_Word32 frameRate = 1) = 0;
-
-  virtual WebRtc_Word32 StopSendImage() = 0;
-
   // Returns the name of the device used by this module.
   virtual const char* CurrentDeviceName() const = 0;
 
diff --git a/src/modules/video_capture/main/source/video_capture_impl.cc b/src/modules/video_capture/main/source/video_capture_impl.cc
index 1084ff4..c326f5c 100644
--- a/src/modules/video_capture/main/source/video_capture_impl.cc
+++ b/src/modules/video_capture/main/source/video_capture_impl.cc
@@ -49,22 +49,11 @@
 WebRtc_Word32 VideoCaptureImpl::TimeUntilNextProcess()
 {
     CriticalSectionScoped cs(&_callBackCs);
-    TickTime timeNow = TickTime::Now();
 
     WebRtc_Word32 timeToNormalProcess = kProcessInterval
         - (WebRtc_Word32)((TickTime::Now() - _lastProcessTime).Milliseconds());
-    WebRtc_Word32 timeToStartImage = timeToNormalProcess;
-    if (_startImageFrameIntervall)
-    {
-        timeToStartImage = _startImageFrameIntervall
-            - (WebRtc_Word32)((timeNow - _lastSentStartImageTime).Milliseconds());
-        if (timeToStartImage < 0)
-        {
-            timeToStartImage = 0;
-        }
-    }
-    return (timeToStartImage < timeToNormalProcess)
-            ? timeToStartImage : timeToNormalProcess;
+
+    return timeToNormalProcess;
 }
 
 // Process any pending tasks such as timeouts
@@ -112,19 +101,6 @@
 
     _lastProcessFrameCount = _incomingFrameTimes[0];
 
-    // Handle start image frame rates.
-    if (_startImageFrameIntervall
-        && (now - _lastSentStartImageTime).Milliseconds() >= _startImageFrameIntervall)
-    {
-        _lastSentStartImageTime = now;
-        if (_dataCallBack)
-        {
-            _captureFrame.CopyFrame(_startImage);
-            _captureFrame.SetRenderTime(TickTime::MillisecondTimestamp());
-            _dataCallBack->OnIncomingCapturedFrame(_id, _captureFrame,
-                                                   kVideoCodecUnknown);
-        }
-    }
     return 0;
 }
 
@@ -136,8 +112,6 @@
       _lastFrameRateCallbackTime(TickTime::Now()), _frameRateCallBack(false),
       _noPictureAlarmCallBack(false), _captureAlarm(Cleared), _setCaptureDelay(0),
       _dataCallBack(NULL), _captureCallBack(NULL),
-      _startImage(), _startImageFrameIntervall(0),
-      _lastSentStartImageTime(TickTime::Now()),
       _lastProcessFrameCount(TickTime::Now()), _rotateFrame(kRotateNone),
       last_capture_time_(TickTime::MillisecondTimestamp())
 
@@ -210,7 +184,6 @@
 WebRtc_Word32 VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame,
     WebRtc_Word64 capture_time, VideoCodecType codec_type) {
   UpdateFrameCount();  // frame count used for local frame rate callback.
-  _startImageFrameIntervall = 0;  // prevent the start image to be displayed.
 
   const bool callOnCaptureDelayChanged = _setCaptureDelay != _captureDelay;
   // Capture delay changed
@@ -246,7 +219,6 @@
     VideoFrame& captureFrame, WebRtc_Word64 capture_time,
     VideoCodecType codec_type) {
   UpdateFrameCount();  // frame count used for local frame rate callback.
-  _startImageFrameIntervall = 0;  // prevent the start image to be displayed.
 
   const bool callOnCaptureDelayChanged = _setCaptureDelay != _captureDelay;
   // Capture delay changed
@@ -446,31 +418,6 @@
     return 0;
 }
 
-WebRtc_Word32 VideoCaptureImpl::StartSendImage(const VideoFrame& videoFrame,
-                                                     WebRtc_Word32 frameRate)
-{
-    CriticalSectionScoped cs(&_apiCs);
-    CriticalSectionScoped cs2(&_callBackCs);
-    if (frameRate < 1 || frameRate > kMaxFrameRate)
-    {
-        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
-                   "StartSendImage Invalid parameter. frameRate %d", (int) frameRate);
-        return -1;;
-    }
-    _startImage.CopyFrame(videoFrame);
-    _startImageFrameIntervall = 1000 / frameRate;
-    _lastSentStartImageTime = TickTime::Now();
-    return 0;
-
-}
-WebRtc_Word32 VideoCaptureImpl::StopSendImage()
-{
-    CriticalSectionScoped cs(&_apiCs);
-    CriticalSectionScoped cs2(&_callBackCs);
-    _startImageFrameIntervall = 0;
-    return 0;
-}
-
 WebRtc_Word32 VideoCaptureImpl::EnableFrameRateCallback(const bool enable)
 {
     CriticalSectionScoped cs(&_apiCs);
diff --git a/src/modules/video_capture/main/source/video_capture_impl.h b/src/modules/video_capture/main/source/video_capture_impl.h
index 12c822f..5d9021f 100644
--- a/src/modules/video_capture/main/source/video_capture_impl.h
+++ b/src/modules/video_capture/main/source/video_capture_impl.h
@@ -59,10 +59,6 @@
     virtual WebRtc_Word32 RegisterCaptureCallback(VideoCaptureFeedBack& callBack);
     virtual WebRtc_Word32 DeRegisterCaptureCallback();
 
-    virtual WebRtc_Word32 StartSendImage(const VideoFrame& videoFrame,
-                                         WebRtc_Word32 frameRate = 1);
-    virtual WebRtc_Word32 StopSendImage();
-
     virtual WebRtc_Word32 SetCaptureDelay(WebRtc_Word32 delayMS);
     virtual WebRtc_Word32 CaptureDelay();
     virtual WebRtc_Word32 SetCaptureRotation(VideoCaptureRotation rotation);
@@ -129,9 +125,6 @@
     VideoCaptureDataCallback* _dataCallBack;
     VideoCaptureFeedBack* _captureCallBack;
 
-    VideoFrame _startImage;
-    WebRtc_Word32 _startImageFrameIntervall;
-    TickTime _lastSentStartImageTime; // last time the start image was sent
     TickTime _lastProcessFrameCount;
     TickTime _incomingFrameTimes[kFrameRateCountHistorySize];// timestamp for local captured frames
     VideoRotationMode _rotateFrame; //Set if the frame should be rotated by the capture module.
diff --git a/src/modules/video_capture/main/test/video_capture_unittest.cc b/src/modules/video_capture/main/test/video_capture_unittest.cc
index 1a96abe..62a0069 100644
--- a/src/modules/video_capture/main/test/video_capture_unittest.cc
+++ b/src/modules/video_capture/main/test/video_capture_unittest.cc
@@ -557,19 +557,3 @@
   EXPECT_TRUE(capture_feedback_.frame_rate() >= 25 &&
               capture_feedback_.frame_rate() <= 33);
 }
-
-// Test start image
-TEST_F(VideoCaptureExternalTest , StartImage) {
-  EXPECT_EQ(0, capture_module_->StartSendImage(
-      test_frame_, 10));
-
-  EXPECT_TRUE_WAIT(capture_callback_.incoming_frames() == 5, kTimeOut);
-  EXPECT_EQ(0, capture_module_->StopSendImage());
-
-  SleepMs(200);
-  // Test that no more start images have arrived.
-  EXPECT_TRUE(capture_callback_.incoming_frames() >= 4 &&
-              capture_callback_.incoming_frames() <= 5);
-  EXPECT_TRUE(capture_callback_.CompareLastFrame(test_frame_));
-}
-
diff --git a/src/video_engine/include/vie_errors.h b/src/video_engine/include/vie_errors.h
index 16c9299..bcaec7d 100644
--- a/src/video_engine/include/vie_errors.h
+++ b/src/video_engine/include/vie_errors.h
@@ -74,8 +74,6 @@
   kViEFileInvalidFile,                // Can't open the file with provided filename. Is the path and file format correct?
   kViEFileInvalidCapture,             // Can't use ViEPicture. Is the object correct?
   kViEFileSetRenderTimeoutError,      // SetRenderTimeoutImage- Please see log file.
-  kViEFileInvalidCaptureId,           // SetCaptureDeviceImage capture id does not exist.
-  kViEFileSetCaptureImageError,       // SetCaptureDeviceImage error. Please see log file.
   kViEFileSetStartImageError,         // SetRenderStartImage error. Please see log file.
   kViEFileUnknownError,               // An unknown error has occurred. Check the log file.
 
diff --git a/src/video_engine/include/vie_file.h b/src/video_engine/include/vie_file.h
index 6a521cf..c27d74d 100644
--- a/src/video_engine/include/vie_file.h
+++ b/src/video_engine/include/vie_file.h
@@ -175,18 +175,6 @@
   virtual int GetCaptureDeviceSnapshot(const int capture_id,
                                        ViEPicture& picture) = 0;
 
-  // This function sets a jpg image to show before the first frame is captured
-  // by the capture device. This frame will be encoded and transmitted to a
-  // possible receiver
-  virtual int SetCaptureDeviceImage(const int capture_id,
-                                    const char* file_name_utf8) = 0;
-
-  // This function sets an image to show before the first frame is captured by
-  // the capture device. This frame will be encoded and transmitted to a
-  // possible receiver
-  virtual int SetCaptureDeviceImage(const int capture_id,
-                                    const ViEPicture& picture) = 0;
-
   virtual int FreePicture(ViEPicture& picture) = 0;
 
   // This function sets a jpg image to render before the first received video
diff --git a/src/video_engine/test/auto_test/source/vie_autotest_file.cc b/src/video_engine/test/auto_test/source/vie_autotest_file.cc
index 4d5ee74..45ceda4 100644
--- a/src/video_engine/test/auto_test/source/vie_autotest_file.cc
+++ b/src/video_engine/test/auto_test/source/vie_autotest_file.cc
@@ -332,37 +332,6 @@
 
         AutoTestSleep(TEST_SPACING);
 
-        // Testing: SetCaptureDeviceImage
-        {
-            ViETest::Log("Testing SetCaptureDeviceImage(int, char*)");
-            EXPECT_EQ(0, ptrViECapture->StopCapture(captureId));
-            EXPECT_EQ(0, ptrViEFile->SetCaptureDeviceImage(
-                captureId, captureDeviceImage.c_str()));
-
-            ViETest::Log("you should see the capture device image now");
-            AutoTestSleep(2 * RENDER_TIMEOUT);
-            EXPECT_EQ(0, ptrViECapture->StartCapture(captureId));
-            ViETest::Log("Done\n");
-        }
-
-        AutoTestSleep(TEST_SPACING);
-
-        // Testing: SetCaptureDeviceImage
-        if (FLAGS_include_timing_dependent_tests)
-        {
-            ViETest::Log("Testing SetCaptureDeviceImage(int, ViEPicture)");
-            EXPECT_EQ(0, ptrViECapture->StopCapture(captureId));
-            EXPECT_EQ(0, ptrViEFile->SetCaptureDeviceImage(
-                captureId, capturePicture));
-
-            ViETest::Log("you should see the capture device image now");
-            AutoTestSleep(2 * RENDER_TIMEOUT);
-            EXPECT_EQ(0, ptrViECapture->StartCapture(captureId));
-            ViETest::Log("Done\n");
-        }
-
-        AutoTestSleep(TEST_SPACING);
-
         // testing SetRenderStartImage(videoChannel, renderStartImage);
         if (FLAGS_include_timing_dependent_tests)
         {
diff --git a/src/video_engine/vie_capturer.cc b/src/video_engine/vie_capturer.cc
index c2c0e8b..ad9f39d 100644
--- a/src/video_engine/vie_capturer.cc
+++ b/src/video_engine/vie_capturer.cc
@@ -898,9 +898,4 @@
   observer_->NoPictureAlarm(id, vie_alarm);
 }
 
-WebRtc_Word32 ViECapturer::SetCaptureDeviceImage(
-    const VideoFrame& capture_device_image) {
-  return capture_module_->StartSendImage(capture_device_image, 10);
-}
-
 }  // namespace webrtc
diff --git a/src/video_engine/vie_capturer.h b/src/video_engine/vie_capturer.h
index 5fc0dad..1102898 100644
--- a/src/video_engine/vie_capturer.h
+++ b/src/video_engine/vie_capturer.h
@@ -105,9 +105,6 @@
   // Information.
   const char* CurrentDeviceName() const;
 
-  // Set device image.
-  WebRtc_Word32 SetCaptureDeviceImage(const VideoFrame& capture_device_image);
-
  protected:
   ViECapturer(int capture_id,
               int engine_id,
diff --git a/src/video_engine/vie_file_impl.cc b/src/video_engine/vie_file_impl.cc
index 1e2753b..147b766 100644
--- a/src/video_engine/vie_file_impl.cc
+++ b/src/video_engine/vie_file_impl.cc
@@ -687,73 +687,6 @@
   picture.type = kVideoUnknown;
   return 0;
 }
-int ViEFileImpl::SetCaptureDeviceImage(const int capture_id,
-                                       const char* file_nameUTF8) {
-  WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
-               "%s(capture_id: %d)", __FUNCTION__, capture_id);
-
-  ViEInputManagerScoped is(*(shared_data_->input_manager()));
-  ViECapturer* capturer = is.Capture(capture_id);
-  if (!capturer) {
-    shared_data_->SetLastError(kViEFileInvalidCaptureId);
-    return -1;
-  }
-
-  VideoFrame capture_image;
-  if (ViEFileImage::ConvertJPEGToVideoFrame(
-          ViEId(shared_data_->instance_id(), capture_id), file_nameUTF8,
-          &capture_image) != 0) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo,
-                 ViEId(shared_data_->instance_id(), capture_id),
-                 "%s(capture_id: %d) Failed to open file.", __FUNCTION__,
-                 capture_id);
-    shared_data_->SetLastError(kViEFileInvalidFile);
-    return -1;
-  }
-  if (capturer->SetCaptureDeviceImage(capture_image)) {
-    shared_data_->SetLastError(kViEFileSetCaptureImageError);
-    return -1;
-  }
-  return 0;
-}
-
-int ViEFileImpl::SetCaptureDeviceImage(const int capture_id,
-                                       const ViEPicture& picture) {
-  WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
-               "%s(capture_id: %d)", __FUNCTION__, capture_id);
-
-  if (picture.type != kVideoI420) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo,
-                 ViEId(shared_data_->instance_id(), capture_id),
-                 "%s(capture_id: %d) Not a valid picture type.",
-                 __FUNCTION__, capture_id);
-    shared_data_->SetLastError(kViEFileInvalidArgument);
-    return -1;
-  }
-  ViEInputManagerScoped is(*(shared_data_->input_manager()));
-  ViECapturer* capturer = is.Capture(capture_id);
-  if (!capturer) {
-    shared_data_->SetLastError(kViEFileSetCaptureImageError);
-    return -1;
-  }
-
-  VideoFrame capture_image;
-  if (ViEFileImage::ConvertPictureToVideoFrame(
-      ViEId(shared_data_->instance_id(), capture_id), picture,
-          &capture_image) != 0) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo,
-                 ViEId(shared_data_->instance_id(), capture_id),
-                 "%s(capture_id: %d) Failed to use picture.", __FUNCTION__,
-                 capture_id);
-    shared_data_->SetLastError(kViEFileInvalidFile);
-    return -1;
-  }
-  if (capturer->SetCaptureDeviceImage(capture_image)) {
-    shared_data_->SetLastError(kViEFileInvalidCapture);
-    return -1;
-  }
-  return 0;
-}
 
 int ViEFileImpl::SetRenderStartImage(const int video_channel,
                                      const char* file_nameUTF8) {
diff --git a/src/video_engine/vie_file_impl.h b/src/video_engine/vie_file_impl.h
index b90c92b..d19cc4d 100644
--- a/src/video_engine/vie_file_impl.h
+++ b/src/video_engine/vie_file_impl.h
@@ -106,10 +106,6 @@
                                        const char* file_nameUTF8);
   virtual int GetCaptureDeviceSnapshot(const int capture_id,
                                        ViEPicture& picture);
-  virtual int SetCaptureDeviceImage(const int capture_id,
-                                    const char* file_nameUTF8);
-  virtual int SetCaptureDeviceImage(const int capture_id,
-                                    const ViEPicture& picture);
   virtual int SetRenderStartImage(const int video_channel,
                                   const char* file_nameUTF8);
   virtual int SetRenderStartImage(const int video_channel,