Split video_capture_module specific implementation (external vs internal capture)

into its own targets. Dependencies must link directly with the desired one.

Targets linking with libjingle_media:
 - internal implementation when build_with_chromium=0, default otherwise.

Targets linking with default/external capture implementation:
 - anything dependent on webrtc_test_common
 - anything dependent on video_engine_core

Targets linking with internal capture implementation:
 - vie_auto_test
 - anything dependent on webrtc_test_renderer

GN changes:
 - Not many since there is almost no test definitions.

TESTED: passes all the bots. If this inadvertently breaks a target please fix the linking rules so the target has the desired implementation linked in.

BUG=3768
R=glaznev@webrtc.org
TBR=kjellander@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/24589004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7209 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andresp@webrtc.org 2014-09-17 11:50:19 +00:00
parent 85ef770d92
commit a74eda1b6f
9 changed files with 272 additions and 239 deletions

View File

@ -396,7 +396,6 @@
'dependencies': [ 'dependencies': [
'<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv', '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
'<(DEPTH)/third_party/usrsctp/usrsctp.gyp:usrsctplib', '<(DEPTH)/third_party/usrsctp/usrsctp.gyp:usrsctplib',
'<(webrtc_root)/modules/modules.gyp:video_capture_module',
'<(webrtc_root)/modules/modules.gyp:video_render_module', '<(webrtc_root)/modules/modules.gyp:video_render_module',
'<(webrtc_root)/webrtc.gyp:webrtc', '<(webrtc_root)/webrtc.gyp:webrtc',
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine', '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
@ -499,6 +498,15 @@
'media/webrtc/webrtcvoiceengine.h', 'media/webrtc/webrtcvoiceengine.h',
], ],
'conditions': [ 'conditions': [
['build_with_chromium==1', {
'dependencies': [
'<(webrtc_root)/modules/modules.gyp:video_capture_module_impl',
],
}, {
'dependencies': [
'<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl',
],
}],
['OS=="linux"', { ['OS=="linux"', {
'sources': [ 'sources': [
'media/devices/gtkvideorenderer.cc', 'media/devices/gtkvideorenderer.cc',

View File

@ -132,9 +132,6 @@
# Exclude internal ADM since Chromium uses its own IO handling. # Exclude internal ADM since Chromium uses its own IO handling.
'include_internal_audio_device%': 0, 'include_internal_audio_device%': 0,
# Exclude internal VCM in Chromium build.
'include_internal_video_capture%': 0,
# Exclude internal video render module in Chromium build. # Exclude internal video render module in Chromium build.
'include_internal_video_render%': 0, 'include_internal_video_render%': 0,
}, { # Settings for the standalone (not-in-Chromium) build. }, { # Settings for the standalone (not-in-Chromium) build.
@ -145,7 +142,6 @@
'include_pulse_audio%': 1, 'include_pulse_audio%': 1,
'include_internal_audio_device%': 1, 'include_internal_audio_device%': 1,
'include_internal_video_capture%': 1,
'include_internal_video_render%': 1, 'include_internal_video_render%': 1,
}], }],
['build_with_libjingle==1', { ['build_with_libjingle==1', {

View File

@ -74,9 +74,6 @@ declare_args() {
# Exclude internal ADM since Chromium uses its own IO handling. # Exclude internal ADM since Chromium uses its own IO handling.
rtc_include_internal_audio_device = false rtc_include_internal_audio_device = false
# Exclude internal VCM in Chromium build.
rtc_include_internal_video_capture = false
# Exclude internal video render module in Chromium build. # Exclude internal video render module in Chromium build.
rtc_include_internal_video_render = false rtc_include_internal_video_render = false
} else { } else {
@ -89,7 +86,6 @@ declare_args() {
rtc_include_pulse_audio = true rtc_include_pulse_audio = true
rtc_include_internal_audio_device = true rtc_include_internal_audio_device = true
rtc_include_internal_video_capture = true
rtc_include_internal_video_render = true rtc_include_internal_video_render = true
} }

View File

@ -8,16 +8,10 @@
import("../../build/webrtc.gni") import("../../build/webrtc.gni")
config("video_capture_config") { # Note this target is missing an implementation for the video capture.
if (is_ios) { # Targets must link with either 'video_capture_impl' or
libs = [ # 'video_capture_internal_impl' depending on whether they want to
"AVFoundation.framework", # use the internal capturer.
"CoreMedia.framework",
"CoreVideo.framework",
]
}
}
source_set("video_capture") { source_set("video_capture") {
sources = [ sources = [
"device_info_impl.cc", "device_info_impl.cc",
@ -32,12 +26,53 @@ source_set("video_capture") {
"video_capture_impl.h", "video_capture_impl.h",
] ]
libs = [] deps = [
deps = [] "../../common_video",
"../../system_wrappers",
"../utility",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
}
source_set("video_capture_impl") {
sources = [
"external/device_info_external.cc",
"external/video_capture_external.cc",
]
deps = [
":video_capture",
]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
}
config("video_capture_internal_impl_config") {
if (is_ios) {
libs = [
"AVFoundation.framework",
"CoreMedia.framework",
"CoreVideo.framework",
]
}
}
source_set("video_capture_internal_impl") {
deps = [
":video_capture",
]
if (rtc_include_internal_video_capture) {
if (is_linux) { if (is_linux) {
sources += [ sources = [
"linux/device_info_linux.cc", "linux/device_info_linux.cc",
"linux/device_info_linux.h", "linux/device_info_linux.h",
"linux/video_capture_linux.cc", "linux/video_capture_linux.cc",
@ -45,7 +80,7 @@ source_set("video_capture") {
] ]
} }
if (is_mac) { if (is_mac) {
sources += [ sources = [
"mac/qtkit/video_capture_qtkit.h", "mac/qtkit/video_capture_qtkit.h",
"mac/qtkit/video_capture_qtkit.mm", "mac/qtkit/video_capture_qtkit.mm",
"mac/qtkit/video_capture_qtkit_info.h", "mac/qtkit/video_capture_qtkit_info.h",
@ -58,13 +93,13 @@ source_set("video_capture") {
"mac/video_capture_mac.mm", "mac/video_capture_mac.mm",
] ]
libs += [ libs = [
"CoreVideo.framework", "CoreVideo.framework",
"QTKit.framework", "QTKit.framework",
] ]
} }
if (is_win) { if (is_win) {
sources += [ sources = [
"windows/device_info_ds.cc", "windows/device_info_ds.cc",
"windows/device_info_ds.h", "windows/device_info_ds.h",
"windows/device_info_mf.cc", "windows/device_info_mf.cc",
@ -80,11 +115,12 @@ source_set("video_capture") {
"windows/video_capture_mf.h", "windows/video_capture_mf.h",
] ]
libs += [ "Strmiids.lib" ] libs = [ "Strmiids.lib" ]
deps += [ "//third_party/winsdk_samples"] deps += [ "//third_party/winsdk_samples"]
} }
if (is_android) { if (is_android) {
sources += [ sources = [
"android/device_info_android.cc", "android/device_info_android.cc",
"android/device_info_android.h", "android/device_info_android.h",
"android/video_capture_android.cc", "android/video_capture_android.cc",
@ -97,7 +133,7 @@ source_set("video_capture") {
] ]
} }
if (is_ios) { if (is_ios) {
sources += [ sources = [
"ios/device_info_ios.h", "ios/device_info_ios.h",
"ios/device_info_ios.mm", "ios/device_info_ios.mm",
"ios/device_info_ios_objc.h", "ios/device_info_ios_objc.h",
@ -108,7 +144,7 @@ source_set("video_capture") {
"ios/video_capture_ios.mm", "ios/video_capture_ios.mm",
] ]
cflags += [ cflags = [
"-fobjc-arc", # CLANG_ENABLE_OBJC_ARC = YES. "-fobjc-arc", # CLANG_ENABLE_OBJC_ARC = YES.
# To avoid warnings for deprecated videoMinFrameDuration and # To avoid warnings for deprecated videoMinFrameDuration and
# videoMaxFrameDuration properties in iOS 7.0. # videoMaxFrameDuration properties in iOS 7.0.
@ -116,24 +152,12 @@ source_set("video_capture") {
"-Wno-deprecated-declarations", "-Wno-deprecated-declarations",
] ]
} }
} else {
sources += [
"external/device_info_external.cc",
"external/video_capture_external.cc",
]
}
all_dependent_configs = [ ":video_capture_config"] all_dependent_configs = [ ":video_capture_internal_impl_config" ]
if (is_clang) { if (is_clang) {
# Suppress warnings from Chrome's Clang plugins. # Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details. # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ] configs -= [ "//build/config/clang:find_bad_constructs" ]
} }
deps += [
"../../common_video",
"../../system_wrappers",
"../utility",
]
} }

View File

@ -9,6 +9,10 @@
{ {
'targets': [ 'targets': [
{ {
# Note this library is missing an implementation for the video capture.
# Targets must link with either 'video_capture_module_impl' or
# 'video_capture_module_internal_impl' depending on whether they want to
# use the internal capturer.
'target_name': 'video_capture_module', 'target_name': 'video_capture_module',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
@ -28,13 +32,26 @@
'video_capture_impl.cc', 'video_capture_impl.cc',
'video_capture_impl.h', 'video_capture_impl.h',
], ],
'conditions': [ },
['include_internal_video_capture==0', { {
# Default video capture module implementation that only supports external
# capture.
'target_name': 'video_capture_module_impl',
'type': 'static_library',
'dependencies': [
'video_capture_module',
],
'sources': [ 'sources': [
'external/device_info_external.cc', 'external/device_info_external.cc',
'external/video_capture_external.cc', 'external/video_capture_external.cc',
], ],
}, { # include_internal_video_capture == 1 },
{
'target_name': 'video_capture_module_internal_impl',
'type': 'static_library',
'dependencies': [
'video_capture_module',
],
'conditions': [ 'conditions': [
['OS=="linux"', { ['OS=="linux"', {
'sources': [ 'sources': [
@ -136,20 +153,9 @@
}, },
}], # ios }], # ios
], # conditions ], # conditions
}], # include_internal_video_capture }
], # conditions
},
], ],
'conditions': [ 'conditions': [
['include_tests==1 and OS=="android"', {
# Use WebRTC capture code for Android APK tests that are built from a
# Chromium checkout. Normally when built as a part of Chromium the
# Chromium video capture code is used. This overrides the default in
# webrtc/build/common.gypi.
'variables': {
'include_internal_video_capture': 1,
},
}],
['include_tests==1', { ['include_tests==1', {
'targets': [ 'targets': [
{ {
@ -157,6 +163,7 @@
'type': '<(gtest_target_type)', 'type': '<(gtest_target_type)',
'dependencies': [ 'dependencies': [
'video_capture_module', 'video_capture_module',
'video_capture_module_internal_impl',
'webrtc_utility', 'webrtc_utility',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gtest.gyp:gtest',

View File

@ -59,7 +59,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags', '<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/modules/modules.gyp:media_file', '<(webrtc_root)/modules/modules.gyp:media_file',
'<(webrtc_root)/modules/modules.gyp:video_capture_module', '<(webrtc_root)/modules/modules.gyp:video_capture_module_impl',
'<(webrtc_root)/test/test.gyp:frame_generator', '<(webrtc_root)/test/test.gyp:frame_generator',
'<(webrtc_root)/test/test.gyp:test_support', '<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/webrtc.gyp:webrtc', '<(webrtc_root)/webrtc.gyp:webrtc',
@ -107,7 +107,7 @@
], ],
'dependencies': [ 'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/modules/modules.gyp:video_capture_module', '<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl',
'<(webrtc_root)/modules/modules.gyp:media_file', '<(webrtc_root)/modules/modules.gyp:media_file',
'<(webrtc_root)/test/test.gyp:frame_generator', '<(webrtc_root)/test/test.gyp:frame_generator',
'<(webrtc_root)/test/test.gyp:test_support', '<(webrtc_root)/test/test.gyp:test_support',

View File

@ -15,7 +15,7 @@
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/modules/modules.gyp:video_render_module', '<(webrtc_root)/modules/modules.gyp:video_render_module',
'<(webrtc_root)/modules/modules.gyp:video_capture_module', '<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl',
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine', '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
'<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags', '<(DEPTH)/third_party/gflags/gflags.gyp:gflags',

View File

@ -122,6 +122,7 @@
'type': '<(gtest_target_type)', 'type': '<(gtest_target_type)',
'dependencies': [ 'dependencies': [
'video_engine_core', 'video_engine_core',
'<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl',
'<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/testing/gmock.gyp:gmock', '<(DEPTH)/testing/gmock.gyp:gmock',
'<(webrtc_root)/test/test.gyp:test_support_main', '<(webrtc_root)/test/test.gyp:test_support_main',

View File

@ -15,6 +15,7 @@
'type': 'loadable_module', 'type': 'loadable_module',
'dependencies': [ 'dependencies': [
'<(DEPTH)/third_party/icu/icu.gyp:icuuc', '<(DEPTH)/third_party/icu/icu.gyp:icuuc',
'<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/test/test.gyp:channel_transport', '<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core', '<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core',