Delete interface class VideoCaptureExternal

Also delete corresponding and unused create method
VideoCaptureFactory::Create(VideoCaptureExternal...),
the code under modules/video_capture/external, and the
build target modules/video_capture:video_capture.

Bug: None
Change-Id: I5ec6139e9ecf460f93ede847868f7f80dbc019f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131385
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27506}
This commit is contained in:
Niels Möller
2019-04-09 08:24:58 +02:00
committed by Commit Bot
parent f73f7d684c
commit 8581877121
17 changed files with 10 additions and 238 deletions

View File

@ -555,7 +555,6 @@ if (rtc_include_tests) {
# TODO(eladalon): call_tests aren't actually video-specific, so we
# should move them to a more appropriate test suite.
"call:call_tests",
"modules/video_capture",
"test:test_common",
"test:test_main",
"test:video_test_common",

View File

@ -95,7 +95,6 @@ if (rtc_include_tests) {
"../api/video:video_frame_i010",
"../api/video:video_frame_i420",
"../media:rtc_h264_profile_id",
"../modules/video_capture",
"../rtc_base",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",

View File

@ -299,9 +299,7 @@ rtc_static_library("rtc_audio_video") {
include_dirs = []
public_configs = []
if (build_with_chromium) {
deps += [ "../modules/video_capture" ]
} else {
if (!build_with_chromium) {
public_configs += [ ":rtc_media_defines_config" ]
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}

View File

@ -261,10 +261,6 @@ if (rtc_include_tests) {
deps += [ "desktop_capture:desktop_capture_unittests" ]
}
if (!build_with_mozilla) {
deps += [ "video_capture" ]
}
data = modules_unittests_resources
if (is_android) {

View File

@ -42,21 +42,6 @@ rtc_static_library("video_capture_module") {
]
}
rtc_static_library("video_capture") {
visibility = [ "*" ]
sources = [
"external/device_info_external.cc",
"external/video_capture_external.cc",
]
deps = [
":video_capture_module",
"../../api:scoped_refptr",
"../../rtc_base:rtc_base_approved",
"../../system_wrappers",
]
}
if (!build_with_chromium) {
rtc_source_set("video_capture_internal_impl") {
deps = [

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include <stdint.h>
#include "modules/video_capture/device_info_impl.h"
#include "modules/video_capture/video_capture.h"
#include "modules/video_capture/video_capture_impl.h"
namespace webrtc {
namespace videocapturemodule {
class ExternalDeviceInfo : public DeviceInfoImpl {
public:
ExternalDeviceInfo() {}
~ExternalDeviceInfo() override {}
uint32_t NumberOfDevices() override { return 0; }
int32_t DisplayCaptureSettingsDialogBox(const char* /*deviceUniqueIdUTF8*/,
const char* /*dialogTitleUTF8*/,
void* /*parentWindow*/,
uint32_t /*positionX*/,
uint32_t /*positionY*/) override {
return -1;
}
int32_t GetDeviceName(uint32_t deviceNumber,
char* deviceNameUTF8,
uint32_t deviceNameLength,
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8 = 0,
uint32_t productUniqueIdUTF8Length = 0) override {
return -1;
}
int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) override {
return 0;
}
int32_t Init() override { return 0; }
};
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
return new ExternalDeviceInfo();
}
} // namespace videocapturemodule
} // namespace webrtc

View File

@ -1,27 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include "api/scoped_refptr.h"
#include "modules/video_capture/video_capture.h"
#include "modules/video_capture/video_capture_impl.h"
#include "rtc_base/ref_counted_object.h"
namespace webrtc {
namespace videocapturemodule {
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
const char* deviceUniqueIdUTF8) {
return new rtc::RefCountedObject<VideoCaptureImpl>();
}
} // namespace videocapturemodule
} // namespace webrtc

View File

@ -52,9 +52,11 @@ using webrtc::VideoCaptureModule;
} while (0)
static const int kTimeOut = 5000;
#ifdef WEBRTC_MAC
static const int kTestHeight = 288;
static const int kTestWidth = 352;
static const int kTestFramerate = 30;
#endif
class TestVideoCaptureCallback
: public rtc::VideoSinkInterface<webrtc::VideoFrame> {
@ -344,83 +346,3 @@ TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) {
EXPECT_EQ(0, module2->StopCapture());
EXPECT_EQ(0, module1->StopCapture());
}
// Test class for testing external capture and capture feedback information
// such as frame rate and picture alarm.
class VideoCaptureExternalTest : public testing::Test {
public:
void SetUp() override {
capture_module_ = VideoCaptureFactory::Create(capture_input_interface_);
VideoCaptureCapability capability;
capability.width = kTestWidth;
capability.height = kTestHeight;
capability.videoType = webrtc::VideoType::kYV12;
capability.maxFPS = kTestFramerate;
capture_callback_.SetExpectedCapability(capability);
rtc::scoped_refptr<webrtc::I420Buffer> buffer =
webrtc::I420Buffer::Create(kTestWidth, kTestHeight);
memset(buffer->MutableDataY(), 127, buffer->height() * buffer->StrideY());
memset(buffer->MutableDataU(), 127,
buffer->ChromaHeight() * buffer->StrideU());
memset(buffer->MutableDataV(), 127,
buffer->ChromaHeight() * buffer->StrideV());
test_frame_ = absl::make_unique<webrtc::VideoFrame>(
webrtc::VideoFrame::Builder()
.set_video_frame_buffer(buffer)
.set_rotation(webrtc::kVideoRotation_0)
.set_timestamp_us(0)
.build());
SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp.
capture_module_->RegisterCaptureDataCallback(&capture_callback_);
}
void TearDown() override {}
webrtc::VideoCaptureExternal* capture_input_interface_;
rtc::scoped_refptr<VideoCaptureModule> capture_module_;
std::unique_ptr<webrtc::VideoFrame> test_frame_;
TestVideoCaptureCallback capture_callback_;
};
// Test input of external video frames.
TEST_F(VideoCaptureExternalTest, TestExternalCapture) {
size_t length = webrtc::CalcBufferSize(
webrtc::VideoType::kI420, test_frame_->width(), test_frame_->height());
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
EXPECT_EQ(0,
capture_input_interface_->IncomingFrame(
test_buffer.get(), length, capture_callback_.capability(), 0));
EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_));
}
TEST_F(VideoCaptureExternalTest, Rotation) {
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0));
size_t length = webrtc::CalcBufferSize(
webrtc::VideoType::kI420, test_frame_->width(), test_frame_->height());
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
EXPECT_EQ(0,
capture_input_interface_->IncomingFrame(
test_buffer.get(), length, capture_callback_.capability(), 0));
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_90));
capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_90);
EXPECT_EQ(0,
capture_input_interface_->IncomingFrame(
test_buffer.get(), length, capture_callback_.capability(), 0));
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180));
capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180);
EXPECT_EQ(0,
capture_input_interface_->IncomingFrame(
test_buffer.get(), length, capture_callback_.capability(), 0));
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270));
capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270);
EXPECT_EQ(0,
capture_input_interface_->IncomingFrame(
test_buffer.get(), length, capture_callback_.capability(), 0));
}

View File

@ -55,21 +55,6 @@ struct VideoCaptureCapability {
}
};
/* External Capture interface. Returned by Create
and implemented by the capture module.
*/
class VideoCaptureExternal {
public:
// |capture_time| must be specified in the NTP time format in milliseconds.
virtual int32_t IncomingFrame(uint8_t* videoFrame,
size_t videoFrameLength,
const VideoCaptureCapability& frameInfo,
int64_t captureTime = 0) = 0;
protected:
~VideoCaptureExternal() {}
};
} // namespace webrtc
#endif // MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_

View File

@ -23,11 +23,6 @@ rtc::scoped_refptr<VideoCaptureModule> VideoCaptureFactory::Create(
#endif
}
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureFactory::Create(
VideoCaptureExternal*& externalCapture) {
return videocapturemodule::VideoCaptureImpl::Create(externalCapture);
}
VideoCaptureModule::DeviceInfo* VideoCaptureFactory::CreateDeviceInfo() {
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
return nullptr;

View File

@ -29,12 +29,6 @@ class VideoCaptureFactory {
static rtc::scoped_refptr<VideoCaptureModule> Create(
const char* deviceUniqueIdUTF8);
// Create a video capture module object used for external capture.
// id - unique identifier of this video capture module object
// externalCapture - [out] interface to call when a new frame is captured.
static rtc::scoped_refptr<VideoCaptureModule> Create(
VideoCaptureExternal*& externalCapture);
static VideoCaptureModule::DeviceInfo* CreateDeviceInfo();
private:

View File

@ -24,13 +24,6 @@
namespace webrtc {
namespace videocapturemodule {
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
VideoCaptureExternal*& externalCapture) {
rtc::scoped_refptr<VideoCaptureImpl> implementation(
new rtc::RefCountedObject<VideoCaptureImpl>());
externalCapture = implementation.get();
return implementation;
}
const char* VideoCaptureImpl::CurrentDeviceName() const {
return _deviceUniqueId;

View File

@ -31,8 +31,7 @@ namespace webrtc {
namespace videocapturemodule {
// Class definitions
class VideoCaptureImpl : public VideoCaptureModule,
public VideoCaptureExternal {
class VideoCaptureImpl : public VideoCaptureModule {
public:
/*
* Create a video capture module object
@ -44,15 +43,6 @@ class VideoCaptureImpl : public VideoCaptureModule,
static rtc::scoped_refptr<VideoCaptureModule> Create(
const char* deviceUniqueIdUTF8);
/*
* Create a video capture module object used for external capture.
*
* id - unique identifier of this video capture module object
* externalCapture - [out] interface to call when a new frame is captured.
*/
static rtc::scoped_refptr<VideoCaptureModule> Create(
VideoCaptureExternal*& externalCapture);
static DeviceInfo* CreateDeviceInfo();
// Helpers for converting between (integral) degrees and
@ -71,12 +61,11 @@ class VideoCaptureImpl : public VideoCaptureModule,
const char* CurrentDeviceName() const override;
// Implement VideoCaptureExternal
// |capture_time| must be specified in NTP time format in milliseconds.
int32_t IncomingFrame(uint8_t* videoFrame,
size_t videoFrameLength,
const VideoCaptureCapability& frameInfo,
int64_t captureTime = 0) override;
int64_t captureTime = 0);
// Platform dependent
int32_t StartCapture(const VideoCaptureCapability& capability) override;
@ -87,7 +76,6 @@ class VideoCaptureImpl : public VideoCaptureModule,
protected:
VideoCaptureImpl();
~VideoCaptureImpl() override;
int32_t DeliverCapturedFrame(VideoFrame& captureFrame);
char* _deviceUniqueId; // current Device unique name;
rtc::CriticalSection _apiCs;
@ -97,6 +85,7 @@ class VideoCaptureImpl : public VideoCaptureModule,
private:
void UpdateFrameCount();
uint32_t CalculateFrameRate(int64_t now_ns);
int32_t DeliverCapturedFrame(VideoFrame& captureFrame);
// last time the module process function was called.
int64_t _lastProcessTimeNanos;

View File

@ -784,7 +784,7 @@ STDMETHODIMP CaptureInputPin::ReceiveCanBlock() {
// ----------------------------------------------------------------------------
CaptureSinkFilter::CaptureSinkFilter(VideoCaptureExternal* capture_observer)
CaptureSinkFilter::CaptureSinkFilter(VideoCaptureImpl* capture_observer)
: input_pin_(new ComRefCount<CaptureInputPin>(this)),
capture_observer_(capture_observer) {}

View File

@ -17,7 +17,7 @@
#include <memory>
#include <vector>
#include "modules/video_capture/video_capture_defines.h"
#include "modules/video_capture/video_capture_impl.h"
#include "modules/video_capture/windows/help_functions_ds.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_checker.h"
@ -110,7 +110,7 @@ class CaptureInputPin : public IMemInputPin, public IPin {
// Implement IBaseFilter (including IPersist and IMediaFilter).
class CaptureSinkFilter : public IBaseFilter {
public:
CaptureSinkFilter(VideoCaptureExternal* capture_observer);
CaptureSinkFilter(VideoCaptureImpl* capture_observer);
HRESULT SetRequestedCapability(const VideoCaptureCapability& capability);
@ -149,7 +149,7 @@ class CaptureSinkFilter : public IBaseFilter {
private:
rtc::ThreadChecker main_checker_;
const rtc::scoped_refptr<ComRefCount<CaptureInputPin>> input_pin_;
VideoCaptureExternal* const capture_observer_;
VideoCaptureImpl* const capture_observer_;
FILTER_INFO info_ RTC_GUARDED_BY(main_checker_) = {};
// Set/cleared in JoinFilterGraph. The filter must be stopped (no capture)
// at that time, so no lock is required. While the state is not stopped,

View File

@ -379,7 +379,6 @@ if (rtc_include_tests) {
"../api/video:video_frame_i420",
"../call:video_stream_api",
"../modules/rtp_rtcp",
"../modules/video_capture",
"../modules/video_coding:simulcast_test_fixture_impl",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:file_wrapper",

View File

@ -13,7 +13,6 @@ include_rules = [
"+modules/rtp_rtcp",
"+modules/utility",
"+modules/video_coding",
"+modules/video_capture",
"+modules/video_processing",
"+system_wrappers",
]