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
This commit is contained in:
mikhal@webrtc.org 2012-10-19 16:44:35 +00:00
parent 4ee29c65d9
commit 9a5b904cbe
11 changed files with 2 additions and 208 deletions

View File

@ -122,12 +122,6 @@ class VideoCaptureModule: public RefCountedModule {
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;

View File

@ -49,22 +49,11 @@ WebRtc_Word32 VideoCaptureImpl::ChangeUniqueId(const WebRtc_Word32 id)
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 @@ WebRtc_Word32 VideoCaptureImpl::Process()
_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 @@ VideoCaptureImpl::VideoCaptureImpl(const WebRtc_Word32 id)
_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::CaptureDelay()
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 @@ WebRtc_Word32 VideoCaptureImpl::DeliverEncodedCapturedFrame(
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 @@ WebRtc_Word32 VideoCaptureImpl::SetCaptureRotation(VideoCaptureRotation rotation
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);

View File

@ -59,10 +59,6 @@ public:
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 @@ private:
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.

View File

@ -557,19 +557,3 @@ TEST_F(VideoCaptureExternalTest , FrameRate) {
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_));
}

View File

@ -74,8 +74,6 @@ enum ViEErrors {
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.

View File

@ -175,18 +175,6 @@ class WEBRTC_DLLEXPORT ViEFile {
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

View File

@ -332,37 +332,6 @@ void ViEAutoTest::ViEFileStandardTest()
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)
{

View File

@ -898,9 +898,4 @@ void ViECapturer::OnNoPictureAlarm(const WebRtc_Word32 id,
observer_->NoPictureAlarm(id, vie_alarm);
}
WebRtc_Word32 ViECapturer::SetCaptureDeviceImage(
const VideoFrame& capture_device_image) {
return capture_module_->StartSendImage(capture_device_image, 10);
}
} // namespace webrtc

View File

@ -105,9 +105,6 @@ class ViECapturer
// Information.
const char* CurrentDeviceName() const;
// Set device image.
WebRtc_Word32 SetCaptureDeviceImage(const VideoFrame& capture_device_image);
protected:
ViECapturer(int capture_id,
int engine_id,

View File

@ -687,73 +687,6 @@ int ViEFileImpl::FreePicture(ViEPicture& picture) { // NOLINT
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) {

View File

@ -106,10 +106,6 @@ class ViEFileImpl
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,