mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 572c610328c6 (bug 1036653)
This commit is contained in:
parent
c02d94c3e2
commit
ef13e7eb48
@ -2062,8 +2062,7 @@ WindowsHashToArrayFunc (const uint64_t& aId,
|
||||
nsRefPtr<GetUserMediaCallbackMediaStreamListener> listener =
|
||||
aData->ElementAt(i);
|
||||
if (listener->CapturingVideo() || listener->CapturingAudio() ||
|
||||
listener->CapturingScreen() || listener->CapturingWindow() ||
|
||||
listener->CapturingApplication()) {
|
||||
listener->CapturingScreen() || listener->CapturingWindow()) {
|
||||
capturing = true;
|
||||
break;
|
||||
}
|
||||
@ -2148,8 +2147,7 @@ MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVide
|
||||
if (listener->CapturingScreen()) {
|
||||
*aScreenShare = true;
|
||||
}
|
||||
if (listener->CapturingWindow() || listener->CapturingApplication()) {
|
||||
// treat window and application as the same
|
||||
if (listener->CapturingWindow()) {
|
||||
*aWindowShare = true;
|
||||
}
|
||||
}
|
||||
|
@ -130,12 +130,6 @@ public:
|
||||
return mVideoSource && !mStopped && !mVideoSource->IsAvailable() &&
|
||||
mVideoSource->GetMediaSource() == MediaSourceType::Window;
|
||||
}
|
||||
bool CapturingApplication()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
return mVideoSource && !mStopped && !mVideoSource->IsAvailable() &&
|
||||
mVideoSource->GetMediaSource() == MediaSourceType::Application;
|
||||
}
|
||||
|
||||
void SetStopped()
|
||||
{
|
||||
|
103
media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_device_info.cc
Executable file → Normal file
103
media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_device_info.cc
Executable file → Normal file
@ -103,7 +103,7 @@ void DesktopApplication::setProcessPathName(const char *appPathNameUTF8) {
|
||||
}
|
||||
|
||||
void DesktopApplication::setUniqueIdName(const char *appUniqueIdUTF8) {
|
||||
SetStringMember(&processUniqueIdUTF8_, appUniqueIdUTF8);
|
||||
SetStringMember(&processPathNameUTF8_, appUniqueIdUTF8);
|
||||
}
|
||||
|
||||
void DesktopApplication::setProcessAppName(const char *appNameUTF8) {
|
||||
@ -119,7 +119,7 @@ const char *DesktopApplication::getProcessPathName() {
|
||||
}
|
||||
|
||||
const char *DesktopApplication::getUniqueIdName() {
|
||||
return processUniqueIdUTF8_;
|
||||
return applicationNameUTF8_;
|
||||
}
|
||||
|
||||
const char *DesktopApplication::getProcessAppName() {
|
||||
@ -139,7 +139,29 @@ DesktopDeviceInfoImpl::DesktopDeviceInfoImpl() {
|
||||
}
|
||||
|
||||
DesktopDeviceInfoImpl::~DesktopDeviceInfoImpl() {
|
||||
CleanUp();
|
||||
std::map<intptr_t,DesktopDisplayDevice*>::iterator iterDevice;
|
||||
for (iterDevice=desktop_display_list_.begin(); iterDevice!=desktop_display_list_.end(); iterDevice++){
|
||||
DesktopDisplayDevice * pDesktopDisplayDevice = iterDevice->second;
|
||||
delete pDesktopDisplayDevice;
|
||||
iterDevice->second = NULL;
|
||||
}
|
||||
desktop_display_list_.clear();
|
||||
|
||||
std::map<intptr_t, DesktopDisplayDevice *>::iterator iterWindow;
|
||||
for (iterWindow = desktop_window_list_.begin(); iterWindow != desktop_window_list_.end(); iterWindow++) {
|
||||
DesktopDisplayDevice * pWindow = iterWindow->second;
|
||||
delete pWindow;
|
||||
iterWindow->second = NULL;
|
||||
}
|
||||
desktop_window_list_.clear();
|
||||
|
||||
std::map<intptr_t,DesktopApplication*>::iterator iterApp;
|
||||
for (iterApp=desktop_application_list_.begin(); iterApp!=desktop_application_list_.end(); iterApp++){
|
||||
DesktopApplication * pDesktopApplication = iterApp->second;
|
||||
delete pDesktopApplication;
|
||||
iterApp->second = NULL;
|
||||
}
|
||||
desktop_application_list_.clear();
|
||||
}
|
||||
|
||||
int32_t DesktopDeviceInfoImpl::getDisplayDeviceCount() {
|
||||
@ -202,36 +224,7 @@ int32_t DesktopDeviceInfoImpl::getApplicationInfo(int32_t nIndex,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoImpl::CleanUp() {
|
||||
CleanUpScreenList();
|
||||
CleanUpWindowList();
|
||||
CleanUpApplicationList();
|
||||
}
|
||||
int32_t DesktopDeviceInfoImpl::Init() {
|
||||
InitializeScreenList();
|
||||
InitializeWindowList();
|
||||
InitializeApplicationList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
int32_t DesktopDeviceInfoImpl::Refresh() {
|
||||
RefreshScreenList();
|
||||
RefreshWindowList();
|
||||
RefreshApplicationList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoImpl::CleanUpWindowList() {
|
||||
std::map<intptr_t, DesktopDisplayDevice *>::iterator iterWindow;
|
||||
for (iterWindow = desktop_window_list_.begin(); iterWindow != desktop_window_list_.end(); iterWindow++) {
|
||||
DesktopDisplayDevice *pWindow = iterWindow->second;
|
||||
delete pWindow;
|
||||
iterWindow->second = NULL;
|
||||
}
|
||||
desktop_window_list_.clear();
|
||||
}
|
||||
void DesktopDeviceInfoImpl::InitializeWindowList() {
|
||||
int32_t DesktopDeviceInfoImpl::initializeWindowList() {
|
||||
scoped_ptr<WindowCapturer> pWinCap(WindowCapturer::Create());
|
||||
WindowCapturer::WindowList list;
|
||||
if (pWinCap && pWinCap->GetWindowList(&list)) {
|
||||
@ -247,45 +240,29 @@ void DesktopDeviceInfoImpl::InitializeWindowList() {
|
||||
|
||||
char idStr[BUFSIZ];
|
||||
#if XP_WIN
|
||||
_snprintf_s(idStr, sizeof(idStr), sizeof(idStr) - 1, "%ld", pWinDevice->getScreenId());
|
||||
_snprintf_s(idStr, sizeof(idStr), sizeof(idStr) - 1, "\\win\\%ld", pWinDevice->getScreenId());
|
||||
#else
|
||||
snprintf(idStr, sizeof(idStr), "%ld", pWinDevice->getScreenId());
|
||||
snprintf(idStr, sizeof(idStr), "\\win\\%ld", pWinDevice->getScreenId());
|
||||
#endif
|
||||
pWinDevice->setUniqueIdName(idStr);
|
||||
desktop_window_list_[pWinDevice->getScreenId()] = pWinDevice;
|
||||
}
|
||||
}
|
||||
}
|
||||
void DesktopDeviceInfoImpl::RefreshWindowList() {
|
||||
CleanUpWindowList();
|
||||
InitializeWindowList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoImpl::CleanUpApplicationList() {
|
||||
std::map<intptr_t,DesktopApplication*>::iterator iterApp;
|
||||
for (iterApp = desktop_application_list_.begin(); iterApp != desktop_application_list_.end(); iterApp++){
|
||||
DesktopApplication *pDesktopApplication = iterApp->second;
|
||||
delete pDesktopApplication;
|
||||
iterApp->second = NULL;
|
||||
int32_t DesktopDeviceInfoImpl::RefreshWindowList() {
|
||||
std::map<intptr_t, DesktopDisplayDevice *>::iterator iterWindow;
|
||||
for (iterWindow = desktop_window_list_.begin(); iterWindow != desktop_window_list_.end(); iterWindow++) {
|
||||
DesktopDisplayDevice * pWindow = iterWindow->second;
|
||||
delete pWindow;
|
||||
iterWindow->second = NULL;
|
||||
}
|
||||
desktop_application_list_.clear();
|
||||
}
|
||||
void DesktopDeviceInfoImpl::RefreshApplicationList() {
|
||||
CleanUpApplicationList();
|
||||
InitializeApplicationList();
|
||||
desktop_window_list_.clear();
|
||||
initializeWindowList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoImpl::CleanUpScreenList() {
|
||||
std::map<intptr_t,DesktopDisplayDevice*>::iterator iterDevice;
|
||||
for (iterDevice=desktop_display_list_.begin(); iterDevice != desktop_display_list_.end(); iterDevice++){
|
||||
DesktopDisplayDevice *pDesktopDisplayDevice = iterDevice->second;
|
||||
delete pDesktopDisplayDevice;
|
||||
iterDevice->second = NULL;
|
||||
}
|
||||
desktop_display_list_.clear();
|
||||
}
|
||||
void DesktopDeviceInfoImpl::RefreshScreenList() {
|
||||
CleanUpScreenList();
|
||||
InitializeScreenList();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DEVICE_INFO_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DEVICE_INFO_H_
|
||||
@ -81,8 +81,6 @@ public:
|
||||
DesktopDeviceInfoImpl();
|
||||
~DesktopDeviceInfoImpl();
|
||||
|
||||
virtual int32_t Init();
|
||||
virtual int32_t Refresh();
|
||||
virtual int32_t getDisplayDeviceCount();
|
||||
virtual int32_t getDesktopDisplayDeviceInfo(int32_t nIndex,
|
||||
DesktopDisplayDevice & desktopDisplayDevice);
|
||||
@ -94,24 +92,14 @@ public:
|
||||
DesktopApplication & desktopApplication);
|
||||
|
||||
static DesktopDeviceInfo * Create();
|
||||
|
||||
protected:
|
||||
DesktopDisplayDeviceList desktop_display_list_;
|
||||
DesktopDisplayDeviceList desktop_window_list_;
|
||||
DesktopApplicationList desktop_application_list_;
|
||||
|
||||
void CleanUp();
|
||||
void CleanUpWindowList();
|
||||
void CleanUpApplicationList();
|
||||
void CleanUpScreenList();
|
||||
|
||||
void InitializeWindowList();
|
||||
virtual void InitializeApplicationList() = 0;
|
||||
virtual void InitializeScreenList() = 0;
|
||||
|
||||
void RefreshWindowList();
|
||||
void RefreshApplicationList();
|
||||
void RefreshScreenList();
|
||||
|
||||
int32_t initializeWindowList();
|
||||
int32_t RefreshWindowList();
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -11,9 +11,8 @@ public:
|
||||
DesktopDeviceInfoNull();
|
||||
~DesktopDeviceInfoNull();
|
||||
|
||||
protected:
|
||||
virtual void InitializeScreenList();
|
||||
virtual void InitializeApplicationList();
|
||||
virtual int32_t Init();
|
||||
virtual int32_t Refresh();
|
||||
};
|
||||
|
||||
DesktopDeviceInfo * DesktopDeviceInfoImpl::Create() {
|
||||
@ -31,12 +30,15 @@ DesktopDeviceInfoNull::DesktopDeviceInfoNull() {
|
||||
DesktopDeviceInfoNull::~DesktopDeviceInfoNull() {
|
||||
}
|
||||
|
||||
void
|
||||
DesktopDeviceInfoNull::InitializeScreenList() {
|
||||
int32_t
|
||||
DesktopDeviceInfoNull::Init() {
|
||||
initializeWindowList();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
DesktopDeviceInfoNull::InitializeApplicationList() {
|
||||
int32_t
|
||||
DesktopDeviceInfoNull::Refresh() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} //namespace webrtc
|
||||
|
@ -361,22 +361,24 @@ int32_t DesktopCaptureImpl::ChangeUniqueId(const int32_t id) {
|
||||
|
||||
int32_t DesktopCaptureImpl::Init(const char* uniqueId,
|
||||
const CaptureDeviceType type) {
|
||||
DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault();
|
||||
// Leave desktop effects enabled during WebRTC captures.
|
||||
options.set_disable_effects(false);
|
||||
|
||||
if (type == Application) {
|
||||
AppCapturer *pAppCapturer = AppCapturer::Create(options);
|
||||
AppCapturer *pAppCapturer = AppCapturer::Create();
|
||||
if (!pAppCapturer) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ProcessId pid = atoi(uniqueId);
|
||||
pAppCapturer->SelectApp(pid);
|
||||
// processid hard-coded until implemented. See Bug 1036653
|
||||
ProcessId processid = 0;
|
||||
pAppCapturer->SelectApp(processid);
|
||||
|
||||
MouseCursorMonitor *pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(options, webrtc::kFullDesktopScreenId);
|
||||
MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(webrtc::DesktopCaptureOptions::CreateDefault(), webrtc::kFullDesktopScreenId);
|
||||
desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pAppCapturer, pMouseCursorMonitor));
|
||||
} else if (type == Screen) {
|
||||
|
||||
DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault();
|
||||
// Leave desktop effects enabled during WebRTC captures.
|
||||
options.set_disable_effects(false);
|
||||
|
||||
ScreenCapturer *pScreenCapturer = ScreenCapturer::Create(options);
|
||||
if (!pScreenCapturer) {
|
||||
return -1;
|
||||
@ -386,7 +388,7 @@ int32_t DesktopCaptureImpl::Init(const char* uniqueId,
|
||||
pScreenCapturer->SelectScreen(screenid);
|
||||
pScreenCapturer->SetMouseShapeObserver(this);
|
||||
|
||||
MouseCursorMonitor *pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(options, screenid);
|
||||
MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(options, screenid);
|
||||
desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pScreenCapturer, pMouseCursorMonitor));
|
||||
} else if (type == Window) {
|
||||
WindowCapturer *pWindowCapturer = WindowCapturer::Create();
|
||||
@ -394,11 +396,19 @@ int32_t DesktopCaptureImpl::Init(const char* uniqueId,
|
||||
return -1;
|
||||
}
|
||||
|
||||
WindowId winId = atoi(uniqueId);
|
||||
std::string idStr(uniqueId);
|
||||
const std::string prefix("\\win\\");
|
||||
if (idStr.substr(0, prefix.size()) != prefix) {
|
||||
delete pWindowCapturer;
|
||||
// invalid id
|
||||
return -1;
|
||||
}
|
||||
WindowId winId;
|
||||
winId = atoi(idStr.substr(prefix.size()).c_str());
|
||||
pWindowCapturer->SelectWindow(winId);
|
||||
|
||||
MouseCursorMonitor *pMouseCursorMonitor = MouseCursorMonitor::CreateForWindow(webrtc::DesktopCaptureOptions::CreateDefault(), winId);
|
||||
desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pWindowCapturer, pMouseCursorMonitor));
|
||||
MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForWindow(webrtc::DesktopCaptureOptions::CreateDefault(), winId);
|
||||
desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pWindowCapturer,pMouseCursorMonitor));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user