From 642943baead06cf639400470fb537987aec11f9d Mon Sep 17 00:00:00 2001 From: nisse Date: Fri, 17 Feb 2017 06:22:07 -0800 Subject: [PATCH] Delete DeviceInfoImpl::GetExpectedCaptureDelay and related declarations. This feature is unused. We can then also delete the header file video_capture_delay.h. BUG=None Review-Url: https://codereview.webrtc.org/2665113006 Cr-Commit-Position: refs/heads/master@{#16666} --- webrtc/media/engine/webrtcvideocapturer.cc | 1 - webrtc/modules/video_capture/BUILD.gn | 1 - .../modules/video_capture/device_info_impl.cc | 76 ------------------- .../modules/video_capture/device_info_impl.h | 7 -- .../video_capture/linux/device_info_linux.cc | 1 - .../linux/video_capture_linux.cc | 1 - .../video_capture/objc/device_info_objc.mm | 6 -- .../video_capture/video_capture_defines.h | 2 - .../video_capture/video_capture_delay.h | 36 --------- .../video_capture/video_capture_impl.cc | 1 - .../video_capture/video_capture_impl.h | 1 - .../video_capture/windows/device_info_ds.cc | 26 ------- .../video_capture/windows/video_capture_ds.cc | 2 - 13 files changed, 161 deletions(-) delete mode 100644 webrtc/modules/video_capture/video_capture_delay.h diff --git a/webrtc/media/engine/webrtcvideocapturer.cc b/webrtc/media/engine/webrtcvideocapturer.cc index 044cfcb6d0..d8419d2bd5 100644 --- a/webrtc/media/engine/webrtcvideocapturer.cc +++ b/webrtc/media/engine/webrtcvideocapturer.cc @@ -94,7 +94,6 @@ static bool FormatToCapability(const VideoFormat& format, cap->width = format.width; cap->height = format.height; cap->maxFPS = VideoFormat::IntervalToFps(format.interval); - cap->expectedCaptureDelay = 0; cap->rawType = webrtc_type; cap->codecType = webrtc::kVideoCodecUnknown; cap->interlaced = false; diff --git a/webrtc/modules/video_capture/BUILD.gn b/webrtc/modules/video_capture/BUILD.gn index a03bb3c6dd..b7482a2555 100644 --- a/webrtc/modules/video_capture/BUILD.gn +++ b/webrtc/modules/video_capture/BUILD.gn @@ -19,7 +19,6 @@ rtc_static_library("video_capture_module") { "video_capture.h", "video_capture_config.h", "video_capture_defines.h", - "video_capture_delay.h", "video_capture_factory.cc", "video_capture_factory.h", "video_capture_impl.cc", diff --git a/webrtc/modules/video_capture/device_info_impl.cc b/webrtc/modules/video_capture/device_info_impl.cc index f3eefc8b06..e2caeaa58f 100644 --- a/webrtc/modules/video_capture/device_info_impl.cc +++ b/webrtc/modules/video_capture/device_info_impl.cc @@ -273,82 +273,6 @@ int32_t DeviceInfoImpl::GetBestMatchedCapability( return bestformatIndex; } -/* Returns the expected Capture delay*/ -int32_t DeviceInfoImpl::GetExpectedCaptureDelay( - const DelayValues delayValues[], - const uint32_t sizeOfDelayValues, - const char* productId, - const uint32_t width, - const uint32_t height) -{ - int32_t bestDelay = kDefaultCaptureDelay; - - for (uint32_t device = 0; device < sizeOfDelayValues; ++device) - { - if (delayValues[device].productId && strncmp((char*) productId, - (char*) delayValues[device].productId, - kVideoCaptureProductIdLength) == 0) - { - // We have found the camera - - int32_t bestWidth = 0; - int32_t bestHeight = 0; - - //Loop through all tested sizes and find one that seems fitting - for (uint32_t delayIndex = 0; delayIndex < NoOfDelayValues; ++delayIndex) - { - const DelayValue& currentValue = delayValues[device].delayValues[delayIndex]; - - const int32_t diffWidth = currentValue.width - width; - const int32_t diffHeight = currentValue.height - height; - - const int32_t currentbestDiffWith = bestWidth - width; - const int32_t currentbestDiffHeight = bestHeight - height; - - if ((diffHeight >= 0 && diffHeight <= abs(currentbestDiffHeight)) // Height better or equal than previous. - || (currentbestDiffHeight < 0 && diffHeight >= currentbestDiffHeight)) - { - - if (diffHeight == currentbestDiffHeight) // Found best height. Care about the width) - { - if ((diffWidth >= 0 && diffWidth <= abs(currentbestDiffWith)) // Width better or equal - || (currentbestDiffWith < 0 && diffWidth >= currentbestDiffWith)) - { - if (diffWidth == currentbestDiffWith && diffHeight - == currentbestDiffHeight) // Same size as previous - { - } - else // Better width than previously - { - bestWidth = currentValue.width; - bestHeight = currentValue.height; - bestDelay = currentValue.delay; - } - }// else width no good - } - else // Better height - { - bestWidth = currentValue.width; - bestHeight = currentValue.height; - bestDelay = currentValue.delay; - } - }// else height not good - }//end for - break; - } - } - if (bestDelay > kMaxCaptureDelay) - { - LOG(LS_WARNING) << "Expected capture delay (" << bestDelay - << " ms) too high, using " << kMaxCaptureDelay - << " ms."; - bestDelay = kMaxCaptureDelay; - } - - return bestDelay; - -} - //Default implementation. This should be overridden by Mobile implementations. int32_t DeviceInfoImpl::GetOrientation(const char* deviceUniqueIdUTF8, VideoRotation& orientation) { diff --git a/webrtc/modules/video_capture/device_info_impl.h b/webrtc/modules/video_capture/device_info_impl.h index 247a7f4bf0..463e10d07e 100644 --- a/webrtc/modules/video_capture/device_info_impl.h +++ b/webrtc/modules/video_capture/device_info_impl.h @@ -14,7 +14,6 @@ #include #include "webrtc/modules/video_capture/video_capture.h" -#include "webrtc/modules/video_capture/video_capture_delay.h" #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" namespace webrtc @@ -48,12 +47,6 @@ protected: */ virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0; - /* Returns the expected Capture delay*/ - int32_t GetExpectedCaptureDelay(const DelayValues delayValues[], - const uint32_t sizeOfDelayValues, - const char* productId, - const uint32_t width, - const uint32_t height); protected: // Data members typedef std::vector VideoCaptureCapabilities; diff --git a/webrtc/modules/video_capture/linux/device_info_linux.cc b/webrtc/modules/video_capture/linux/device_info_linux.cc index adaef580d7..437d04ac13 100644 --- a/webrtc/modules/video_capture/linux/device_info_linux.cc +++ b/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -285,7 +285,6 @@ int32_t DeviceInfoLinux::FillCapabilities(int fd) VideoCaptureCapability cap; cap.width = video_fmt.fmt.pix.width; cap.height = video_fmt.fmt.pix.height; - cap.expectedCaptureDelay = 120; if (videoFormats[fmts] == V4L2_PIX_FMT_YUYV) { cap.rawType = kVideoYUY2; diff --git a/webrtc/modules/video_capture/linux/video_capture_linux.cc b/webrtc/modules/video_capture/linux/video_capture_linux.cc index e8da74bb2f..d09c42a24f 100644 --- a/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ b/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -227,7 +227,6 @@ int32_t VideoCaptureModuleV4L2::StartCapture( // initialize current width and height _currentWidth = video_fmt.fmt.pix.width; _currentHeight = video_fmt.fmt.pix.height; - _captureDelay = 120; // Trying to set frame rate, before check driver capability. bool driver_framerate_support = true; diff --git a/webrtc/modules/video_capture/objc/device_info_objc.mm b/webrtc/modules/video_capture/objc/device_info_objc.mm index d46fa5c346..5639380163 100644 --- a/webrtc/modules/video_capture/objc/device_info_objc.mm +++ b/webrtc/modules/video_capture/objc/device_info_objc.mm @@ -60,8 +60,6 @@ capability.width = 352; capability.height = 288; capability.maxFPS = 30; - capability.expectedCaptureDelay = - webrtc::videocapturemodule::kDefaultCaptureDelay; capability.rawType = webrtc::kVideoNV12; capability.codecType = webrtc::kVideoCodecUnknown; capability.interlaced = false; @@ -69,8 +67,6 @@ capability.width = 640; capability.height = 480; capability.maxFPS = 30; - capability.expectedCaptureDelay = - webrtc::videocapturemodule::kDefaultCaptureDelay; capability.rawType = webrtc::kVideoNV12; capability.codecType = webrtc::kVideoCodecUnknown; capability.interlaced = false; @@ -78,8 +74,6 @@ capability.width = 1280; capability.height = 720; capability.maxFPS = 30; - capability.expectedCaptureDelay = - webrtc::videocapturemodule::kDefaultCaptureDelay; capability.rawType = webrtc::kVideoNV12; capability.codecType = webrtc::kVideoCodecUnknown; capability.interlaced = false; diff --git a/webrtc/modules/video_capture/video_capture_defines.h b/webrtc/modules/video_capture/video_capture_defines.h index 261ee67750..b7ab61a07a 100644 --- a/webrtc/modules/video_capture/video_capture_defines.h +++ b/webrtc/modules/video_capture/video_capture_defines.h @@ -31,7 +31,6 @@ struct VideoCaptureCapability int32_t width; int32_t height; int32_t maxFPS; - int32_t expectedCaptureDelay; RawVideoType rawType; VideoCodecType codecType; bool interlaced; @@ -41,7 +40,6 @@ struct VideoCaptureCapability width = 0; height = 0; maxFPS = 0; - expectedCaptureDelay = 0; rawType = kVideoUnknown; codecType = kVideoCodecUnknown; interlaced = false; diff --git a/webrtc/modules/video_capture/video_capture_delay.h b/webrtc/modules/video_capture/video_capture_delay.h deleted file mode 100644 index f8924e25ad..0000000000 --- a/webrtc/modules/video_capture/video_capture_delay.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_DELAY_H_ -#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_DELAY_H_ - -namespace webrtc -{ -namespace videocapturemodule -{ - -struct DelayValue -{ - int32_t width; - int32_t height; - int32_t delay; -}; - -enum { NoOfDelayValues = 40 }; -struct DelayValues -{ - char * deviceName; - char* productId; - DelayValue delayValues[NoOfDelayValues]; -}; - -} // namespace videocapturemodule -} // namespace webrtc -#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_DELAY_H_ diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc index fe0906e639..6b50205c32 100644 --- a/webrtc/modules/video_capture/video_capture_impl.cc +++ b/webrtc/modules/video_capture/video_capture_impl.cc @@ -82,7 +82,6 @@ int32_t VideoCaptureImpl::RotationInDegrees(VideoRotation rotation, VideoCaptureImpl::VideoCaptureImpl() : _deviceUniqueId(NULL), _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), - _captureDelay(0), _requestedCapability(), _lastProcessTimeNanos(rtc::TimeNanos()), _lastFrameRateCallbackTimeNanos(rtc::TimeNanos()), diff --git a/webrtc/modules/video_capture/video_capture_impl.h b/webrtc/modules/video_capture/video_capture_impl.h index 6083726a67..559e14eb02 100644 --- a/webrtc/modules/video_capture/video_capture_impl.h +++ b/webrtc/modules/video_capture/video_capture_impl.h @@ -94,7 +94,6 @@ protected: char* _deviceUniqueId; // current Device unique name; CriticalSectionWrapper& _apiCs; - int32_t _captureDelay; // Current capture delay. May be changed of platform dependent parts. VideoCaptureCapability _requestedCapability; // Should be set by platform dependent code in StartCapture. private: void UpdateFrameCount(); diff --git a/webrtc/modules/video_capture/windows/device_info_ds.cc b/webrtc/modules/video_capture/windows/device_info_ds.cc index 0b704abe95..fb2094c3f4 100644 --- a/webrtc/modules/video_capture/windows/device_info_ds.cc +++ b/webrtc/modules/video_capture/windows/device_info_ds.cc @@ -11,7 +11,6 @@ #include "webrtc/modules/video_capture/windows/device_info_ds.h" #include "webrtc/modules/video_capture/video_capture_config.h" -#include "webrtc/modules/video_capture/video_capture_delay.h" #include "webrtc/modules/video_capture/windows/help_functions_ds.h" #include "webrtc/system_wrappers/include/trace.h" @@ -22,24 +21,6 @@ namespace webrtc { namespace videocapturemodule { -const int32_t NoWindowsCaptureDelays = 1; -const DelayValues WindowsCaptureDelays[NoWindowsCaptureDelays] = { - "Microsoft LifeCam Cinema", - "usb#vid_045e&pid_075d", - { - {640,480,125}, - {640,360,117}, - {424,240,111}, - {352,288,111}, - {320,240,116}, - {176,144,101}, - {160,120,109}, - {1280,720,166}, - {960,544,126}, - {800,448,120}, - {800,600,127} - }, -}; // static DeviceInfoDS* DeviceInfoDS::Create() @@ -658,13 +639,6 @@ int32_t DeviceInfoDS::CreateCapabilityMap( continue; } - // Get the expected capture delay from the static list - capability.expectedCaptureDelay - = GetExpectedCaptureDelay(WindowsCaptureDelays, - NoWindowsCaptureDelays, - productId, - capability.width, - capability.height); _captureCapabilities.push_back(capability); _captureCapabilitiesWindows.push_back(capability); WEBRTC_TRACE( webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, diff --git a/webrtc/modules/video_capture/windows/video_capture_ds.cc b/webrtc/modules/video_capture/windows/video_capture_ds.cc index a75ef5bc49..a98b1b8527 100644 --- a/webrtc/modules/video_capture/windows/video_capture_ds.cc +++ b/webrtc/modules/video_capture/windows/video_capture_ds.cc @@ -233,8 +233,6 @@ int32_t VideoCaptureDS::SetCameraOutput( { capability.maxFPS = 30; } - // Store the new expected capture delay - _captureDelay = capability.expectedCaptureDelay; // Convert it to the windows capability index since they are not nexessary // the same