Replace VideoCaptureDataCallback by VideoSinkInterface.
This also deletes unused features of the video_capturer interface, the classes VideoCaptureFeedBack, VideoCaptureEncodeInterface and related methods, and the module id which used to be passed as an argument to the VideoCaptureDataCallback. In theory the module id could have been used to let a single VideoCaptureDataCallback serve several capturers, and demultiplex on the id, but in practice, it was unused. With this change, it is required to use a separate VideoSinkInterface for each capturer. BUG=webrtc:6789 Review-Url: https://codereview.webrtc.org/2534553002 Cr-Commit-Position: refs/heads/master@{#15540}
This commit is contained in:
parent
99f7bfde28
commit
b29b9c8e49
@ -370,7 +370,7 @@ cricket::VideoCapturer* Conductor::OpenVideoCaptureDevice() {
|
||||
std::vector<std::string> device_names;
|
||||
{
|
||||
std::unique_ptr<webrtc::VideoCaptureModule::DeviceInfo> info(
|
||||
webrtc::VideoCaptureFactory::CreateDeviceInfo(0));
|
||||
webrtc::VideoCaptureFactory::CreateDeviceInfo());
|
||||
if (!info) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -22,16 +22,14 @@
|
||||
class FakeWebRtcVcmFactory : public cricket::WebRtcVcmFactoryInterface {
|
||||
public:
|
||||
virtual rtc::scoped_refptr<webrtc::VideoCaptureModule> Create(
|
||||
int module_id,
|
||||
const char* device_id) {
|
||||
if (!device_info.GetDeviceById(device_id)) return NULL;
|
||||
rtc::scoped_refptr<FakeWebRtcVideoCaptureModule> module(
|
||||
new rtc::RefCountedObject<FakeWebRtcVideoCaptureModule>(this,
|
||||
module_id));
|
||||
new rtc::RefCountedObject<FakeWebRtcVideoCaptureModule>(this));
|
||||
modules.push_back(module);
|
||||
return module;
|
||||
}
|
||||
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo(int id) {
|
||||
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo() {
|
||||
return &device_info;
|
||||
}
|
||||
virtual void DestroyDeviceInfo(webrtc::VideoCaptureModule::DeviceInfo* info) {
|
||||
|
||||
@ -21,36 +21,17 @@ class FakeWebRtcVcmFactory;
|
||||
// Fake class for mocking out webrtc::VideoCaptureModule.
|
||||
class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule {
|
||||
public:
|
||||
FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory, int32_t id)
|
||||
FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory)
|
||||
: factory_(factory),
|
||||
id_(id),
|
||||
callback_(NULL),
|
||||
running_(false),
|
||||
delay_(0) {
|
||||
running_(false) {
|
||||
}
|
||||
~FakeWebRtcVideoCaptureModule();
|
||||
int64_t TimeUntilNextProcess() override { return 0; }
|
||||
void Process() override {}
|
||||
void RegisterCaptureDataCallback(
|
||||
webrtc::VideoCaptureDataCallback& callback) override {
|
||||
callback_ = &callback;
|
||||
rtc::VideoSinkInterface<webrtc::VideoFrame>* callback) override {
|
||||
callback_ = callback;
|
||||
}
|
||||
void DeRegisterCaptureDataCallback() override { callback_ = NULL; }
|
||||
void RegisterCaptureCallback(
|
||||
webrtc::VideoCaptureFeedBack& callback) override {
|
||||
// Not implemented.
|
||||
}
|
||||
void DeRegisterCaptureCallback() override {
|
||||
// Not implemented.
|
||||
}
|
||||
void SetCaptureDelay(int32_t delay) override { delay_ = delay; }
|
||||
int32_t CaptureDelay() override { return delay_; }
|
||||
void EnableFrameRateCallback(const bool enable) override {
|
||||
// not implemented
|
||||
}
|
||||
void EnableNoPictureAlarm(const bool enable) override {
|
||||
// not implemented
|
||||
}
|
||||
int32_t StartCapture(const webrtc::VideoCaptureCapability& cap) override {
|
||||
if (running_) return -1;
|
||||
cap_ = cap;
|
||||
@ -80,11 +61,6 @@ class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule {
|
||||
bool GetApplyRotation() override {
|
||||
return true; // Rotation compensation is turned on.
|
||||
}
|
||||
VideoCaptureEncodeInterface* GetEncodeInterface(
|
||||
const webrtc::VideoCodec& codec) override {
|
||||
return NULL; // not implemented
|
||||
}
|
||||
|
||||
void SendFrame(int w, int h) {
|
||||
if (!running_) return;
|
||||
|
||||
@ -94,8 +70,7 @@ class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule {
|
||||
// https://bugs.chromium.org/p/libyuv/issues/detail?id=377
|
||||
buffer->InitializeData();
|
||||
if (callback_) {
|
||||
callback_->OnIncomingCapturedFrame(
|
||||
id_,
|
||||
callback_->OnFrame(
|
||||
webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0));
|
||||
}
|
||||
}
|
||||
@ -106,11 +81,9 @@ class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule {
|
||||
|
||||
private:
|
||||
FakeWebRtcVcmFactory* factory_;
|
||||
int id_;
|
||||
webrtc::VideoCaptureDataCallback* callback_;
|
||||
rtc::VideoSinkInterface<webrtc::VideoFrame>* callback_;
|
||||
bool running_;
|
||||
webrtc::VideoCaptureCapability cap_;
|
||||
int delay_;
|
||||
};
|
||||
|
||||
#endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_
|
||||
|
||||
@ -47,12 +47,11 @@ static kVideoFourCCEntry kSupportedFourCCs[] = {
|
||||
class WebRtcVcmFactory : public WebRtcVcmFactoryInterface {
|
||||
public:
|
||||
virtual rtc::scoped_refptr<webrtc::VideoCaptureModule> Create(
|
||||
int id,
|
||||
const char* device) {
|
||||
return webrtc::VideoCaptureFactory::Create(id, device);
|
||||
return webrtc::VideoCaptureFactory::Create(device);
|
||||
}
|
||||
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo(int id) {
|
||||
return webrtc::VideoCaptureFactory::CreateDeviceInfo(id);
|
||||
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo() {
|
||||
return webrtc::VideoCaptureFactory::CreateDeviceInfo();
|
||||
}
|
||||
virtual void DestroyDeviceInfo(webrtc::VideoCaptureModule::DeviceInfo* info) {
|
||||
delete info;
|
||||
@ -129,7 +128,7 @@ bool WebRtcVideoCapturer::Init(const Device& device) {
|
||||
return false;
|
||||
}
|
||||
|
||||
webrtc::VideoCaptureModule::DeviceInfo* info = factory_->CreateDeviceInfo(0);
|
||||
webrtc::VideoCaptureModule::DeviceInfo* info = factory_->CreateDeviceInfo();
|
||||
if (!info) {
|
||||
return false;
|
||||
}
|
||||
@ -179,7 +178,7 @@ bool WebRtcVideoCapturer::Init(const Device& device) {
|
||||
return false;
|
||||
}
|
||||
|
||||
module_ = factory_->Create(0, vcm_id);
|
||||
module_ = factory_->Create(vcm_id);
|
||||
if (!module_) {
|
||||
LOG(LS_ERROR) << "Failed to create capturer for id: " << device.id;
|
||||
return false;
|
||||
@ -273,7 +272,7 @@ CaptureState WebRtcVideoCapturer::Start(const VideoFormat& capture_format) {
|
||||
}
|
||||
|
||||
int64_t start = rtc::TimeMillis();
|
||||
module_->RegisterCaptureDataCallback(*this);
|
||||
module_->RegisterCaptureDataCallback(this);
|
||||
if (module_->StartCapture(cap) != 0) {
|
||||
LOG(LS_ERROR) << "Camera '" << GetId() << "' failed to start";
|
||||
module_->DeRegisterCaptureDataCallback();
|
||||
@ -337,8 +336,7 @@ bool WebRtcVideoCapturer::GetPreferredFourccs(std::vector<uint32_t>* fourccs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebRtcVideoCapturer::OnIncomingCapturedFrame(
|
||||
const int32_t id,
|
||||
void WebRtcVideoCapturer::OnFrame(
|
||||
const webrtc::VideoFrame& sample) {
|
||||
// This can only happen between Start() and Stop().
|
||||
RTC_DCHECK(start_thread_);
|
||||
@ -352,12 +350,7 @@ void WebRtcVideoCapturer::OnIncomingCapturedFrame(
|
||||
<< ". Expected format " << GetCaptureFormat()->ToString();
|
||||
}
|
||||
|
||||
OnFrame(sample, sample.width(), sample.height());
|
||||
}
|
||||
|
||||
void WebRtcVideoCapturer::OnCaptureDelayChanged(const int32_t id,
|
||||
const int32_t delay) {
|
||||
LOG(LS_INFO) << "Capture delay changed to " << delay << " ms";
|
||||
VideoCapturer::OnFrame(sample, sample.width(), sample.height());
|
||||
}
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -31,16 +31,15 @@ class WebRtcVcmFactoryInterface {
|
||||
public:
|
||||
virtual ~WebRtcVcmFactoryInterface() {}
|
||||
virtual rtc::scoped_refptr<webrtc::VideoCaptureModule> Create(
|
||||
int id,
|
||||
const char* device) = 0;
|
||||
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo(int id) = 0;
|
||||
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo() = 0;
|
||||
virtual void DestroyDeviceInfo(
|
||||
webrtc::VideoCaptureModule::DeviceInfo* info) = 0;
|
||||
};
|
||||
|
||||
// WebRTC-based implementation of VideoCapturer.
|
||||
class WebRtcVideoCapturer : public VideoCapturer,
|
||||
public webrtc::VideoCaptureDataCallback {
|
||||
public rtc::VideoSinkInterface<webrtc::VideoFrame> {
|
||||
public:
|
||||
WebRtcVideoCapturer();
|
||||
explicit WebRtcVideoCapturer(WebRtcVcmFactoryInterface* factory);
|
||||
@ -64,10 +63,7 @@ class WebRtcVideoCapturer : public VideoCapturer,
|
||||
|
||||
private:
|
||||
// Callback when a frame is captured by camera.
|
||||
void OnIncomingCapturedFrame(const int32_t id,
|
||||
const webrtc::VideoFrame& frame) override;
|
||||
void OnCaptureDelayChanged(const int32_t id,
|
||||
const int32_t delay) override;
|
||||
void OnFrame(const webrtc::VideoFrame& frame) override;
|
||||
|
||||
// Used to signal captured frames on the same thread as invoked Start().
|
||||
// With WebRTC's current VideoCapturer implementations, this will mean a
|
||||
|
||||
@ -75,7 +75,7 @@ TEST_F(WebRtcVideoCapturerTest, TestInit) {
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoCapturerTest, TestInitVcm) {
|
||||
EXPECT_TRUE(capturer_->Init(factory_->Create(0,
|
||||
EXPECT_TRUE(capturer_->Init(factory_->Create(
|
||||
reinterpret_cast<const char*>(kTestDeviceId.c_str()))));
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ TEST_F(WebRtcVideoCapturerTest, TestCapture) {
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) {
|
||||
EXPECT_TRUE(capturer_->Init(factory_->Create(0,
|
||||
EXPECT_TRUE(capturer_->Init(factory_->Create(
|
||||
reinterpret_cast<const char*>(kTestDeviceId.c_str()))));
|
||||
cricket::VideoCapturerListener listener(capturer_.get());
|
||||
EXPECT_TRUE(capturer_->GetSupportedFormats()->empty());
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
include_rules = [
|
||||
"+webrtc/base",
|
||||
"+webrtc/common_video",
|
||||
"+webrtc/media/base",
|
||||
"+webrtc/system_wrappers",
|
||||
]
|
||||
|
||||
@ -23,8 +23,8 @@ namespace webrtc
|
||||
{
|
||||
namespace videocapturemodule
|
||||
{
|
||||
DeviceInfoImpl::DeviceInfoImpl(const int32_t id)
|
||||
: _id(id), _apiLock(*RWLockWrapper::CreateRWLock()), _lastUsedDeviceName(NULL),
|
||||
DeviceInfoImpl::DeviceInfoImpl()
|
||||
: _apiLock(*RWLockWrapper::CreateRWLock()), _lastUsedDeviceName(NULL),
|
||||
_lastUsedDeviceNameLength(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ namespace videocapturemodule
|
||||
class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo
|
||||
{
|
||||
public:
|
||||
DeviceInfoImpl(const int32_t id);
|
||||
DeviceInfoImpl();
|
||||
virtual ~DeviceInfoImpl(void);
|
||||
virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8);
|
||||
virtual int32_t GetCapability(
|
||||
@ -56,7 +56,6 @@ protected:
|
||||
const uint32_t height);
|
||||
protected:
|
||||
// Data members
|
||||
int32_t _id;
|
||||
typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
|
||||
VideoCaptureCapabilities _captureCapabilities;
|
||||
RWLockWrapper& _apiLock;
|
||||
|
||||
@ -17,9 +17,7 @@ namespace videocapturemodule {
|
||||
|
||||
class ExternalDeviceInfo : public DeviceInfoImpl {
|
||||
public:
|
||||
ExternalDeviceInfo(const int32_t id)
|
||||
: DeviceInfoImpl(id) {
|
||||
}
|
||||
ExternalDeviceInfo() {}
|
||||
virtual ~ExternalDeviceInfo() {}
|
||||
virtual uint32_t NumberOfDevices() { return 0; }
|
||||
virtual int32_t DisplayCaptureSettingsDialogBox(
|
||||
@ -43,9 +41,8 @@ class ExternalDeviceInfo : public DeviceInfoImpl {
|
||||
virtual int32_t Init() { return 0; }
|
||||
};
|
||||
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
|
||||
const int32_t id) {
|
||||
return new ExternalDeviceInfo(id);
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
|
||||
return new ExternalDeviceInfo();
|
||||
}
|
||||
|
||||
} // namespace videocapturemodule
|
||||
|
||||
@ -16,9 +16,8 @@ namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
const int32_t id,
|
||||
const char* deviceUniqueIdUTF8) {
|
||||
return new rtc::RefCountedObject<VideoCaptureImpl>(id);
|
||||
return new rtc::RefCountedObject<VideoCaptureImpl>();
|
||||
}
|
||||
|
||||
} // namespace videocapturemodule
|
||||
|
||||
@ -28,13 +28,13 @@ namespace webrtc
|
||||
namespace videocapturemodule
|
||||
{
|
||||
VideoCaptureModule::DeviceInfo*
|
||||
VideoCaptureImpl::CreateDeviceInfo(const int32_t id)
|
||||
VideoCaptureImpl::CreateDeviceInfo()
|
||||
{
|
||||
return new videocapturemodule::DeviceInfoLinux(id);
|
||||
return new videocapturemodule::DeviceInfoLinux();
|
||||
}
|
||||
|
||||
DeviceInfoLinux::DeviceInfoLinux(const int32_t id)
|
||||
: DeviceInfoImpl(id)
|
||||
DeviceInfoLinux::DeviceInfoLinux()
|
||||
: DeviceInfoImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@ -49,7 +49,8 @@ DeviceInfoLinux::~DeviceInfoLinux()
|
||||
|
||||
uint32_t DeviceInfoLinux::NumberOfDevices()
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideoCapture, _id, "%s", __FUNCTION__);
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall,
|
||||
webrtc::kTraceVideoCapture, 0, "%s", __FUNCTION__);
|
||||
|
||||
uint32_t count = 0;
|
||||
char device[20];
|
||||
@ -78,7 +79,8 @@ int32_t DeviceInfoLinux::GetDeviceName(
|
||||
char* /*productUniqueIdUTF8*/,
|
||||
uint32_t /*productUniqueIdUTF8Length*/)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideoCapture, _id, "%s", __FUNCTION__);
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall,
|
||||
webrtc::kTraceVideoCapture, 0, "%s", __FUNCTION__);
|
||||
|
||||
// Travel through /dev/video [0-63]
|
||||
uint32_t count = 0;
|
||||
@ -108,7 +110,7 @@ int32_t DeviceInfoLinux::GetDeviceName(
|
||||
struct v4l2_capability cap;
|
||||
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"error in querying the device capability for device %s. errno = %d",
|
||||
device, errno);
|
||||
close(fd);
|
||||
@ -127,7 +129,8 @@ int32_t DeviceInfoLinux::GetDeviceName(
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, "buffer passed is too small");
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"buffer passed is too small");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -142,7 +145,7 @@ int32_t DeviceInfoLinux::GetDeviceName(
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"buffer passed is too small");
|
||||
return -1;
|
||||
}
|
||||
@ -162,10 +165,11 @@ int32_t DeviceInfoLinux::CreateCapabilityMap(
|
||||
(int32_t) strlen((char*) deviceUniqueIdUTF8);
|
||||
if (deviceUniqueIdUTF8Length > kVideoCaptureUniqueNameLength)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, "Device name too long");
|
||||
WEBRTC_TRACE(webrtc::kTraceError,
|
||||
webrtc::kTraceVideoCapture, 0, "Device name too long");
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CreateCapabilityMap called for device %s", deviceUniqueIdUTF8);
|
||||
|
||||
/* detect /dev/video [0-63] entries */
|
||||
@ -205,7 +209,8 @@ int32_t DeviceInfoLinux::CreateCapabilityMap(
|
||||
|
||||
if (!found)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, "no matching device found");
|
||||
WEBRTC_TRACE(webrtc::kTraceError,
|
||||
webrtc::kTraceVideoCapture, 0, "no matching device found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -224,7 +229,7 @@ int32_t DeviceInfoLinux::CreateCapabilityMap(
|
||||
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo,
|
||||
webrtc::kTraceVideoCapture,
|
||||
_id,
|
||||
0,
|
||||
"CreateCapabilityMap %u",
|
||||
static_cast<unsigned int>(_captureCapabilities.size()));
|
||||
|
||||
@ -311,9 +316,10 @@ int32_t DeviceInfoLinux::FillCapabilities(int fd)
|
||||
|
||||
_captureCapabilities.push_back(cap);
|
||||
index++;
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
"Camera capability, width:%d height:%d type:%d fps:%d",
|
||||
cap.width, cap.height, cap.rawType, cap.maxFPS);
|
||||
WEBRTC_TRACE(
|
||||
webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"Camera capability, width:%d height:%d type:%d fps:%d",
|
||||
cap.width, cap.height, cap.rawType, cap.maxFPS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,7 +327,7 @@ int32_t DeviceInfoLinux::FillCapabilities(int fd)
|
||||
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo,
|
||||
webrtc::kTraceVideoCapture,
|
||||
_id,
|
||||
0,
|
||||
"CreateCapabilityMap %u",
|
||||
static_cast<unsigned int>(_captureCapabilities.size()));
|
||||
return _captureCapabilities.size();
|
||||
|
||||
@ -21,7 +21,7 @@ namespace videocapturemodule
|
||||
class DeviceInfoLinux: public DeviceInfoImpl
|
||||
{
|
||||
public:
|
||||
DeviceInfoLinux(const int32_t id);
|
||||
DeviceInfoLinux();
|
||||
virtual ~DeviceInfoLinux();
|
||||
virtual uint32_t NumberOfDevices();
|
||||
virtual int32_t GetDeviceName(
|
||||
|
||||
@ -30,10 +30,9 @@
|
||||
namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
const int32_t id,
|
||||
const char* deviceUniqueId) {
|
||||
rtc::scoped_refptr<VideoCaptureModuleV4L2> implementation(
|
||||
new rtc::RefCountedObject<VideoCaptureModuleV4L2>(id));
|
||||
new rtc::RefCountedObject<VideoCaptureModuleV4L2>());
|
||||
|
||||
if (implementation->Init(deviceUniqueId) != 0)
|
||||
return nullptr;
|
||||
@ -41,8 +40,8 @@ rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
return implementation;
|
||||
}
|
||||
|
||||
VideoCaptureModuleV4L2::VideoCaptureModuleV4L2(const int32_t id)
|
||||
: VideoCaptureImpl(id),
|
||||
VideoCaptureModuleV4L2::VideoCaptureModuleV4L2()
|
||||
: VideoCaptureImpl(),
|
||||
_captureCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_deviceId(-1),
|
||||
_deviceFd(-1),
|
||||
@ -97,7 +96,8 @@ int32_t VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, "no matching device found");
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture,
|
||||
0, "no matching device found");
|
||||
return -1;
|
||||
}
|
||||
_deviceId = n; //store the device id
|
||||
@ -139,7 +139,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
|
||||
if ((_deviceFd = open(device, O_RDWR | O_NONBLOCK, 0)) < 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"error in opening %s errono = %d", device, errno);
|
||||
return -1;
|
||||
}
|
||||
@ -169,10 +169,10 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.index = 0;
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"Video Capture enumerats supported image formats:");
|
||||
while (ioctl(_deviceFd, VIDIOC_ENUM_FMT, &fmt) == 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
" { pixelformat = %c%c%c%c, description = '%s' }",
|
||||
fmt.pixelformat & 0xFF, (fmt.pixelformat>>8) & 0xFF,
|
||||
(fmt.pixelformat>>16) & 0xFF, (fmt.pixelformat>>24) & 0xFF,
|
||||
@ -188,11 +188,11 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
|
||||
if (fmtsIdx == nFormats)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"no supporting video formats found");
|
||||
return -1;
|
||||
} else {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"We prefer format %c%c%c%c",
|
||||
fmts[fmtsIdx] & 0xFF, (fmts[fmtsIdx]>>8) & 0xFF,
|
||||
(fmts[fmtsIdx]>>16) & 0xFF, (fmts[fmtsIdx]>>24) & 0xFF);
|
||||
@ -219,7 +219,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
//set format and frame size now
|
||||
if (ioctl(_deviceFd, VIDIOC_S_FMT, &video_fmt) < 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"error in VIDIOC_S_FMT, errno = %d", errno);
|
||||
return -1;
|
||||
}
|
||||
@ -235,7 +235,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
memset(&streamparms, 0, sizeof(streamparms));
|
||||
streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"error in VIDIOC_G_PARM errno = %d", errno);
|
||||
driver_framerate_support = false;
|
||||
// continue
|
||||
@ -248,7 +248,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
streamparms.parm.capture.timeperframe.numerator = 1;
|
||||
streamparms.parm.capture.timeperframe.denominator = capability.maxFPS;
|
||||
if (ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to set the framerate. errno=%d", errno);
|
||||
driver_framerate_support = false;
|
||||
} else {
|
||||
@ -268,7 +268,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
|
||||
if (!AllocateVideoBuffers())
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"failed to allocate video capture buffers");
|
||||
return -1;
|
||||
}
|
||||
@ -287,7 +287,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (ioctl(_deviceFd, VIDIOC_STREAMON, &type) == -1)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to turn on stream");
|
||||
return -1;
|
||||
}
|
||||
@ -330,7 +330,7 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers()
|
||||
|
||||
if (ioctl(_deviceFd, VIDIOC_REQBUFS, &rbuffer) < 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Could not get buffers from device. errno = %d", errno);
|
||||
return false;
|
||||
}
|
||||
@ -389,7 +389,7 @@ bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers()
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (ioctl(_deviceFd, VIDIOC_STREAMOFF, &type) < 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"VIDIOC_STREAMOFF error. errno: %d", errno);
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"could not sync on a buffer on device %s", strerror(errno));
|
||||
_captureCritSect->Leave();
|
||||
return true;
|
||||
@ -466,7 +466,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
|
||||
// enqueue the buffer again
|
||||
if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to enqueue capture buffer");
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ namespace videocapturemodule
|
||||
class VideoCaptureModuleV4L2: public VideoCaptureImpl
|
||||
{
|
||||
public:
|
||||
VideoCaptureModuleV4L2(int32_t id);
|
||||
VideoCaptureModuleV4L2();
|
||||
virtual ~VideoCaptureModuleV4L2();
|
||||
virtual int32_t Init(const char* deviceUniqueId);
|
||||
virtual int32_t StartCapture(const VideoCaptureCapability& capability);
|
||||
|
||||
@ -20,7 +20,7 @@ namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
class DeviceInfoIos : public DeviceInfoImpl {
|
||||
public:
|
||||
explicit DeviceInfoIos(const int32_t device_id);
|
||||
DeviceInfoIos();
|
||||
virtual ~DeviceInfoIos();
|
||||
|
||||
// Implementation of DeviceInfoImpl.
|
||||
|
||||
@ -30,17 +30,15 @@ static NSArray* camera_presets = @[
|
||||
];
|
||||
|
||||
#define IOS_UNSUPPORTED() \
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _id, \
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0, \
|
||||
"%s is not supported on the iOS platform.", __FUNCTION__); \
|
||||
return -1;
|
||||
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
|
||||
const int32_t device_id) {
|
||||
return new DeviceInfoIos(device_id);
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
|
||||
return new DeviceInfoIos();
|
||||
}
|
||||
|
||||
DeviceInfoIos::DeviceInfoIos(const int32_t device_id)
|
||||
: DeviceInfoImpl(device_id) {
|
||||
DeviceInfoIos::DeviceInfoIos() {
|
||||
this->Init();
|
||||
}
|
||||
|
||||
|
||||
@ -30,8 +30,7 @@
|
||||
// custom initializer. Instance of VideoCaptureIos is needed
|
||||
// for callback purposes.
|
||||
// default init methods have been overridden to return nil.
|
||||
- (id)initWithOwner:(webrtc::videocapturemodule::VideoCaptureIos*)owner
|
||||
captureId:(int)captureId;
|
||||
- (id)initWithOwner:(webrtc::videocapturemodule::VideoCaptureIos*)owner;
|
||||
- (BOOL)setCaptureDeviceByUniqueId:(NSString*)uniqueId;
|
||||
- (BOOL)startCaptureWithCapability:
|
||||
(const webrtc::VideoCaptureCapability&)capability;
|
||||
|
||||
@ -33,7 +33,6 @@ using namespace webrtc::videocapturemodule;
|
||||
webrtc::videocapturemodule::VideoCaptureIos* _owner;
|
||||
webrtc::VideoCaptureCapability _capability;
|
||||
AVCaptureSession* _captureSession;
|
||||
int _captureId;
|
||||
BOOL _orientationHasChanged;
|
||||
AVCaptureConnection* _connection;
|
||||
BOOL _captureChanging; // Guarded by _captureChangingCondition.
|
||||
@ -42,10 +41,9 @@ using namespace webrtc::videocapturemodule;
|
||||
|
||||
@synthesize frameRotation = _framRotation;
|
||||
|
||||
- (id)initWithOwner:(VideoCaptureIos*)owner captureId:(int)captureId {
|
||||
- (id)initWithOwner:(VideoCaptureIos*)owner {
|
||||
if (self == [super init]) {
|
||||
_owner = owner;
|
||||
_captureId = captureId;
|
||||
_captureSession = [[AVCaptureSession alloc] init];
|
||||
#if defined(WEBRTC_IOS)
|
||||
_captureSession.usesApplicationAudioSession = NO;
|
||||
@ -72,7 +70,7 @@ using namespace webrtc::videocapturemodule;
|
||||
if ([_captureSession canAddOutput:captureOutput]) {
|
||||
[_captureSession addOutput:captureOutput];
|
||||
} else {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _captureId,
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0,
|
||||
"%s:%s:%d Could not add output to AVCaptureSession ",
|
||||
__FILE__, __FUNCTION__, __LINE__);
|
||||
}
|
||||
@ -245,7 +243,7 @@ using namespace webrtc::videocapturemodule;
|
||||
- (void)onVideoError:(NSNotification*)notification {
|
||||
NSLog(@"onVideoError: %@", notification);
|
||||
// TODO(sjlee): make the specific error handling with this notification.
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _captureId,
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0,
|
||||
"%s:%s:%d [AVCaptureSession startRunning] error.", __FILE__,
|
||||
__FUNCTION__, __LINE__);
|
||||
}
|
||||
@ -309,7 +307,7 @@ using namespace webrtc::videocapturemodule;
|
||||
if (!newCaptureInput) {
|
||||
const char* errorMessage = [[deviceError localizedDescription] UTF8String];
|
||||
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _captureId,
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0,
|
||||
"%s:%s:%d deviceInputWithDevice error:%s", __FILE__,
|
||||
__FUNCTION__, __LINE__, errorMessage);
|
||||
|
||||
|
||||
@ -20,11 +20,10 @@ namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
class VideoCaptureIos : public VideoCaptureImpl {
|
||||
public:
|
||||
explicit VideoCaptureIos(const int32_t capture_id);
|
||||
VideoCaptureIos();
|
||||
virtual ~VideoCaptureIos();
|
||||
|
||||
static rtc::scoped_refptr<VideoCaptureModule> Create(
|
||||
const int32_t capture_id,
|
||||
const char* device_unique_id_utf8);
|
||||
|
||||
// Implementation of VideoCaptureImpl.
|
||||
@ -36,7 +35,6 @@ class VideoCaptureIos : public VideoCaptureImpl {
|
||||
private:
|
||||
RTCVideoCaptureIosObjC* capture_device_;
|
||||
bool is_capturing_;
|
||||
int32_t id_;
|
||||
VideoCaptureCapability capability_;
|
||||
};
|
||||
|
||||
|
||||
@ -22,13 +22,12 @@ using namespace webrtc;
|
||||
using namespace videocapturemodule;
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
const int32_t capture_id,
|
||||
const char* deviceUniqueIdUTF8) {
|
||||
return VideoCaptureIos::Create(capture_id, deviceUniqueIdUTF8);
|
||||
return VideoCaptureIos::Create(deviceUniqueIdUTF8);
|
||||
}
|
||||
|
||||
VideoCaptureIos::VideoCaptureIos(const int32_t capture_id)
|
||||
: VideoCaptureImpl(capture_id), is_capturing_(false), id_(capture_id) {
|
||||
VideoCaptureIos::VideoCaptureIos()
|
||||
: is_capturing_(false) {
|
||||
capability_.width = kDefaultWidth;
|
||||
capability_.height = kDefaultHeight;
|
||||
capability_.maxFPS = kDefaultFrameRate;
|
||||
@ -43,14 +42,13 @@ VideoCaptureIos::~VideoCaptureIos() {
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureIos::Create(
|
||||
const int32_t capture_id,
|
||||
const char* deviceUniqueIdUTF8) {
|
||||
if (!deviceUniqueIdUTF8[0]) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureIos> capture_module(
|
||||
new rtc::RefCountedObject<VideoCaptureIos>(capture_id));
|
||||
new rtc::RefCountedObject<VideoCaptureIos>());
|
||||
|
||||
const int32_t name_length = strlen(deviceUniqueIdUTF8);
|
||||
if (name_length > kVideoCaptureUniqueNameLength)
|
||||
@ -61,8 +59,7 @@ rtc::scoped_refptr<VideoCaptureModule> VideoCaptureIos::Create(
|
||||
capture_module->_deviceUniqueId[name_length] = '\0';
|
||||
|
||||
capture_module->capture_device_ =
|
||||
[[RTCVideoCaptureIosObjC alloc] initWithOwner:capture_module
|
||||
captureId:capture_module->id_];
|
||||
[[RTCVideoCaptureIosObjC alloc] initWithOwner:capture_module];
|
||||
if (!capture_module->capture_device_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -29,11 +29,8 @@
|
||||
using webrtc::CriticalSectionWrapper;
|
||||
using webrtc::CriticalSectionScoped;
|
||||
using webrtc::SleepMs;
|
||||
using webrtc::VideoCaptureAlarm;
|
||||
using webrtc::VideoCaptureCapability;
|
||||
using webrtc::VideoCaptureDataCallback;
|
||||
using webrtc::VideoCaptureFactory;
|
||||
using webrtc::VideoCaptureFeedBack;
|
||||
using webrtc::VideoCaptureModule;
|
||||
|
||||
|
||||
@ -60,11 +57,11 @@ static const int kTestHeight = 288;
|
||||
static const int kTestWidth = 352;
|
||||
static const int kTestFramerate = 30;
|
||||
|
||||
class TestVideoCaptureCallback : public VideoCaptureDataCallback {
|
||||
class TestVideoCaptureCallback
|
||||
: public rtc::VideoSinkInterface<webrtc::VideoFrame> {
|
||||
public:
|
||||
TestVideoCaptureCallback()
|
||||
: capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
capture_delay_(-1),
|
||||
last_render_time_ms_(0),
|
||||
incoming_frames_(0),
|
||||
timing_warnings_(0),
|
||||
@ -75,8 +72,7 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
|
||||
printf("No of timing warnings %d\n", timing_warnings_);
|
||||
}
|
||||
|
||||
virtual void OnIncomingCapturedFrame(const int32_t id,
|
||||
const webrtc::VideoFrame& videoFrame) {
|
||||
void OnFrame(const webrtc::VideoFrame& videoFrame) override {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
int height = videoFrame.height();
|
||||
int width = videoFrame.width();
|
||||
@ -109,28 +105,17 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
|
||||
last_frame_ = videoFrame.video_frame_buffer();
|
||||
}
|
||||
|
||||
virtual void OnCaptureDelayChanged(const int32_t id,
|
||||
const int32_t delay) {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
capture_delay_ = delay;
|
||||
}
|
||||
|
||||
void SetExpectedCapability(VideoCaptureCapability capability) {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
capability_= capability;
|
||||
incoming_frames_ = 0;
|
||||
last_render_time_ms_ = 0;
|
||||
capture_delay_ = -1;
|
||||
}
|
||||
int incoming_frames() {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
return incoming_frames_;
|
||||
}
|
||||
|
||||
int capture_delay() {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
return capture_delay_;
|
||||
}
|
||||
int timing_warnings() {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
return timing_warnings_;
|
||||
@ -154,7 +139,6 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
|
||||
private:
|
||||
std::unique_ptr<CriticalSectionWrapper> capture_cs_;
|
||||
VideoCaptureCapability capability_;
|
||||
int capture_delay_;
|
||||
int64_t last_render_time_ms_;
|
||||
int incoming_frames_;
|
||||
int timing_warnings_;
|
||||
@ -162,47 +146,12 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
|
||||
webrtc::VideoRotation rotate_frame_;
|
||||
};
|
||||
|
||||
class TestVideoCaptureFeedBack : public VideoCaptureFeedBack {
|
||||
public:
|
||||
TestVideoCaptureFeedBack() :
|
||||
capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
frame_rate_(0),
|
||||
alarm_(webrtc::Cleared) {
|
||||
}
|
||||
|
||||
virtual void OnCaptureFrameRate(const int32_t id,
|
||||
const uint32_t frameRate) {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
frame_rate_ = frameRate;
|
||||
}
|
||||
|
||||
virtual void OnNoPictureAlarm(const int32_t id,
|
||||
const VideoCaptureAlarm reported_alarm) {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
alarm_ = reported_alarm;
|
||||
}
|
||||
int frame_rate() {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
return frame_rate_;
|
||||
|
||||
}
|
||||
VideoCaptureAlarm alarm() {
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
return alarm_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<CriticalSectionWrapper> capture_cs_;
|
||||
unsigned int frame_rate_;
|
||||
VideoCaptureAlarm alarm_;
|
||||
};
|
||||
|
||||
class VideoCaptureTest : public testing::Test {
|
||||
public:
|
||||
VideoCaptureTest() : number_of_devices_(0) {}
|
||||
|
||||
void SetUp() {
|
||||
device_info_.reset(VideoCaptureFactory::CreateDeviceInfo(0));
|
||||
device_info_.reset(VideoCaptureFactory::CreateDeviceInfo());
|
||||
assert(device_info_.get());
|
||||
number_of_devices_ = device_info_->NumberOfDevices();
|
||||
ASSERT_GT(number_of_devices_, 0u);
|
||||
@ -210,7 +159,7 @@ class VideoCaptureTest : public testing::Test {
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice(
|
||||
unsigned int device,
|
||||
VideoCaptureDataCallback* callback) {
|
||||
rtc::VideoSinkInterface<webrtc::VideoFrame>* callback) {
|
||||
char device_name[256];
|
||||
char unique_name[256];
|
||||
|
||||
@ -218,13 +167,13 @@ class VideoCaptureTest : public testing::Test {
|
||||
device, device_name, 256, unique_name, 256));
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> module(
|
||||
VideoCaptureFactory::Create(device, unique_name));
|
||||
VideoCaptureFactory::Create(unique_name));
|
||||
if (module.get() == NULL)
|
||||
return NULL;
|
||||
|
||||
EXPECT_FALSE(module->CaptureStarted());
|
||||
|
||||
module->RegisterCaptureDataCallback(*callback);
|
||||
module->RegisterCaptureDataCallback(callback);
|
||||
return module;
|
||||
}
|
||||
|
||||
@ -276,8 +225,6 @@ TEST_F(VideoCaptureTest, MAYBE_CreateDelete) {
|
||||
// Make sure 5 frames are captured.
|
||||
EXPECT_TRUE_WAIT(capture_observer.incoming_frames() >= 5, kTimeOut);
|
||||
|
||||
EXPECT_GE(capture_observer.capture_delay(), 0);
|
||||
|
||||
int64_t stop_time = rtc::TimeMillis();
|
||||
EXPECT_EQ(0, module->StopCapture());
|
||||
EXPECT_FALSE(module->CaptureStarted());
|
||||
@ -408,10 +355,7 @@ TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) {
|
||||
class VideoCaptureExternalTest : public testing::Test {
|
||||
public:
|
||||
void SetUp() {
|
||||
capture_module_ = VideoCaptureFactory::Create(0, capture_input_interface_);
|
||||
process_module_ = webrtc::ProcessThread::Create("ProcessThread");
|
||||
process_module_->Start();
|
||||
process_module_->RegisterModule(capture_module_);
|
||||
capture_module_ = VideoCaptureFactory::Create(capture_input_interface_);
|
||||
|
||||
VideoCaptureCapability capability;
|
||||
capability.width = kTestWidth;
|
||||
@ -434,22 +378,16 @@ class VideoCaptureExternalTest : public testing::Test {
|
||||
|
||||
SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp.
|
||||
|
||||
capture_module_->RegisterCaptureDataCallback(capture_callback_);
|
||||
capture_module_->RegisterCaptureCallback(capture_feedback_);
|
||||
capture_module_->EnableFrameRateCallback(true);
|
||||
capture_module_->EnableNoPictureAlarm(true);
|
||||
capture_module_->RegisterCaptureDataCallback(&capture_callback_);
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
process_module_->Stop();
|
||||
}
|
||||
|
||||
webrtc::VideoCaptureExternal* capture_input_interface_;
|
||||
rtc::scoped_refptr<VideoCaptureModule> capture_module_;
|
||||
std::unique_ptr<webrtc::ProcessThread> process_module_;
|
||||
std::unique_ptr<webrtc::VideoFrame> test_frame_;
|
||||
TestVideoCaptureCallback capture_callback_;
|
||||
TestVideoCaptureFeedBack capture_feedback_;
|
||||
};
|
||||
|
||||
// Test input of external video frames.
|
||||
@ -464,51 +402,6 @@ TEST_F(VideoCaptureExternalTest, TestExternalCapture) {
|
||||
EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_));
|
||||
}
|
||||
|
||||
// Test frame rate and no picture alarm.
|
||||
// Flaky on Win32, see webrtc:3270.
|
||||
#if defined(WEBRTC_WIN) || defined(WEBRTC_MAC)
|
||||
#define MAYBE_FrameRate DISABLED_FrameRate
|
||||
#else
|
||||
#define MAYBE_FrameRate FrameRate
|
||||
#endif
|
||||
TEST_F(VideoCaptureExternalTest, MAYBE_FrameRate) {
|
||||
int64_t testTime = 3 * rtc::kNumNanosecsPerSec;
|
||||
int64_t startTime = rtc::TimeNanos();
|
||||
|
||||
while ((rtc::TimeNanos() - startTime) < testTime) {
|
||||
size_t length = webrtc::CalcBufferSize(webrtc::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));
|
||||
SleepMs(100);
|
||||
}
|
||||
EXPECT_TRUE(capture_feedback_.frame_rate() >= 8 &&
|
||||
capture_feedback_.frame_rate() <= 10);
|
||||
SleepMs(500);
|
||||
EXPECT_EQ(webrtc::Raised, capture_feedback_.alarm());
|
||||
|
||||
startTime = rtc::TimeNanos();
|
||||
while ((rtc::TimeNanos() - startTime) < testTime) {
|
||||
size_t length = webrtc::CalcBufferSize(webrtc::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));
|
||||
SleepMs(1000 / 30);
|
||||
}
|
||||
EXPECT_EQ(webrtc::Cleared, capture_feedback_.alarm());
|
||||
// Frame rate might be less than 33 since we have paused providing
|
||||
// frames for a while.
|
||||
EXPECT_TRUE(capture_feedback_.frame_rate() >= 25 &&
|
||||
capture_feedback_.frame_rate() <= 33);
|
||||
}
|
||||
|
||||
TEST_F(VideoCaptureExternalTest, Rotation) {
|
||||
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0));
|
||||
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
|
||||
|
||||
@ -12,12 +12,13 @@
|
||||
#define WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_
|
||||
|
||||
#include "webrtc/common_video/rotation.h"
|
||||
#include "webrtc/media/base/videosinkinterface.h"
|
||||
#include "webrtc/modules/include/module.h"
|
||||
#include "webrtc/modules/video_capture/video_capture_defines.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VideoCaptureModule: public RefCountedModule {
|
||||
class VideoCaptureModule: public rtc::RefCountInterface {
|
||||
public:
|
||||
// Interface for receiving information about available camera devices.
|
||||
class DeviceInfo {
|
||||
@ -75,40 +76,13 @@ class VideoCaptureModule: public RefCountedModule {
|
||||
virtual ~DeviceInfo() {}
|
||||
};
|
||||
|
||||
class VideoCaptureEncodeInterface {
|
||||
public:
|
||||
virtual int32_t ConfigureEncoder(const VideoCodec& codec,
|
||||
uint32_t maxPayloadSize) = 0;
|
||||
// Inform the encoder about the new target bit rate.
|
||||
// - newBitRate : New target bit rate in Kbit/s.
|
||||
// - frameRate : The target frame rate.
|
||||
virtual int32_t SetRates(int32_t newBitRate, int32_t frameRate) = 0;
|
||||
// Inform the encoder about the packet loss and the round-trip time.
|
||||
// - packetLoss : Fraction lost
|
||||
// (loss rate in percent = 100 * packetLoss / 255).
|
||||
// - rtt : Round-trip time in milliseconds.
|
||||
virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) = 0;
|
||||
|
||||
// Encode the next frame as key frame.
|
||||
virtual int32_t EncodeFrameType(const FrameType type) = 0;
|
||||
protected:
|
||||
virtual ~VideoCaptureEncodeInterface() {
|
||||
}
|
||||
};
|
||||
|
||||
// Register capture data callback
|
||||
virtual void RegisterCaptureDataCallback(
|
||||
VideoCaptureDataCallback& dataCallback) = 0;
|
||||
rtc::VideoSinkInterface<VideoFrame> *dataCallback) = 0;
|
||||
|
||||
// Remove capture data callback
|
||||
virtual void DeRegisterCaptureDataCallback() = 0;
|
||||
|
||||
// Register capture callback.
|
||||
virtual void RegisterCaptureCallback(VideoCaptureFeedBack& callBack) = 0;
|
||||
|
||||
// Remove capture callback.
|
||||
virtual void DeRegisterCaptureCallback() = 0;
|
||||
|
||||
// Start capture device
|
||||
virtual int32_t StartCapture(
|
||||
const VideoCaptureCapability& capability) = 0;
|
||||
@ -124,11 +98,6 @@ class VideoCaptureModule: public RefCountedModule {
|
||||
// Gets the current configuration.
|
||||
virtual int32_t CaptureSettings(VideoCaptureCapability& settings) = 0;
|
||||
|
||||
virtual void SetCaptureDelay(int32_t delayMS) = 0;
|
||||
|
||||
// Returns the current CaptureDelay. Only valid when the camera is running.
|
||||
virtual int32_t CaptureDelay() = 0;
|
||||
|
||||
// Set the rotation of the captured frames.
|
||||
// If the rotation is set to the same as returned by
|
||||
// DeviceInfo::GetOrientation the captured frames are
|
||||
@ -144,14 +113,6 @@ class VideoCaptureModule: public RefCountedModule {
|
||||
// Return whether the rotation is applied or left pending.
|
||||
virtual bool GetApplyRotation() = 0;
|
||||
|
||||
// Gets a pointer to an encode interface if the capture device supports the
|
||||
// requested type and size. NULL otherwise.
|
||||
virtual VideoCaptureEncodeInterface* GetEncodeInterface(
|
||||
const VideoCodec& codec) = 0;
|
||||
|
||||
virtual void EnableFrameRateCallback(const bool enable) = 0;
|
||||
virtual void EnableNoPictureAlarm(const bool enable) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~VideoCaptureModule() {};
|
||||
};
|
||||
|
||||
@ -69,12 +69,6 @@ struct VideoCaptureCapability
|
||||
}
|
||||
};
|
||||
|
||||
enum VideoCaptureAlarm
|
||||
{
|
||||
Raised = 0,
|
||||
Cleared = 1
|
||||
};
|
||||
|
||||
/* External Capture interface. Returned by Create
|
||||
and implemented by the capture module.
|
||||
*/
|
||||
@ -90,29 +84,6 @@ protected:
|
||||
~VideoCaptureExternal() {}
|
||||
};
|
||||
|
||||
// Callback class to be implemented by module user
|
||||
class VideoCaptureDataCallback
|
||||
{
|
||||
public:
|
||||
virtual void OnIncomingCapturedFrame(const int32_t id,
|
||||
const VideoFrame& videoFrame) = 0;
|
||||
virtual void OnCaptureDelayChanged(const int32_t id,
|
||||
const int32_t delay) = 0;
|
||||
protected:
|
||||
virtual ~VideoCaptureDataCallback(){}
|
||||
};
|
||||
|
||||
class VideoCaptureFeedBack
|
||||
{
|
||||
public:
|
||||
virtual void OnCaptureFrameRate(const int32_t id,
|
||||
const uint32_t frameRate) = 0;
|
||||
virtual void OnNoPictureAlarm(const int32_t id,
|
||||
const VideoCaptureAlarm alarm) = 0;
|
||||
protected:
|
||||
virtual ~VideoCaptureFeedBack(){}
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_
|
||||
|
||||
@ -15,27 +15,24 @@
|
||||
namespace webrtc {
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureFactory::Create(
|
||||
const int32_t id,
|
||||
const char* deviceUniqueIdUTF8) {
|
||||
#if defined(ANDROID)
|
||||
return nullptr;
|
||||
#else
|
||||
return videocapturemodule::VideoCaptureImpl::Create(id, deviceUniqueIdUTF8);
|
||||
return videocapturemodule::VideoCaptureImpl::Create(deviceUniqueIdUTF8);
|
||||
#endif
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureFactory::Create(
|
||||
const int32_t id,
|
||||
VideoCaptureExternal*& externalCapture) {
|
||||
return videocapturemodule::VideoCaptureImpl::Create(id, externalCapture);
|
||||
return videocapturemodule::VideoCaptureImpl::Create(externalCapture);
|
||||
}
|
||||
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureFactory::CreateDeviceInfo(
|
||||
const int32_t id) {
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureFactory::CreateDeviceInfo() {
|
||||
#if defined(ANDROID)
|
||||
return nullptr;
|
||||
#else
|
||||
return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(id);
|
||||
return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -25,18 +25,15 @@ class VideoCaptureFactory {
|
||||
// deviceUniqueIdUTF8 - name of the device.
|
||||
// Available names can be found by using GetDeviceName
|
||||
static rtc::scoped_refptr<VideoCaptureModule> Create(
|
||||
const int32_t id,
|
||||
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(
|
||||
const int32_t id,
|
||||
VideoCaptureExternal*& externalCapture);
|
||||
|
||||
static VideoCaptureModule::DeviceInfo* CreateDeviceInfo(
|
||||
const int32_t id);
|
||||
static VideoCaptureModule::DeviceInfo* CreateDeviceInfo();
|
||||
|
||||
private:
|
||||
~VideoCaptureFactory();
|
||||
|
||||
@ -25,10 +25,9 @@
|
||||
namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
const int32_t id,
|
||||
VideoCaptureExternal*& externalCapture) {
|
||||
rtc::scoped_refptr<VideoCaptureImpl> implementation(
|
||||
new rtc::RefCountedObject<VideoCaptureImpl>(id));
|
||||
new rtc::RefCountedObject<VideoCaptureImpl>());
|
||||
externalCapture = implementation.get();
|
||||
return implementation;
|
||||
}
|
||||
@ -79,79 +78,14 @@ int32_t VideoCaptureImpl::RotationInDegrees(VideoRotation rotation,
|
||||
return -1;
|
||||
}
|
||||
|
||||
// returns the number of milliseconds until the module want a worker thread to call Process
|
||||
int64_t VideoCaptureImpl::TimeUntilNextProcess()
|
||||
{
|
||||
CriticalSectionScoped cs(&_callBackCs);
|
||||
const int64_t kProcessIntervalMs = 300;
|
||||
return kProcessIntervalMs -
|
||||
(rtc::TimeNanos() - _lastProcessTimeNanos) /
|
||||
rtc::kNumNanosecsPerMillisec;
|
||||
}
|
||||
|
||||
// Process any pending tasks such as timeouts
|
||||
void VideoCaptureImpl::Process()
|
||||
{
|
||||
CriticalSectionScoped cs(&_callBackCs);
|
||||
|
||||
const int64_t now_ns = rtc::TimeNanos();
|
||||
_lastProcessTimeNanos = rtc::TimeNanos();
|
||||
|
||||
// Handle No picture alarm
|
||||
|
||||
if (_lastProcessFrameTimeNanos == _incomingFrameTimesNanos[0] &&
|
||||
_captureAlarm != Raised)
|
||||
{
|
||||
if (_noPictureAlarmCallBack && _captureCallBack)
|
||||
{
|
||||
_captureAlarm = Raised;
|
||||
_captureCallBack->OnNoPictureAlarm(_id, _captureAlarm);
|
||||
}
|
||||
}
|
||||
else if (_lastProcessFrameTimeNanos != _incomingFrameTimesNanos[0] &&
|
||||
_captureAlarm != Cleared)
|
||||
{
|
||||
if (_noPictureAlarmCallBack && _captureCallBack)
|
||||
{
|
||||
_captureAlarm = Cleared;
|
||||
_captureCallBack->OnNoPictureAlarm(_id, _captureAlarm);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Handle frame rate callback
|
||||
if ((now_ns - _lastFrameRateCallbackTimeNanos) /
|
||||
rtc::kNumNanosecsPerMillisec
|
||||
> kFrameRateCallbackInterval)
|
||||
{
|
||||
if (_frameRateCallBack && _captureCallBack)
|
||||
{
|
||||
const uint32_t frameRate = CalculateFrameRate(now_ns);
|
||||
_captureCallBack->OnCaptureFrameRate(_id, frameRate);
|
||||
}
|
||||
// Can be set by EnableFrameRateCallback
|
||||
_lastFrameRateCallbackTimeNanos = now_ns;
|
||||
|
||||
}
|
||||
|
||||
_lastProcessFrameTimeNanos = _incomingFrameTimesNanos[0];
|
||||
}
|
||||
|
||||
VideoCaptureImpl::VideoCaptureImpl(const int32_t id)
|
||||
: _id(id),
|
||||
_deviceUniqueId(NULL),
|
||||
VideoCaptureImpl::VideoCaptureImpl()
|
||||
: _deviceUniqueId(NULL),
|
||||
_apiCs(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_captureDelay(0),
|
||||
_requestedCapability(),
|
||||
_callBackCs(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_lastProcessTimeNanos(rtc::TimeNanos()),
|
||||
_lastFrameRateCallbackTimeNanos(rtc::TimeNanos()),
|
||||
_frameRateCallBack(false),
|
||||
_noPictureAlarmCallBack(false),
|
||||
_captureAlarm(Cleared),
|
||||
_setCaptureDelay(0),
|
||||
_dataCallBack(NULL),
|
||||
_captureCallBack(NULL),
|
||||
_lastProcessFrameTimeNanos(rtc::TimeNanos()),
|
||||
_rotateFrame(kVideoRotation_0),
|
||||
apply_rotation_(false) {
|
||||
@ -166,8 +100,6 @@ VideoCaptureImpl::VideoCaptureImpl(const int32_t id)
|
||||
VideoCaptureImpl::~VideoCaptureImpl()
|
||||
{
|
||||
DeRegisterCaptureDataCallback();
|
||||
DeRegisterCaptureCallback();
|
||||
delete &_callBackCs;
|
||||
delete &_apiCs;
|
||||
|
||||
if (_deviceUniqueId)
|
||||
@ -175,53 +107,20 @@ VideoCaptureImpl::~VideoCaptureImpl()
|
||||
}
|
||||
|
||||
void VideoCaptureImpl::RegisterCaptureDataCallback(
|
||||
VideoCaptureDataCallback& dataCallBack) {
|
||||
rtc::VideoSinkInterface<VideoFrame>* dataCallBack) {
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_dataCallBack = &dataCallBack;
|
||||
_dataCallBack = dataCallBack;
|
||||
}
|
||||
|
||||
void VideoCaptureImpl::DeRegisterCaptureDataCallback() {
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_dataCallBack = NULL;
|
||||
}
|
||||
void VideoCaptureImpl::RegisterCaptureCallback(VideoCaptureFeedBack& callBack) {
|
||||
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_captureCallBack = &callBack;
|
||||
}
|
||||
void VideoCaptureImpl::DeRegisterCaptureCallback() {
|
||||
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_captureCallBack = NULL;
|
||||
}
|
||||
void VideoCaptureImpl::SetCaptureDelay(int32_t delayMS) {
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
_captureDelay = delayMS;
|
||||
}
|
||||
int32_t VideoCaptureImpl::CaptureDelay()
|
||||
{
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
return _setCaptureDelay;
|
||||
}
|
||||
|
||||
int32_t VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame) {
|
||||
UpdateFrameCount(); // frame count used for local frame rate callback.
|
||||
|
||||
const bool callOnCaptureDelayChanged = _setCaptureDelay != _captureDelay;
|
||||
// Capture delay changed
|
||||
if (_setCaptureDelay != _captureDelay) {
|
||||
_setCaptureDelay = _captureDelay;
|
||||
}
|
||||
|
||||
if (_dataCallBack) {
|
||||
if (callOnCaptureDelayChanged) {
|
||||
_dataCallBack->OnCaptureDelayChanged(_id, _captureDelay);
|
||||
}
|
||||
_dataCallBack->OnIncomingCapturedFrame(_id, captureFrame);
|
||||
_dataCallBack->OnFrame(captureFrame);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -234,7 +133,6 @@ int32_t VideoCaptureImpl::IncomingFrame(
|
||||
int64_t captureTime/*=0*/)
|
||||
{
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
|
||||
const int32_t width = frameInfo.width;
|
||||
const int32_t height = frameInfo.height;
|
||||
@ -308,21 +206,10 @@ int32_t VideoCaptureImpl::IncomingFrame(
|
||||
|
||||
int32_t VideoCaptureImpl::SetCaptureRotation(VideoRotation rotation) {
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_rotateFrame = rotation;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VideoCaptureImpl::EnableFrameRateCallback(const bool enable) {
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_frameRateCallBack = enable;
|
||||
if (enable)
|
||||
{
|
||||
_lastFrameRateCallbackTimeNanos = rtc::TimeNanos();
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoCaptureImpl::SetApplyRotation(bool enable) {
|
||||
// We can't take any lock here as it'll cause deadlock with IncomingFrame.
|
||||
|
||||
@ -331,12 +218,6 @@ bool VideoCaptureImpl::SetApplyRotation(bool enable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void VideoCaptureImpl::EnableNoPictureAlarm(const bool enable) {
|
||||
CriticalSectionScoped cs(&_apiCs);
|
||||
CriticalSectionScoped cs2(&_callBackCs);
|
||||
_noPictureAlarmCallBack = enable;
|
||||
}
|
||||
|
||||
void VideoCaptureImpl::UpdateFrameCount()
|
||||
{
|
||||
if (_incomingFrameTimesNanos[0] / rtc::kNumNanosecsPerMicrosec == 0)
|
||||
|
||||
@ -39,7 +39,6 @@ public:
|
||||
* deviceUniqueIdUTF8 - name of the device. Available names can be found by using GetDeviceName
|
||||
*/
|
||||
static rtc::scoped_refptr<VideoCaptureModule> Create(
|
||||
const int32_t id,
|
||||
const char* deviceUniqueIdUTF8);
|
||||
|
||||
/*
|
||||
@ -49,10 +48,9 @@ public:
|
||||
* externalCapture - [out] interface to call when a new frame is captured.
|
||||
*/
|
||||
static rtc::scoped_refptr<VideoCaptureModule> Create(
|
||||
const int32_t id,
|
||||
VideoCaptureExternal*& externalCapture);
|
||||
|
||||
static DeviceInfo* CreateDeviceInfo(const int32_t id);
|
||||
static DeviceInfo* CreateDeviceInfo();
|
||||
|
||||
// Helpers for converting between (integral) degrees and
|
||||
// VideoRotation values. Return 0 on success.
|
||||
@ -60,55 +58,41 @@ public:
|
||||
static int32_t RotationInDegrees(VideoRotation rotation, int* degrees);
|
||||
|
||||
//Call backs
|
||||
virtual void RegisterCaptureDataCallback(
|
||||
VideoCaptureDataCallback& dataCallback);
|
||||
virtual void DeRegisterCaptureDataCallback();
|
||||
virtual void RegisterCaptureCallback(VideoCaptureFeedBack& callBack);
|
||||
virtual void DeRegisterCaptureCallback();
|
||||
void RegisterCaptureDataCallback(
|
||||
rtc::VideoSinkInterface<VideoFrame>* dataCallback) override;
|
||||
void DeRegisterCaptureDataCallback() override;
|
||||
|
||||
virtual void SetCaptureDelay(int32_t delayMS);
|
||||
virtual int32_t CaptureDelay();
|
||||
virtual int32_t SetCaptureRotation(VideoRotation rotation);
|
||||
virtual bool SetApplyRotation(bool enable);
|
||||
virtual bool GetApplyRotation() {
|
||||
int32_t SetCaptureRotation(VideoRotation rotation) override;
|
||||
bool SetApplyRotation(bool enable) override;
|
||||
bool GetApplyRotation() override {
|
||||
return apply_rotation_;
|
||||
}
|
||||
|
||||
virtual void EnableFrameRateCallback(const bool enable);
|
||||
virtual void EnableNoPictureAlarm(const bool enable);
|
||||
|
||||
virtual const char* CurrentDeviceName() const;
|
||||
|
||||
// Module handling
|
||||
virtual int64_t TimeUntilNextProcess();
|
||||
virtual void Process();
|
||||
const char* CurrentDeviceName() const override;
|
||||
|
||||
// Implement VideoCaptureExternal
|
||||
// |capture_time| must be specified in NTP time format in milliseconds.
|
||||
virtual int32_t IncomingFrame(uint8_t* videoFrame,
|
||||
size_t videoFrameLength,
|
||||
const VideoCaptureCapability& frameInfo,
|
||||
int64_t captureTime = 0);
|
||||
int32_t IncomingFrame(uint8_t* videoFrame,
|
||||
size_t videoFrameLength,
|
||||
const VideoCaptureCapability& frameInfo,
|
||||
int64_t captureTime = 0) override;
|
||||
|
||||
// Platform dependent
|
||||
virtual int32_t StartCapture(const VideoCaptureCapability& capability)
|
||||
int32_t StartCapture(const VideoCaptureCapability& capability) override
|
||||
{
|
||||
_requestedCapability = capability;
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StopCapture() { return -1; }
|
||||
virtual bool CaptureStarted() {return false; }
|
||||
virtual int32_t CaptureSettings(VideoCaptureCapability& /*settings*/)
|
||||
int32_t StopCapture() override { return -1; }
|
||||
bool CaptureStarted() override {return false; }
|
||||
int32_t CaptureSettings(VideoCaptureCapability& /*settings*/) override
|
||||
{ return -1; }
|
||||
VideoCaptureEncodeInterface* GetEncodeInterface(const VideoCodec& /*codec*/)
|
||||
{ return NULL; }
|
||||
|
||||
protected:
|
||||
VideoCaptureImpl(const int32_t id);
|
||||
VideoCaptureImpl();
|
||||
virtual ~VideoCaptureImpl();
|
||||
int32_t DeliverCapturedFrame(VideoFrame& captureFrame);
|
||||
|
||||
int32_t _id; // Module ID
|
||||
char* _deviceUniqueId; // current Device unique name;
|
||||
CriticalSectionWrapper& _apiCs;
|
||||
int32_t _captureDelay; // Current capture delay. May be changed of platform dependent parts.
|
||||
@ -117,19 +101,12 @@ private:
|
||||
void UpdateFrameCount();
|
||||
uint32_t CalculateFrameRate(int64_t now_ns);
|
||||
|
||||
CriticalSectionWrapper& _callBackCs;
|
||||
|
||||
// last time the module process function was called.
|
||||
int64_t _lastProcessTimeNanos;
|
||||
// last time the frame rate callback function was called.
|
||||
int64_t _lastFrameRateCallbackTimeNanos;
|
||||
bool _frameRateCallBack; // true if EnableFrameRateCallback
|
||||
bool _noPictureAlarmCallBack; //true if EnableNoPictureAlarm
|
||||
VideoCaptureAlarm _captureAlarm; // current value of the noPictureAlarm
|
||||
|
||||
int32_t _setCaptureDelay; // The currently used capture delay
|
||||
VideoCaptureDataCallback* _dataCallBack;
|
||||
VideoCaptureFeedBack* _captureCallBack;
|
||||
rtc::VideoSinkInterface<VideoFrame>* _dataCallBack;
|
||||
|
||||
int64_t _lastProcessFrameTimeNanos;
|
||||
// timestamp for local captured frames
|
||||
|
||||
@ -42,9 +42,9 @@ const DelayValues WindowsCaptureDelays[NoWindowsCaptureDelays] = {
|
||||
};
|
||||
|
||||
// static
|
||||
DeviceInfoDS* DeviceInfoDS::Create(const int32_t id)
|
||||
DeviceInfoDS* DeviceInfoDS::Create()
|
||||
{
|
||||
DeviceInfoDS* dsInfo = new DeviceInfoDS(id);
|
||||
DeviceInfoDS* dsInfo = new DeviceInfoDS();
|
||||
if (!dsInfo || dsInfo->Init() != 0)
|
||||
{
|
||||
delete dsInfo;
|
||||
@ -53,8 +53,8 @@ DeviceInfoDS* DeviceInfoDS::Create(const int32_t id)
|
||||
return dsInfo;
|
||||
}
|
||||
|
||||
DeviceInfoDS::DeviceInfoDS(const int32_t id)
|
||||
: DeviceInfoImpl(id), _dsDevEnum(NULL), _dsMonikerDevEnum(NULL),
|
||||
DeviceInfoDS::DeviceInfoDS()
|
||||
: _dsDevEnum(NULL), _dsMonikerDevEnum(NULL),
|
||||
_CoUninitializeIsRequired(true)
|
||||
{
|
||||
// 1) Initialize the COM library (make Windows load the DLLs).
|
||||
@ -88,7 +88,7 @@ DeviceInfoDS::DeviceInfoDS(const int32_t id)
|
||||
// apartment (STA). We are then prevented from using STA.
|
||||
// Details: hr = 0x80010106 <=> "Cannot change thread mode after it is set".
|
||||
//
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, 0,
|
||||
"VideoCaptureWindowsDSInfo::VideoCaptureWindowsDSInfo "
|
||||
"CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) => "
|
||||
"RPC_E_CHANGED_MODE, error 0x%x",
|
||||
@ -113,7 +113,7 @@ int32_t DeviceInfoDS::Init()
|
||||
IID_ICreateDevEnum, (void **) &_dsDevEnum);
|
||||
if (hr != NOERROR)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to create CLSID_SystemDeviceEnum, error 0x%x", hr);
|
||||
return -1;
|
||||
}
|
||||
@ -162,7 +162,7 @@ int32_t DeviceInfoDS::GetDeviceInfo(
|
||||
&_dsMonikerDevEnum, 0);
|
||||
if (hr != NOERROR)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to enumerate CLSID_SystemDeviceEnum, error 0x%x."
|
||||
" No webcam exist?", hr);
|
||||
return 0;
|
||||
@ -207,7 +207,7 @@ int32_t DeviceInfoDS::GetDeviceInfo(
|
||||
if (convResult == 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError,
|
||||
webrtc::kTraceVideoCapture, _id,
|
||||
webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to convert device name to UTF8. %d",
|
||||
GetLastError());
|
||||
return -1;
|
||||
@ -222,7 +222,7 @@ int32_t DeviceInfoDS::GetDeviceInfo(
|
||||
deviceUniqueIdUTF8Length,
|
||||
(char *) deviceNameUTF8, convResult);
|
||||
WEBRTC_TRACE(webrtc::kTraceError,
|
||||
webrtc::kTraceVideoCapture, _id,
|
||||
webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to get deviceUniqueIdUTF8 using deviceNameUTF8");
|
||||
}
|
||||
else
|
||||
@ -238,7 +238,7 @@ int32_t DeviceInfoDS::GetDeviceInfo(
|
||||
if (convResult == 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError,
|
||||
webrtc::kTraceVideoCapture, _id,
|
||||
webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to convert device name to UTF8. %d",
|
||||
GetLastError());
|
||||
return -1;
|
||||
@ -265,7 +265,8 @@ int32_t DeviceInfoDS::GetDeviceInfo(
|
||||
}
|
||||
if (deviceNameLength)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, _id, "%s %s",
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug,
|
||||
webrtc::kTraceVideoCapture, 0, "%s %s",
|
||||
__FUNCTION__, deviceNameUTF8);
|
||||
}
|
||||
return index;
|
||||
@ -281,7 +282,7 @@ IBaseFilter * DeviceInfoDS::GetDeviceFilter(
|
||||
(int32_t) strlen((char*) deviceUniqueIdUTF8); // UTF8 is also NULL terminated
|
||||
if (deviceUniqueIdUTF8Length > kVideoCaptureUniqueNameLength)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Device name too long");
|
||||
return NULL;
|
||||
}
|
||||
@ -292,7 +293,7 @@ IBaseFilter * DeviceInfoDS::GetDeviceFilter(
|
||||
&_dsMonikerDevEnum, 0);
|
||||
if (hr != NOERROR)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to enumerate CLSID_SystemDeviceEnum, error 0x%x."
|
||||
" No webcam exist?", hr);
|
||||
return 0;
|
||||
@ -341,8 +342,10 @@ IBaseFilter * DeviceInfoDS::GetDeviceFilter(
|
||||
(void**) &captureFilter);
|
||||
if FAILED(hr)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture,
|
||||
_id, "Failed to bind to the selected capture device %d",hr);
|
||||
WEBRTC_TRACE(
|
||||
webrtc::kTraceError, webrtc::kTraceVideoCapture,
|
||||
0, "Failed to bind to the selected capture "
|
||||
"device %d",hr);
|
||||
}
|
||||
|
||||
if (productUniqueIdUTF8
|
||||
@ -390,11 +393,11 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
(int32_t) strlen((char*) deviceUniqueIdUTF8);
|
||||
if (deviceUniqueIdUTF8Length > kVideoCaptureUniqueNameLength)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Device name too long");
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CreateCapabilityMap called for device %s", deviceUniqueIdUTF8);
|
||||
|
||||
|
||||
@ -408,7 +411,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
IPin* outputCapturePin = GetOutputPin(captureDevice, GUID_NULL);
|
||||
if (!outputCapturePin)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to get capture device output pin");
|
||||
RELEASE_AND_CLEAR(captureDevice);
|
||||
return -1;
|
||||
@ -418,7 +421,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
(void **) &extDevice);
|
||||
if (SUCCEEDED(hr) && extDevice)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"This is an external device");
|
||||
extDevice->Release();
|
||||
}
|
||||
@ -428,7 +431,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
(void**) &streamConfig);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to get IID_IAMStreamConfig interface from capture device");
|
||||
return -1;
|
||||
}
|
||||
@ -439,7 +442,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
(void**) &videoControlConfig);
|
||||
if (FAILED(hrVC))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, 0,
|
||||
"IID_IAMVideoControl Interface NOT SUPPORTED");
|
||||
}
|
||||
|
||||
@ -450,7 +453,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
hr = streamConfig->GetNumberOfCapabilities(&count, &size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to GetNumberOfCapabilities");
|
||||
RELEASE_AND_CLEAR(videoControlConfig);
|
||||
RELEASE_AND_CLEAR(streamConfig);
|
||||
@ -475,7 +478,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
if (pmt->majortype == MEDIATYPE_Video
|
||||
&& pmt->formattype == FORMAT_VideoInfo2)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, 0,
|
||||
" Device support FORMAT_VideoInfo2");
|
||||
supportFORMAT_VideoInfo2 = true;
|
||||
VIDEOINFOHEADER2* h =
|
||||
@ -488,7 +491,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
if (pmt->majortype == MEDIATYPE_Video
|
||||
&& pmt->formattype == FORMAT_VideoInfo)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, 0,
|
||||
" Device support FORMAT_VideoInfo2");
|
||||
supportFORMAT_VideoInfo = true;
|
||||
}
|
||||
@ -512,7 +515,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
reinterpret_cast<BYTE*> (&caps));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to GetStreamCaps");
|
||||
RELEASE_AND_CLEAR(videoControlConfig);
|
||||
RELEASE_AND_CLEAR(streamConfig);
|
||||
@ -584,7 +587,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
else // use existing method
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture,
|
||||
_id,
|
||||
0,
|
||||
"GetMaxAvailableFrameRate NOT SUPPORTED");
|
||||
if (avgTimePerFrame > 0)
|
||||
capability.maxFPS = static_cast<int> (10000000
|
||||
@ -639,7 +642,8 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
}
|
||||
else if (pmt->subtype == MEDIASUBTYPE_HDYC) // Seen used by Declink capture cards. Uses BT. 709 color. Not entiry correct to use UYVY. http://en.wikipedia.org/wiki/YCbCr
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning,
|
||||
webrtc::kTraceVideoCapture, 0,
|
||||
"Device support HDYC.");
|
||||
capability.rawType = kVideoUYVY;
|
||||
}
|
||||
@ -648,7 +652,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
WCHAR strGuid[39];
|
||||
StringFromGUID2(pmt->subtype, strGuid, 39);
|
||||
WEBRTC_TRACE( webrtc::kTraceWarning,
|
||||
webrtc::kTraceVideoCapture, _id,
|
||||
webrtc::kTraceVideoCapture, 0,
|
||||
"Device support unknown media type %ls, width %d, height %d",
|
||||
strGuid);
|
||||
continue;
|
||||
@ -663,7 +667,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
capability.height);
|
||||
_captureCapabilities.push_back(capability);
|
||||
_captureCapabilitiesWindows.push_back(capability);
|
||||
WEBRTC_TRACE( webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE( webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"Camera capability, width:%d height:%d type:%d fps:%d",
|
||||
capability.width, capability.height,
|
||||
capability.rawType, capability.maxFPS);
|
||||
@ -682,7 +686,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(
|
||||
_lastUsedDeviceNameLength
|
||||
+ 1);
|
||||
memcpy(_lastUsedDeviceName, deviceUniqueIdUTF8, _lastUsedDeviceNameLength+ 1);
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CreateCapabilityMap %d", _captureCapabilities.size());
|
||||
|
||||
return static_cast<int32_t>(_captureCapabilities.size());
|
||||
|
||||
@ -35,9 +35,9 @@ class DeviceInfoDS: public DeviceInfoImpl
|
||||
{
|
||||
public:
|
||||
// Factory function.
|
||||
static DeviceInfoDS* Create(const int32_t id);
|
||||
static DeviceInfoDS* Create();
|
||||
|
||||
DeviceInfoDS(const int32_t id);
|
||||
DeviceInfoDS();
|
||||
virtual ~DeviceInfoDS();
|
||||
|
||||
int32_t Init();
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
|
||||
DeviceInfoMF::DeviceInfoMF(const int32_t id) : DeviceInfoImpl(id) {
|
||||
DeviceInfoMF::DeviceInfoMF() {
|
||||
}
|
||||
|
||||
DeviceInfoMF::~DeviceInfoMF() {
|
||||
|
||||
@ -19,7 +19,7 @@ namespace videocapturemodule {
|
||||
// Provides video capture device information using the Media Foundation API.
|
||||
class DeviceInfoMF : public DeviceInfoImpl {
|
||||
public:
|
||||
explicit DeviceInfoMF(const int32_t id);
|
||||
DeviceInfoMF();
|
||||
virtual ~DeviceInfoMF();
|
||||
|
||||
int32_t Init();
|
||||
|
||||
@ -35,8 +35,7 @@ typedef struct tagTHREADNAME_INFO
|
||||
DWORD dwFlags; // reserved for future use, must be zero
|
||||
} THREADNAME_INFO;
|
||||
|
||||
CaptureInputPin::CaptureInputPin (int32_t moduleId,
|
||||
IN TCHAR * szName,
|
||||
CaptureInputPin::CaptureInputPin (IN TCHAR * szName,
|
||||
IN CaptureSinkFilter* pFilter,
|
||||
IN CCritSec * pLock,
|
||||
OUT HRESULT * pHr,
|
||||
@ -45,7 +44,6 @@ CaptureInputPin::CaptureInputPin (int32_t moduleId,
|
||||
_requestedCapability(),
|
||||
_resultingCapability()
|
||||
{
|
||||
_moduleId=moduleId;
|
||||
_threadHandle = NULL;
|
||||
}
|
||||
|
||||
@ -66,7 +64,7 @@ CaptureInputPin::GetMediaType (IN int iPosition, OUT CMediaType * pmt)
|
||||
sizeof(VIDEOINFOHEADER));
|
||||
if(NULL == pvi)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _moduleId,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CheckMediaType VIDEOINFOHEADER is NULL. Returning...Line:%d\n", __LINE__);
|
||||
return(E_OUTOFMEMORY);
|
||||
}
|
||||
@ -154,7 +152,7 @@ CaptureInputPin::GetMediaType (IN int iPosition, OUT CMediaType * pmt)
|
||||
return VFW_S_NO_MORE_ITEMS;
|
||||
}
|
||||
pmt->SetSampleSize(pvi->bmiHeader.biSizeImage);
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _moduleId,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"GetMediaType position %d, width %d, height %d, biCompression 0x%x",
|
||||
iPosition, _requestedCapability.width,
|
||||
_requestedCapability.height,pvi->bmiHeader.biCompression);
|
||||
@ -203,7 +201,7 @@ CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType)
|
||||
_resultingCapability.height = abs(pvi->bmiHeader.biHeight);
|
||||
}
|
||||
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _moduleId,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CheckMediaType width:%d height:%d Compression:0x%x\n",
|
||||
pvi->bmiHeader.biWidth,pvi->bmiHeader.biHeight,
|
||||
pvi->bmiHeader.biCompression);
|
||||
@ -256,7 +254,7 @@ CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _moduleId,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CheckMediaType width:%d height:%d Compression:0x%x\n",
|
||||
pvi->bmiHeader.biWidth,pvi->bmiHeader.biHeight,
|
||||
pvi->bmiHeader.biCompression);
|
||||
@ -373,15 +371,13 @@ HRESULT CaptureInputPin::SetMatchingMediaType(
|
||||
CaptureSinkFilter::CaptureSinkFilter (IN TCHAR * tszName,
|
||||
IN LPUNKNOWN punk,
|
||||
OUT HRESULT * phr,
|
||||
VideoCaptureExternal& captureObserver,
|
||||
int32_t moduleId)
|
||||
VideoCaptureExternal& captureObserver)
|
||||
: CBaseFilter(tszName,punk,& m_crtFilter,CLSID_SINKFILTER),
|
||||
m_pInput(NULL),
|
||||
_captureObserver(captureObserver),
|
||||
_moduleId(moduleId)
|
||||
_captureObserver(captureObserver)
|
||||
{
|
||||
(* phr) = S_OK;
|
||||
m_pInput = new CaptureInputPin(moduleId,NAME ("VideoCaptureInputPin"),
|
||||
m_pInput = new CaptureInputPin(NAME ("VideoCaptureInputPin"),
|
||||
this,
|
||||
& m_crtFilter,
|
||||
phr, L"VideoCapture");
|
||||
|
||||
@ -29,14 +29,11 @@ class CaptureSinkFilter;
|
||||
class CaptureInputPin: public CBaseInputPin
|
||||
{
|
||||
public:
|
||||
int32_t _moduleId;
|
||||
|
||||
VideoCaptureCapability _requestedCapability;
|
||||
VideoCaptureCapability _resultingCapability;
|
||||
HANDLE _threadHandle;
|
||||
|
||||
CaptureInputPin(int32_t moduleId,
|
||||
IN TCHAR* szName,
|
||||
CaptureInputPin(IN TCHAR* szName,
|
||||
IN CaptureSinkFilter* pFilter,
|
||||
IN CCritSec * pLock,
|
||||
OUT HRESULT * pHr,
|
||||
@ -56,8 +53,7 @@ public:
|
||||
CaptureSinkFilter(IN TCHAR * tszName,
|
||||
IN LPUNKNOWN punk,
|
||||
OUT HRESULT * phr,
|
||||
VideoCaptureExternal& captureObserver,
|
||||
int32_t moduleId);
|
||||
VideoCaptureExternal& captureObserver);
|
||||
virtual ~CaptureSinkFilter();
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -93,7 +89,6 @@ private:
|
||||
CCritSec m_crtRecv; // receiver lock; always acquire before filter lock
|
||||
CaptureInputPin * m_pInput;
|
||||
VideoCaptureExternal& _captureObserver;
|
||||
int32_t _moduleId;
|
||||
};
|
||||
} // namespace videocapturemodule
|
||||
} // namespace webrtc
|
||||
|
||||
@ -22,8 +22,8 @@ namespace webrtc
|
||||
{
|
||||
namespace videocapturemodule
|
||||
{
|
||||
VideoCaptureDS::VideoCaptureDS(const int32_t id)
|
||||
: VideoCaptureImpl(id), _dsInfo(id), _captureFilter(NULL),
|
||||
VideoCaptureDS::VideoCaptureDS()
|
||||
: _captureFilter(NULL),
|
||||
_graphBuilder(NULL), _mediaControl(NULL), _sinkFilter(NULL),
|
||||
_inputSendPin(NULL), _outputCapturePin(NULL), _dvFilter(NULL),
|
||||
_inputDvPin(NULL), _outputDvPin(NULL)
|
||||
@ -60,7 +60,7 @@ VideoCaptureDS::~VideoCaptureDS()
|
||||
RELEASE_AND_CLEAR(_graphBuilder);
|
||||
}
|
||||
|
||||
int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8)
|
||||
{
|
||||
const int32_t nameLength =
|
||||
(int32_t) strlen((char*) deviceUniqueIdUTF8);
|
||||
@ -77,7 +77,7 @@ int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
_captureFilter = _dsInfo.GetDeviceFilter(deviceUniqueIdUTF8);
|
||||
if (!_captureFilter)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to create capture filter.");
|
||||
return -1;
|
||||
}
|
||||
@ -88,7 +88,7 @@ int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
(void **) &_graphBuilder);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to create graph builder.");
|
||||
return -1;
|
||||
}
|
||||
@ -97,14 +97,14 @@ int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
(void **) &_mediaControl);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to create media control builder.");
|
||||
return -1;
|
||||
}
|
||||
hr = _graphBuilder->AddFilter(_captureFilter, CAPTURE_FILTER_NAME);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to add the capture device to the graph.");
|
||||
return -1;
|
||||
}
|
||||
@ -113,10 +113,10 @@ int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
|
||||
// Create the sink filte used for receiving Captured frames.
|
||||
_sinkFilter = new CaptureSinkFilter(SINK_FILTER_NAME, NULL, &hr,
|
||||
*this, _id);
|
||||
*this);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to create send filter");
|
||||
return -1;
|
||||
}
|
||||
@ -125,7 +125,7 @@ int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
hr = _graphBuilder->AddFilter(_sinkFilter, SINK_FILTER_NAME);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to add the send filter to the graph.");
|
||||
return -1;
|
||||
}
|
||||
@ -140,12 +140,12 @@ int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8)
|
||||
hr = _mediaControl->Pause();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to Pause the Capture device. Is it already occupied? %d.",
|
||||
hr);
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"Capture device '%s' initialized.", deviceUniqueIdUTF8);
|
||||
return 0;
|
||||
}
|
||||
@ -167,7 +167,7 @@ int32_t VideoCaptureDS::StartCapture(
|
||||
HRESULT hr = _mediaControl->Run();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to start the Capture device.");
|
||||
return -1;
|
||||
}
|
||||
@ -181,7 +181,7 @@ int32_t VideoCaptureDS::StopCapture()
|
||||
HRESULT hr = _mediaControl->Pause();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to stop the capture graph. %d", hr);
|
||||
return -1;
|
||||
}
|
||||
@ -193,10 +193,10 @@ bool VideoCaptureDS::CaptureStarted()
|
||||
HRESULT hr = _mediaControl->GetState(1000, &state);
|
||||
if (hr != S_OK && hr != VFW_S_CANT_CUE)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to get the CaptureStarted status");
|
||||
}
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
||||
"CaptureStarted %d", state);
|
||||
return state == State_Running;
|
||||
|
||||
@ -252,7 +252,7 @@ int32_t VideoCaptureDS::SetCameraOutput(
|
||||
(void**) &streamConfig);
|
||||
if (hr)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Can't get the Capture format settings.");
|
||||
return -1;
|
||||
}
|
||||
@ -303,7 +303,7 @@ int32_t VideoCaptureDS::SetCameraOutput(
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to set capture device output format");
|
||||
return -1;
|
||||
}
|
||||
@ -319,7 +319,7 @@ int32_t VideoCaptureDS::SetCameraOutput(
|
||||
}
|
||||
if (hr != S_OK)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to connect the Capture graph %d", hr);
|
||||
return -1;
|
||||
}
|
||||
@ -340,7 +340,7 @@ int32_t VideoCaptureDS::DisconnectGraph()
|
||||
}
|
||||
if (hr != S_OK)
|
||||
{
|
||||
WEBRTC_TRACE( webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE( webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to Stop the Capture device for reconfiguration %d",
|
||||
hr);
|
||||
return -1;
|
||||
@ -357,28 +357,28 @@ HRESULT VideoCaptureDS::ConnectDVCamera()
|
||||
IID_IBaseFilter, (void **) &_dvFilter);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to create the dv decoder: %x", hr);
|
||||
return hr;
|
||||
}
|
||||
hr = _graphBuilder->AddFilter(_dvFilter, L"VideoDecoderDV");
|
||||
if (hr != S_OK)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to add the dv decoder to the graph: %x", hr);
|
||||
return hr;
|
||||
}
|
||||
_inputDvPin = GetInputPin(_dvFilter);
|
||||
if (_inputDvPin == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to get input pin from DV decoder");
|
||||
return -1;
|
||||
}
|
||||
_outputDvPin = GetOutputPin(_dvFilter, GUID_NULL);
|
||||
if (_outputDvPin == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to get output pin from DV decoder");
|
||||
return -1;
|
||||
}
|
||||
@ -386,7 +386,7 @@ HRESULT VideoCaptureDS::ConnectDVCamera()
|
||||
hr = _graphBuilder->ConnectDirect(_outputCapturePin, _inputDvPin, NULL);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to connect capture device to the dv devoder: %x",
|
||||
hr);
|
||||
return hr;
|
||||
@ -397,12 +397,12 @@ HRESULT VideoCaptureDS::ConnectDVCamera()
|
||||
{
|
||||
if (hr == HRESULT_FROM_WIN32(ERROR_TOO_MANY_OPEN_FILES))
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to connect the capture device, busy");
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
|
||||
"Failed to connect capture device to the send graph: 0x%x",
|
||||
hr);
|
||||
}
|
||||
|
||||
@ -27,9 +27,9 @@ class CaptureSinkFilter;
|
||||
class VideoCaptureDS: public VideoCaptureImpl
|
||||
{
|
||||
public:
|
||||
VideoCaptureDS(const int32_t id);
|
||||
VideoCaptureDS();
|
||||
|
||||
virtual int32_t Init(const int32_t id, const char* deviceUniqueIdUTF8);
|
||||
virtual int32_t Init(const char* deviceUniqueIdUTF8);
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
|
||||
@ -17,22 +17,20 @@ namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
|
||||
// static
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
|
||||
const int32_t id) {
|
||||
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
|
||||
// TODO(tommi): Use the Media Foundation version on Vista and up.
|
||||
return DeviceInfoDS::Create(id);
|
||||
return DeviceInfoDS::Create();
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
const int32_t id,
|
||||
const char* device_id) {
|
||||
if (device_id == nullptr)
|
||||
return nullptr;
|
||||
|
||||
// TODO(tommi): Use Media Foundation implementation for Vista and up.
|
||||
rtc::scoped_refptr<VideoCaptureDS> capture(
|
||||
new rtc::RefCountedObject<VideoCaptureDS>(id));
|
||||
if (capture->Init(id, device_id) != 0) {
|
||||
new rtc::RefCountedObject<VideoCaptureDS>());
|
||||
if (capture->Init(device_id) != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
|
||||
VideoCaptureMF::VideoCaptureMF(const int32_t id) : VideoCaptureImpl(id) {}
|
||||
VideoCaptureMF::VideoCaptureMF() {}
|
||||
VideoCaptureMF::~VideoCaptureMF() {}
|
||||
|
||||
int32_t VideoCaptureMF::Init(const int32_t id, const char* device_id) {
|
||||
int32_t VideoCaptureMF::Init(const char* device_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -22,9 +22,9 @@ namespace videocapturemodule {
|
||||
// for supported platforms.
|
||||
class VideoCaptureMF : public VideoCaptureImpl {
|
||||
public:
|
||||
explicit VideoCaptureMF(const int32_t id);
|
||||
VideoCaptureMF();
|
||||
|
||||
int32_t Init(const int32_t id, const char* device_id);
|
||||
int32_t Init(const char* device_id);
|
||||
|
||||
// Overrides from VideoCaptureImpl.
|
||||
virtual int32_t StartCapture(const VideoCaptureCapability& capability);
|
||||
|
||||
@ -20,7 +20,7 @@ VcmCapturer::VcmCapturer() : started_(false), sink_(nullptr), vcm_(NULL) {}
|
||||
|
||||
bool VcmCapturer::Init(size_t width, size_t height, size_t target_fps) {
|
||||
VideoCaptureModule::DeviceInfo* device_info =
|
||||
VideoCaptureFactory::CreateDeviceInfo(42); // Any ID (42) will do.
|
||||
VideoCaptureFactory::CreateDeviceInfo();
|
||||
|
||||
char device_name[256];
|
||||
char unique_name[256];
|
||||
@ -31,8 +31,8 @@ bool VcmCapturer::Init(size_t width, size_t height, size_t target_fps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
vcm_ = webrtc::VideoCaptureFactory::Create(0, unique_name);
|
||||
vcm_->RegisterCaptureDataCallback(*this);
|
||||
vcm_ = webrtc::VideoCaptureFactory::Create(unique_name);
|
||||
vcm_->RegisterCaptureDataCallback(this);
|
||||
|
||||
device_info->GetCapability(vcm_->CurrentDeviceName(), 0, capability_);
|
||||
delete device_info;
|
||||
@ -100,14 +100,11 @@ void VcmCapturer::Destroy() {
|
||||
|
||||
VcmCapturer::~VcmCapturer() { Destroy(); }
|
||||
|
||||
void VcmCapturer::OnIncomingCapturedFrame(const int32_t id,
|
||||
const VideoFrame& frame) {
|
||||
void VcmCapturer::OnFrame(const VideoFrame& frame) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (started_ && sink_)
|
||||
sink_->OnFrame(frame);
|
||||
}
|
||||
|
||||
void VcmCapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) {
|
||||
}
|
||||
} // test
|
||||
} // webrtc
|
||||
|
||||
@ -20,7 +20,9 @@
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
|
||||
class VcmCapturer
|
||||
: public VideoCapturer,
|
||||
public rtc::VideoSinkInterface<VideoFrame> {
|
||||
public:
|
||||
static VcmCapturer* Create(size_t width, size_t height, size_t target_fps);
|
||||
virtual ~VcmCapturer();
|
||||
@ -31,9 +33,7 @@ class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
|
||||
const rtc::VideoSinkWants& wants) override;
|
||||
void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
|
||||
|
||||
void OnIncomingCapturedFrame(const int32_t id,
|
||||
const VideoFrame& frame) override; // NOLINT
|
||||
void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override;
|
||||
void OnFrame(const VideoFrame& frame) override;
|
||||
|
||||
private:
|
||||
VcmCapturer();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user