Revert "Migrate modules/desktop_capture and modules/video_capture to webrtc::Mutex."
This reverts commit 44dd3d743517fe85212ba4f68bda1e78c2e6d7ec. Reason for revert: crbug.com/1104081 Original change's description: > Migrate modules/desktop_capture and modules/video_capture to webrtc::Mutex. > > Bug: webrtc:11567 > Change-Id: I7bfca17f91bf44151148f863480ce77804d53a04 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178805 > Commit-Queue: Markus Handell <handellm@webrtc.org> > Reviewed-by: Tommi <tommi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31681} TBR=tommi@webrtc.org,handellm@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:11567 Change-Id: I4ee39947ba206522bce611341caef84ddb538068 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179080 Reviewed-by: Markus Handell <handellm@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31702}
This commit is contained in:

committed by
Commit Bot

parent
0800010dd6
commit
1added5666
@ -480,7 +480,6 @@ rtc_library("desktop_capture_generic") {
|
|||||||
"../../api:scoped_refptr",
|
"../../api:scoped_refptr",
|
||||||
"../../rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
|
"../../rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base/synchronization:mutex",
|
|
||||||
"../../rtc_base/synchronization:rw_lock_wrapper",
|
"../../rtc_base/synchronization:rw_lock_wrapper",
|
||||||
"../../rtc_base/system:arch",
|
"../../rtc_base/system:arch",
|
||||||
"../../rtc_base/system:rtc_export",
|
"../../rtc_base/system:rtc_export",
|
||||||
|
@ -21,7 +21,7 @@ DesktopConfigurationMonitor::DesktopConfigurationMonitor() {
|
|||||||
DesktopConfigurationMonitor::DisplaysReconfiguredCallback, this);
|
DesktopConfigurationMonitor::DisplaysReconfiguredCallback, this);
|
||||||
if (err != kCGErrorSuccess)
|
if (err != kCGErrorSuccess)
|
||||||
RTC_LOG(LS_ERROR) << "CGDisplayRegisterReconfigurationCallback " << err;
|
RTC_LOG(LS_ERROR) << "CGDisplayRegisterReconfigurationCallback " << err;
|
||||||
MutexLock lock(&desktop_configuration_lock_);
|
rtc::CritScope cs(&desktop_configuration_lock_);
|
||||||
desktop_configuration_ = MacDesktopConfiguration::GetCurrent(
|
desktop_configuration_ = MacDesktopConfiguration::GetCurrent(
|
||||||
MacDesktopConfiguration::TopLeftOrigin);
|
MacDesktopConfiguration::TopLeftOrigin);
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ DesktopConfigurationMonitor::~DesktopConfigurationMonitor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MacDesktopConfiguration DesktopConfigurationMonitor::desktop_configuration() {
|
MacDesktopConfiguration DesktopConfigurationMonitor::desktop_configuration() {
|
||||||
MutexLock lock(&desktop_configuration_lock_);
|
rtc::CritScope crit(&desktop_configuration_lock_);
|
||||||
return desktop_configuration_;
|
return desktop_configuration_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ void DesktopConfigurationMonitor::DisplaysReconfigured(
|
|||||||
|
|
||||||
reconfiguring_displays_.erase(display);
|
reconfiguring_displays_.erase(display);
|
||||||
if (reconfiguring_displays_.empty()) {
|
if (reconfiguring_displays_.empty()) {
|
||||||
MutexLock lock(&desktop_configuration_lock_);
|
rtc::CritScope cs(&desktop_configuration_lock_);
|
||||||
desktop_configuration_ = MacDesktopConfiguration::GetCurrent(
|
desktop_configuration_ = MacDesktopConfiguration::GetCurrent(
|
||||||
MacDesktopConfiguration::TopLeftOrigin);
|
MacDesktopConfiguration::TopLeftOrigin);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "api/ref_counted_base.h"
|
#include "api/ref_counted_base.h"
|
||||||
#include "modules/desktop_capture/mac/desktop_configuration.h"
|
#include "modules/desktop_capture/mac/desktop_configuration.h"
|
||||||
#include "rtc_base/constructor_magic.h"
|
#include "rtc_base/constructor_magic.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/critical_section.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class DesktopConfigurationMonitor : public rtc::RefCountedBase {
|
|||||||
void DisplaysReconfigured(CGDirectDisplayID display,
|
void DisplaysReconfigured(CGDirectDisplayID display,
|
||||||
CGDisplayChangeSummaryFlags flags);
|
CGDisplayChangeSummaryFlags flags);
|
||||||
|
|
||||||
Mutex desktop_configuration_lock_;
|
rtc::CriticalSection desktop_configuration_lock_;
|
||||||
MacDesktopConfiguration desktop_configuration_
|
MacDesktopConfiguration desktop_configuration_
|
||||||
RTC_GUARDED_BY(&desktop_configuration_lock_);
|
RTC_GUARDED_BY(&desktop_configuration_lock_);
|
||||||
std::set<CGDirectDisplayID> reconfiguring_displays_;
|
std::set<CGDirectDisplayID> reconfiguring_displays_;
|
||||||
|
@ -85,14 +85,14 @@ void DxgiDuplicatorController::Release() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DxgiDuplicatorController::IsSupported() {
|
bool DxgiDuplicatorController::IsSupported() {
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
return Initialize();
|
return Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DxgiDuplicatorController::RetrieveD3dInfo(D3dInfo* info) {
|
bool DxgiDuplicatorController::RetrieveD3dInfo(D3dInfo* info) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
{
|
{
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
result = Initialize();
|
result = Initialize();
|
||||||
*info = d3d_info_;
|
*info = d3d_info_;
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ DxgiDuplicatorController::Result DxgiDuplicatorController::DuplicateMonitor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
DesktopVector DxgiDuplicatorController::dpi() {
|
DesktopVector DxgiDuplicatorController::dpi() {
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
if (Initialize()) {
|
if (Initialize()) {
|
||||||
return dpi_;
|
return dpi_;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ DesktopVector DxgiDuplicatorController::dpi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int DxgiDuplicatorController::ScreenCount() {
|
int DxgiDuplicatorController::ScreenCount() {
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
if (Initialize()) {
|
if (Initialize()) {
|
||||||
return ScreenCountUnlocked();
|
return ScreenCountUnlocked();
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ int DxgiDuplicatorController::ScreenCount() {
|
|||||||
|
|
||||||
bool DxgiDuplicatorController::GetDeviceNames(
|
bool DxgiDuplicatorController::GetDeviceNames(
|
||||||
std::vector<std::string>* output) {
|
std::vector<std::string>* output) {
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
if (Initialize()) {
|
if (Initialize()) {
|
||||||
GetDeviceNamesUnlocked(output);
|
GetDeviceNamesUnlocked(output);
|
||||||
return true;
|
return true;
|
||||||
@ -145,7 +145,7 @@ DxgiDuplicatorController::Result DxgiDuplicatorController::DoDuplicate(
|
|||||||
DxgiFrame* frame,
|
DxgiFrame* frame,
|
||||||
int monitor_id) {
|
int monitor_id) {
|
||||||
RTC_DCHECK(frame);
|
RTC_DCHECK(frame);
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
|
|
||||||
// The dxgi components and APIs do not update the screen resolution without
|
// The dxgi components and APIs do not update the screen resolution without
|
||||||
// a reinitialization. So we use the GetDC() function to retrieve the screen
|
// a reinitialization. So we use the GetDC() function to retrieve the screen
|
||||||
@ -198,12 +198,12 @@ DxgiDuplicatorController::Result DxgiDuplicatorController::DoDuplicate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DxgiDuplicatorController::Unload() {
|
void DxgiDuplicatorController::Unload() {
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
Deinitialize();
|
Deinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DxgiDuplicatorController::Unregister(const Context* const context) {
|
void DxgiDuplicatorController::Unregister(const Context* const context) {
|
||||||
MutexLock lock(&lock_);
|
rtc::CritScope lock(&lock_);
|
||||||
if (ContextExpired(context)) {
|
if (ContextExpired(context)) {
|
||||||
// The Context has not been setup after a recent initialization, so it
|
// The Context has not been setup after a recent initialization, so it
|
||||||
// should not been registered in duplicators.
|
// should not been registered in duplicators.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "modules/desktop_capture/win/dxgi_adapter_duplicator.h"
|
#include "modules/desktop_capture/win/dxgi_adapter_duplicator.h"
|
||||||
#include "modules/desktop_capture/win/dxgi_context.h"
|
#include "modules/desktop_capture/win/dxgi_context.h"
|
||||||
#include "modules/desktop_capture/win/dxgi_frame.h"
|
#include "modules/desktop_capture/win/dxgi_frame.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/critical_section.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ class DxgiDuplicatorController {
|
|||||||
std::atomic_int refcount_;
|
std::atomic_int refcount_;
|
||||||
|
|
||||||
// This lock must be locked whenever accessing any of the following objects.
|
// This lock must be locked whenever accessing any of the following objects.
|
||||||
Mutex lock_;
|
rtc::CriticalSection lock_;
|
||||||
|
|
||||||
// A self-incremented integer to compare with the one in Context. It ensures
|
// A self-incremented integer to compare with the one in Context. It ensures
|
||||||
// a Context instance is always initialized after DxgiDuplicatorController.
|
// a Context instance is always initialized after DxgiDuplicatorController.
|
||||||
|
@ -36,7 +36,6 @@ rtc_library("video_capture_module") {
|
|||||||
"../../media:rtc_media_base",
|
"../../media:rtc_media_base",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base:stringutils",
|
"../../rtc_base:stringutils",
|
||||||
"../../rtc_base/synchronization:mutex",
|
|
||||||
"../../rtc_base/synchronization:rw_lock_wrapper",
|
"../../rtc_base/synchronization:rw_lock_wrapper",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
"//third_party/libyuv",
|
"//third_party/libyuv",
|
||||||
@ -52,7 +51,6 @@ if (!build_with_chromium) {
|
|||||||
"../../api:scoped_refptr",
|
"../../api:scoped_refptr",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base/synchronization:mutex",
|
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -131,7 +129,6 @@ if (!build_with_chromium) {
|
|||||||
"../../api/video:video_rtp_headers",
|
"../../api/video:video_rtp_headers",
|
||||||
"../../common_video",
|
"../../common_video",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base/synchronization:mutex",
|
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
"../../test:frame_utils",
|
"../../test:frame_utils",
|
||||||
"../../test:test_main",
|
"../../test:test_main",
|
||||||
|
@ -115,7 +115,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&_captureCritSect);
|
||||||
// first open /dev/video device
|
// first open /dev/video device
|
||||||
char device[20];
|
char device[20];
|
||||||
sprintf(device, "/dev/video%d", (int)_deviceId);
|
sprintf(device, "/dev/video%d", (int)_deviceId);
|
||||||
@ -264,7 +264,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
|
|||||||
int32_t VideoCaptureModuleV4L2::StopCapture() {
|
int32_t VideoCaptureModuleV4L2::StopCapture() {
|
||||||
if (_captureThread) {
|
if (_captureThread) {
|
||||||
{
|
{
|
||||||
MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&_captureCritSect);
|
||||||
quit_ = true;
|
quit_ = true;
|
||||||
}
|
}
|
||||||
// Make sure the capture thread stop stop using the critsect.
|
// Make sure the capture thread stop stop using the critsect.
|
||||||
@ -272,7 +272,7 @@ int32_t VideoCaptureModuleV4L2::StopCapture() {
|
|||||||
_captureThread.reset();
|
_captureThread.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&_captureCritSect);
|
||||||
if (_captureStarted) {
|
if (_captureStarted) {
|
||||||
_captureStarted = false;
|
_captureStarted = false;
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&_captureCritSect);
|
||||||
|
|
||||||
if (quit_) {
|
if (quit_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "modules/video_capture/video_capture_defines.h"
|
#include "modules/video_capture/video_capture_defines.h"
|
||||||
#include "modules/video_capture/video_capture_impl.h"
|
#include "modules/video_capture/video_capture_impl.h"
|
||||||
|
#include "rtc_base/critical_section.h"
|
||||||
#include "rtc_base/platform_thread.h"
|
#include "rtc_base/platform_thread.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace videocapturemodule {
|
namespace videocapturemodule {
|
||||||
@ -43,8 +43,8 @@ class VideoCaptureModuleV4L2 : public VideoCaptureImpl {
|
|||||||
|
|
||||||
// TODO(pbos): Stop using unique_ptr and resetting the thread.
|
// TODO(pbos): Stop using unique_ptr and resetting the thread.
|
||||||
std::unique_ptr<rtc::PlatformThread> _captureThread;
|
std::unique_ptr<rtc::PlatformThread> _captureThread;
|
||||||
Mutex capture_lock_;
|
rtc::CriticalSection _captureCritSect;
|
||||||
bool quit_ RTC_GUARDED_BY(capture_lock_);
|
bool quit_ RTC_GUARDED_BY(_captureCritSect);
|
||||||
int32_t _deviceId;
|
int32_t _deviceId;
|
||||||
int32_t _deviceFd;
|
int32_t _deviceFd;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
#include "modules/utility/include/process_thread.h"
|
#include "modules/utility/include/process_thread.h"
|
||||||
#include "modules/video_capture/video_capture_factory.h"
|
#include "modules/video_capture/video_capture_factory.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/critical_section.h"
|
||||||
#include "rtc_base/time_utils.h"
|
#include "rtc_base/time_utils.h"
|
||||||
#include "system_wrappers/include/sleep.h"
|
#include "system_wrappers/include/sleep.h"
|
||||||
#include "test/frame_utils.h"
|
#include "test/frame_utils.h"
|
||||||
@ -74,7 +74,7 @@ class TestVideoCaptureCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OnFrame(const webrtc::VideoFrame& videoFrame) override {
|
void OnFrame(const webrtc::VideoFrame& videoFrame) override {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
int height = videoFrame.height();
|
int height = videoFrame.height();
|
||||||
int width = videoFrame.width();
|
int width = videoFrame.width();
|
||||||
#if defined(WEBRTC_ANDROID) && WEBRTC_ANDROID
|
#if defined(WEBRTC_ANDROID) && WEBRTC_ANDROID
|
||||||
@ -106,38 +106,38 @@ class TestVideoCaptureCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetExpectedCapability(VideoCaptureCapability capability) {
|
void SetExpectedCapability(VideoCaptureCapability capability) {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
capability_ = capability;
|
capability_ = capability;
|
||||||
incoming_frames_ = 0;
|
incoming_frames_ = 0;
|
||||||
last_render_time_ms_ = 0;
|
last_render_time_ms_ = 0;
|
||||||
}
|
}
|
||||||
int incoming_frames() {
|
int incoming_frames() {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
return incoming_frames_;
|
return incoming_frames_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int timing_warnings() {
|
int timing_warnings() {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
return timing_warnings_;
|
return timing_warnings_;
|
||||||
}
|
}
|
||||||
VideoCaptureCapability capability() {
|
VideoCaptureCapability capability() {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
return capability_;
|
return capability_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompareLastFrame(const webrtc::VideoFrame& frame) {
|
bool CompareLastFrame(const webrtc::VideoFrame& frame) {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
return webrtc::test::FrameBufsEqual(last_frame_,
|
return webrtc::test::FrameBufsEqual(last_frame_,
|
||||||
frame.video_frame_buffer());
|
frame.video_frame_buffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetExpectedCaptureRotation(webrtc::VideoRotation rotation) {
|
void SetExpectedCaptureRotation(webrtc::VideoRotation rotation) {
|
||||||
webrtc::MutexLock lock(&capture_lock_);
|
rtc::CritScope cs(&capture_cs_);
|
||||||
rotate_frame_ = rotation;
|
rotate_frame_ = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
webrtc::Mutex capture_lock_;
|
rtc::CriticalSection capture_cs_;
|
||||||
VideoCaptureCapability capability_;
|
VideoCaptureCapability capability_;
|
||||||
int64_t last_render_time_ms_;
|
int64_t last_render_time_ms_;
|
||||||
int incoming_frames_;
|
int incoming_frames_;
|
||||||
|
@ -96,12 +96,12 @@ VideoCaptureImpl::~VideoCaptureImpl() {
|
|||||||
|
|
||||||
void VideoCaptureImpl::RegisterCaptureDataCallback(
|
void VideoCaptureImpl::RegisterCaptureDataCallback(
|
||||||
rtc::VideoSinkInterface<VideoFrame>* dataCallBack) {
|
rtc::VideoSinkInterface<VideoFrame>* dataCallBack) {
|
||||||
MutexLock lock(&api_lock_);
|
rtc::CritScope cs(&_apiCs);
|
||||||
_dataCallBack = dataCallBack;
|
_dataCallBack = dataCallBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoCaptureImpl::DeRegisterCaptureDataCallback() {
|
void VideoCaptureImpl::DeRegisterCaptureDataCallback() {
|
||||||
MutexLock lock(&api_lock_);
|
rtc::CritScope cs(&_apiCs);
|
||||||
_dataCallBack = NULL;
|
_dataCallBack = NULL;
|
||||||
}
|
}
|
||||||
int32_t VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame) {
|
int32_t VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame) {
|
||||||
@ -118,7 +118,7 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
|
|||||||
size_t videoFrameLength,
|
size_t videoFrameLength,
|
||||||
const VideoCaptureCapability& frameInfo,
|
const VideoCaptureCapability& frameInfo,
|
||||||
int64_t captureTime /*=0*/) {
|
int64_t captureTime /*=0*/) {
|
||||||
MutexLock lock(&api_lock_);
|
rtc::CritScope cs(&_apiCs);
|
||||||
|
|
||||||
const int32_t width = frameInfo.width;
|
const int32_t width = frameInfo.width;
|
||||||
const int32_t height = frameInfo.height;
|
const int32_t height = frameInfo.height;
|
||||||
@ -223,7 +223,7 @@ int32_t VideoCaptureImpl::CaptureSettings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t VideoCaptureImpl::SetCaptureRotation(VideoRotation rotation) {
|
int32_t VideoCaptureImpl::SetCaptureRotation(VideoRotation rotation) {
|
||||||
MutexLock lock(&api_lock_);
|
rtc::CritScope cs(&_apiCs);
|
||||||
_rotateFrame = rotation;
|
_rotateFrame = rotation;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "modules/video_capture/video_capture.h"
|
#include "modules/video_capture/video_capture.h"
|
||||||
#include "modules/video_capture/video_capture_config.h"
|
#include "modules/video_capture/video_capture_config.h"
|
||||||
#include "modules/video_capture/video_capture_defines.h"
|
#include "modules/video_capture/video_capture_defines.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/critical_section.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class VideoCaptureImpl : public VideoCaptureModule {
|
|||||||
~VideoCaptureImpl() override;
|
~VideoCaptureImpl() override;
|
||||||
|
|
||||||
char* _deviceUniqueId; // current Device unique name;
|
char* _deviceUniqueId; // current Device unique name;
|
||||||
Mutex api_lock_;
|
rtc::CriticalSection _apiCs;
|
||||||
VideoCaptureCapability _requestedCapability; // Should be set by platform
|
VideoCaptureCapability _requestedCapability; // Should be set by platform
|
||||||
// dependent code in
|
// dependent code in
|
||||||
// StartCapture.
|
// StartCapture.
|
||||||
|
@ -130,7 +130,7 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t VideoCaptureDS::StartCapture(const VideoCaptureCapability& capability) {
|
int32_t VideoCaptureDS::StartCapture(const VideoCaptureCapability& capability) {
|
||||||
MutexLock lock(&api_lock_);
|
rtc::CritScope cs(&_apiCs);
|
||||||
|
|
||||||
if (capability != _requestedCapability) {
|
if (capability != _requestedCapability) {
|
||||||
DisconnectGraph();
|
DisconnectGraph();
|
||||||
@ -148,7 +148,7 @@ int32_t VideoCaptureDS::StartCapture(const VideoCaptureCapability& capability) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t VideoCaptureDS::StopCapture() {
|
int32_t VideoCaptureDS::StopCapture() {
|
||||||
MutexLock lock(&api_lock_);
|
rtc::CritScope cs(&_apiCs);
|
||||||
|
|
||||||
HRESULT hr = _mediaControl->Pause();
|
HRESULT hr = _mediaControl->Pause();
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
|
Reference in New Issue
Block a user