Bug 983504 - ViECapturer changes for screen sharing. r=jesup

This commit is contained in:
Gian-Carlo Pascutto 2014-07-08 05:49:00 +02:00
parent 64aba35255
commit fbee1627ac
3 changed files with 39 additions and 4 deletions

View File

@ -47,6 +47,19 @@ struct CaptureCapability {
}
};
enum CaptureDeviceType {
Camera = 0,
Screen = 1,
Application = 2,
Window = 3
};
struct CaptureDeviceInfo {
CaptureDeviceType type;
CaptureDeviceInfo() : type(CaptureDeviceType::Camera) {}
CaptureDeviceInfo(CaptureDeviceType t) : type(t) {}
};
// This enumerator tells the current brightness alarm mode.
enum Brightness {
Normal = 0,

View File

@ -27,6 +27,7 @@
#include "webrtc/video_engine/overuse_frame_detector.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_encoder.h"
#include "webrtc/video_engine/desktop_capture_impl.h"
namespace webrtc {
@ -61,7 +62,8 @@ ViECapturer::ViECapturer(int capture_id,
observer_(NULL),
overuse_detector_(new OveruseFrameDetector(Clock::GetRealTimeClock(),
kNormalUseStdDevMs,
kOveruseStdDevMs)) {
kOveruseStdDevMs)),
config_(config) {
WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id, capture_id),
"ViECapturer::ViECapturer(capture_id: %d, engine_id: %d)",
capture_id, engine_id);
@ -166,12 +168,30 @@ ViECapturer* ViECapturer::CreateViECapture(
int32_t ViECapturer::Init(const char* device_unique_idUTF8,
uint32_t device_unique_idUTF8Length) {
assert(capture_module_ == NULL);
if (device_unique_idUTF8 == NULL) {
CaptureDeviceType type = config_.Get<CaptureDeviceInfo>().type;
if(type != CaptureDeviceType::Camera) {
#if !defined(ANDROID)
switch (type) {
case CaptureDeviceType::Screen:
capture_module_ = DesktopCaptureImpl::Create(
ViEModuleId(engine_id_, capture_id_), device_unique_idUTF8, false);
break;
case CaptureDeviceType::Application:
capture_module_ = DesktopCaptureImpl::Create(
ViEModuleId(engine_id_, capture_id_), device_unique_idUTF8, true);
break;
default:
// all other non-camera types are not supported
return -1;
}
#endif
} else if (device_unique_idUTF8 == NULL) {
capture_module_ = VideoCaptureFactory::Create(
ViEModuleId(engine_id_, capture_id_), external_capture_module_);
ViEModuleId(engine_id_, capture_id_), external_capture_module_);
} else {
capture_module_ = VideoCaptureFactory::Create(
ViEModuleId(engine_id_, capture_id_), device_unique_idUTF8);
ViEModuleId(engine_id_, capture_id_), device_unique_idUTF8);
}
if (!capture_module_) {
return -1;

View File

@ -25,6 +25,7 @@
#include "webrtc/video_engine/include/vie_capture.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_frame_provider_base.h"
#include "webrtc/common.h"
namespace webrtc {
@ -191,6 +192,7 @@ class ViECapturer
CaptureCapability requested_capability_;
scoped_ptr<OveruseFrameDetector> overuse_detector_;
const Config & config_;
};
} // namespace webrtc