(Auto)update libjingle 72839629-> 72847605
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6854 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -35,19 +35,14 @@
|
||||
#include "webrtc/base/windowpicker.h"
|
||||
#include "webrtc/base/windowpickerfactory.h"
|
||||
#include "talk/media/base/mediacommon.h"
|
||||
#include "talk/media/base/videocapturerfactory.h"
|
||||
#include "talk/media/devices/deviceinfo.h"
|
||||
#include "talk/media/devices/filevideocapturer.h"
|
||||
#include "talk/media/devices/yuvframescapturer.h"
|
||||
|
||||
#if defined(HAVE_WEBRTC_VIDEO)
|
||||
#include "talk/media/webrtc/webrtcvideocapturer.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_WEBRTC_VIDEO)
|
||||
#define VIDEO_CAPTURER_NAME WebRtcVideoCapturer
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WEBRTC_VIDEO
|
||||
#include "talk/media/webrtc/webrtcvideocapturerfactory.h"
|
||||
#endif // HAVE_WEBRTC_VIDEO
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -64,29 +59,12 @@ namespace cricket {
|
||||
// Initialize to empty string.
|
||||
const char DeviceManagerInterface::kDefaultDeviceName[] = "";
|
||||
|
||||
class DefaultVideoCapturerFactory : public VideoCapturerFactory {
|
||||
public:
|
||||
DefaultVideoCapturerFactory() {}
|
||||
virtual ~DefaultVideoCapturerFactory() {}
|
||||
|
||||
VideoCapturer* Create(const Device& device) {
|
||||
#if defined(VIDEO_CAPTURER_NAME)
|
||||
VIDEO_CAPTURER_NAME* return_value = new VIDEO_CAPTURER_NAME;
|
||||
if (!return_value->Init(device)) {
|
||||
delete return_value;
|
||||
return NULL;
|
||||
}
|
||||
return return_value;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
DeviceManager::DeviceManager()
|
||||
: initialized_(false),
|
||||
device_video_capturer_factory_(new DefaultVideoCapturerFactory),
|
||||
window_picker_(rtc::WindowPickerFactory::CreateWindowPicker()) {
|
||||
#ifdef HAVE_WEBRTC_VIDEO
|
||||
SetVideoDeviceCapturerFactory(new WebRtcVideoDeviceCapturerFactory());
|
||||
#endif // HAVE_WEBRTC_VIDEO
|
||||
}
|
||||
|
||||
DeviceManager::~DeviceManager() {
|
||||
@@ -212,12 +190,16 @@ void DeviceManager::ClearVideoCaptureDeviceMaxFormat(
|
||||
}
|
||||
|
||||
VideoCapturer* DeviceManager::CreateVideoCapturer(const Device& device) const {
|
||||
VideoCapturer* capturer = ConstructFakeVideoCapturer(device);
|
||||
VideoCapturer* capturer = MaybeConstructFakeVideoCapturer(device);
|
||||
if (capturer) {
|
||||
return capturer;
|
||||
}
|
||||
|
||||
capturer = device_video_capturer_factory_->Create(device);
|
||||
if (!video_device_capturer_factory_) {
|
||||
LOG(LS_ERROR) << "No video capturer factory for devices.";
|
||||
return NULL;
|
||||
}
|
||||
capturer = video_device_capturer_factory_->Create(device);
|
||||
if (!capturer) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -231,7 +213,7 @@ VideoCapturer* DeviceManager::CreateVideoCapturer(const Device& device) const {
|
||||
return capturer;
|
||||
}
|
||||
|
||||
VideoCapturer* DeviceManager::ConstructFakeVideoCapturer(
|
||||
VideoCapturer* DeviceManager::MaybeConstructFakeVideoCapturer(
|
||||
const Device& device) const {
|
||||
// TODO(hellner): Throw out the creation of a file video capturer once the
|
||||
// refactoring is completed.
|
||||
@@ -262,19 +244,6 @@ bool DeviceManager::GetWindows(
|
||||
return window_picker_->GetWindowList(descriptions);
|
||||
}
|
||||
|
||||
VideoCapturer* DeviceManager::CreateWindowCapturer(rtc::WindowId window) {
|
||||
#if defined(WINDOW_CAPTURER_NAME)
|
||||
WINDOW_CAPTURER_NAME* window_capturer = new WINDOW_CAPTURER_NAME();
|
||||
if (!window_capturer->Init(window)) {
|
||||
delete window_capturer;
|
||||
return NULL;
|
||||
}
|
||||
return window_capturer;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DeviceManager::GetDesktops(
|
||||
std::vector<rtc::DesktopDescription>* descriptions) {
|
||||
if (!window_picker_) {
|
||||
@@ -283,18 +252,13 @@ bool DeviceManager::GetDesktops(
|
||||
return window_picker_->GetDesktopList(descriptions);
|
||||
}
|
||||
|
||||
VideoCapturer* DeviceManager::CreateDesktopCapturer(
|
||||
rtc::DesktopId desktop) {
|
||||
#if defined(DESKTOP_CAPTURER_NAME)
|
||||
DESKTOP_CAPTURER_NAME* desktop_capturer = new DESKTOP_CAPTURER_NAME();
|
||||
if (!desktop_capturer->Init(desktop.index())) {
|
||||
delete desktop_capturer;
|
||||
VideoCapturer* DeviceManager::CreateScreenCapturer(
|
||||
const ScreencastId& screenid) const {
|
||||
if (!screen_capturer_factory_) {
|
||||
LOG(LS_ERROR) << "No video capturer factory for screens.";
|
||||
return NULL;
|
||||
}
|
||||
return desktop_capturer;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
return screen_capturer_factory_->Create(screenid);
|
||||
}
|
||||
|
||||
bool DeviceManager::GetAudioDevices(bool input,
|
||||
|
||||
Reference in New Issue
Block a user