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,108 +26,138 @@ source_set("video_capture") {
"video_capture_impl.h", "video_capture_impl.h",
] ]
libs = [] deps = [
deps = [] "../../common_video",
"../../system_wrappers",
if (rtc_include_internal_video_capture) { "../utility",
if (is_linux) { ]
sources += [
"linux/device_info_linux.cc", if (is_clang) {
"linux/device_info_linux.h", # Suppress warnings from Chrome's Clang plugins.
"linux/video_capture_linux.cc", # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
"linux/video_capture_linux.h", configs -= [ "//build/config/clang:find_bad_constructs" ]
] }
} }
if (is_mac) {
sources += [ source_set("video_capture_impl") {
"mac/qtkit/video_capture_qtkit.h", sources = [
"mac/qtkit/video_capture_qtkit.mm", "external/device_info_external.cc",
"mac/qtkit/video_capture_qtkit_info.h", "external/video_capture_external.cc",
"mac/qtkit/video_capture_qtkit_info.mm", ]
"mac/qtkit/video_capture_qtkit_info_objc.h",
"mac/qtkit/video_capture_qtkit_info_objc.mm", deps = [
"mac/qtkit/video_capture_qtkit_objc.h", ":video_capture",
"mac/qtkit/video_capture_qtkit_objc.mm", ]
"mac/qtkit/video_capture_qtkit_utility.h",
"mac/video_capture_mac.mm", if (is_clang) {
] # Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
libs += [ configs -= [ "//build/config/clang:find_bad_constructs" ]
"CoreVideo.framework", }
"QTKit.framework", }
]
} config("video_capture_internal_impl_config") {
if (is_win) { if (is_ios) {
sources += [ libs = [
"windows/device_info_ds.cc", "AVFoundation.framework",
"windows/device_info_ds.h", "CoreMedia.framework",
"windows/device_info_mf.cc", "CoreVideo.framework",
"windows/device_info_mf.h", ]
"windows/help_functions_ds.cc", }
"windows/help_functions_ds.h", }
"windows/sink_filter_ds.cc",
"windows/sink_filter_ds.h", source_set("video_capture_internal_impl") {
"windows/video_capture_ds.cc", deps = [
"windows/video_capture_ds.h", ":video_capture",
"windows/video_capture_factory_windows.cc", ]
"windows/video_capture_mf.cc",
"windows/video_capture_mf.h", if (is_linux) {
] sources = [
"linux/device_info_linux.cc",
libs += [ "Strmiids.lib" ] "linux/device_info_linux.h",
deps += [ "//third_party/winsdk_samples"] "linux/video_capture_linux.cc",
} "linux/video_capture_linux.h",
if (is_android) { ]
sources += [ }
"android/device_info_android.cc", if (is_mac) {
"android/device_info_android.h", sources = [
"android/video_capture_android.cc", "mac/qtkit/video_capture_qtkit.h",
"android/video_capture_android.h", "mac/qtkit/video_capture_qtkit.mm",
] "mac/qtkit/video_capture_qtkit_info.h",
"mac/qtkit/video_capture_qtkit_info.mm",
deps += [ "mac/qtkit/video_capture_qtkit_info_objc.h",
"//third_party/icu:icuuc", "mac/qtkit/video_capture_qtkit_info_objc.mm",
"//third_party/jsoncpp", "mac/qtkit/video_capture_qtkit_objc.h",
] "mac/qtkit/video_capture_qtkit_objc.mm",
} "mac/qtkit/video_capture_qtkit_utility.h",
if (is_ios) { "mac/video_capture_mac.mm",
sources += [ ]
"ios/device_info_ios.h",
"ios/device_info_ios.mm", libs = [
"ios/device_info_ios_objc.h", "CoreVideo.framework",
"ios/device_info_ios_objc.mm", "QTKit.framework",
"ios/rtc_video_capture_ios_objc.h", ]
"ios/rtc_video_capture_ios_objc.mm", }
"ios/video_capture_ios.h", if (is_win) {
"ios/video_capture_ios.mm", sources = [
] "windows/device_info_ds.cc",
"windows/device_info_ds.h",
cflags += [ "windows/device_info_mf.cc",
"-fobjc-arc", # CLANG_ENABLE_OBJC_ARC = YES. "windows/device_info_mf.h",
# To avoid warnings for deprecated videoMinFrameDuration and "windows/help_functions_ds.cc",
# videoMaxFrameDuration properties in iOS 7.0. "windows/help_functions_ds.h",
# See webrtc:3705 for more details. "windows/sink_filter_ds.cc",
"-Wno-deprecated-declarations", "windows/sink_filter_ds.h",
] "windows/video_capture_ds.cc",
} "windows/video_capture_ds.h",
} else { "windows/video_capture_factory_windows.cc",
sources += [ "windows/video_capture_mf.cc",
"external/device_info_external.cc", "windows/video_capture_mf.h",
"external/video_capture_external.cc", ]
]
} libs = [ "Strmiids.lib" ]
all_dependent_configs = [ ":video_capture_config"] deps += [ "//third_party/winsdk_samples"]
}
if (is_android) {
sources = [
"android/device_info_android.cc",
"android/device_info_android.h",
"android/video_capture_android.cc",
"android/video_capture_android.h",
]
deps += [
"//third_party/icu:icuuc",
"//third_party/jsoncpp",
]
}
if (is_ios) {
sources = [
"ios/device_info_ios.h",
"ios/device_info_ios.mm",
"ios/device_info_ios_objc.h",
"ios/device_info_ios_objc.mm",
"ios/rtc_video_capture_ios_objc.h",
"ios/rtc_video_capture_ios_objc.mm",
"ios/video_capture_ios.h",
"ios/video_capture_ios.mm",
]
cflags = [
"-fobjc-arc", # CLANG_ENABLE_OBJC_ARC = YES.
# To avoid warnings for deprecated videoMinFrameDuration and
# videoMaxFrameDuration properties in iOS 7.0.
# See webrtc:3705 for more details.
"-Wno-deprecated-declarations",
]
}
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,128 +32,130 @@
'video_capture_impl.cc', 'video_capture_impl.cc',
'video_capture_impl.h', 'video_capture_impl.h',
], ],
'conditions': [
['include_internal_video_capture==0', {
'sources': [
'external/device_info_external.cc',
'external/video_capture_external.cc',
],
}, { # include_internal_video_capture == 1
'conditions': [
['OS=="linux"', {
'sources': [
'linux/device_info_linux.cc',
'linux/device_info_linux.h',
'linux/video_capture_linux.cc',
'linux/video_capture_linux.h',
],
}], # linux
['OS=="mac"', {
'sources': [
'mac/qtkit/video_capture_qtkit.h',
'mac/qtkit/video_capture_qtkit.mm',
'mac/qtkit/video_capture_qtkit_info.h',
'mac/qtkit/video_capture_qtkit_info.mm',
'mac/qtkit/video_capture_qtkit_info_objc.h',
'mac/qtkit/video_capture_qtkit_info_objc.mm',
'mac/qtkit/video_capture_qtkit_objc.h',
'mac/qtkit/video_capture_qtkit_objc.mm',
'mac/qtkit/video_capture_qtkit_utility.h',
'mac/video_capture_mac.mm',
],
'link_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework Cocoa',
'-framework CoreVideo',
'-framework QTKit',
],
},
},
}], # mac
['OS=="win"', {
'dependencies': [
'<(DEPTH)/third_party/winsdk_samples/winsdk_samples.gyp:directshow_baseclasses',
],
'sources': [
'windows/device_info_ds.cc',
'windows/device_info_ds.h',
'windows/device_info_mf.cc',
'windows/device_info_mf.h',
'windows/help_functions_ds.cc',
'windows/help_functions_ds.h',
'windows/sink_filter_ds.cc',
'windows/sink_filter_ds.h',
'windows/video_capture_ds.cc',
'windows/video_capture_ds.h',
'windows/video_capture_factory_windows.cc',
'windows/video_capture_mf.cc',
'windows/video_capture_mf.h',
],
'link_settings': {
'libraries': [
'-lStrmiids.lib',
],
},
}], # win
['OS=="android"', {
'dependencies': [
'<(DEPTH)/third_party/icu/icu.gyp:icuuc',
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
],
'sources': [
'android/device_info_android.cc',
'android/device_info_android.h',
'android/video_capture_android.cc',
'android/video_capture_android.h',
],
}], # android
['OS=="ios"', {
'sources': [
'ios/device_info_ios.h',
'ios/device_info_ios.mm',
'ios/device_info_ios_objc.h',
'ios/device_info_ios_objc.mm',
'ios/rtc_video_capture_ios_objc.h',
'ios/rtc_video_capture_ios_objc.mm',
'ios/video_capture_ios.h',
'ios/video_capture_ios.mm',
],
'xcode_settings': {
'CLANG_ENABLE_OBJC_ARC': 'YES',
'WARNING_CFLAGS': [
# To avoid warnings for deprecated videoMinFrameDuration and
# videoMaxFrameDuration properties in iOS 7.0.
# See webrtc:3705 for more details.
'-Wno-deprecated-declarations',
],
},
'all_dependent_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework AVFoundation',
'-framework CoreMedia',
'-framework CoreVideo',
'-framework UIKit',
],
},
},
}], # ios
], # conditions
}], # include_internal_video_capture
], # conditions
}, },
{
# Default video capture module implementation that only supports external
# capture.
'target_name': 'video_capture_module_impl',
'type': 'static_library',
'dependencies': [
'video_capture_module',
],
'sources': [
'external/device_info_external.cc',
'external/video_capture_external.cc',
],
},
{
'target_name': 'video_capture_module_internal_impl',
'type': 'static_library',
'dependencies': [
'video_capture_module',
],
'conditions': [
['OS=="linux"', {
'sources': [
'linux/device_info_linux.cc',
'linux/device_info_linux.h',
'linux/video_capture_linux.cc',
'linux/video_capture_linux.h',
],
}], # linux
['OS=="mac"', {
'sources': [
'mac/qtkit/video_capture_qtkit.h',
'mac/qtkit/video_capture_qtkit.mm',
'mac/qtkit/video_capture_qtkit_info.h',
'mac/qtkit/video_capture_qtkit_info.mm',
'mac/qtkit/video_capture_qtkit_info_objc.h',
'mac/qtkit/video_capture_qtkit_info_objc.mm',
'mac/qtkit/video_capture_qtkit_objc.h',
'mac/qtkit/video_capture_qtkit_objc.mm',
'mac/qtkit/video_capture_qtkit_utility.h',
'mac/video_capture_mac.mm',
],
'link_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework Cocoa',
'-framework CoreVideo',
'-framework QTKit',
],
},
},
}], # mac
['OS=="win"', {
'dependencies': [
'<(DEPTH)/third_party/winsdk_samples/winsdk_samples.gyp:directshow_baseclasses',
],
'sources': [
'windows/device_info_ds.cc',
'windows/device_info_ds.h',
'windows/device_info_mf.cc',
'windows/device_info_mf.h',
'windows/help_functions_ds.cc',
'windows/help_functions_ds.h',
'windows/sink_filter_ds.cc',
'windows/sink_filter_ds.h',
'windows/video_capture_ds.cc',
'windows/video_capture_ds.h',
'windows/video_capture_factory_windows.cc',
'windows/video_capture_mf.cc',
'windows/video_capture_mf.h',
],
'link_settings': {
'libraries': [
'-lStrmiids.lib',
],
},
}], # win
['OS=="android"', {
'dependencies': [
'<(DEPTH)/third_party/icu/icu.gyp:icuuc',
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
],
'sources': [
'android/device_info_android.cc',
'android/device_info_android.h',
'android/video_capture_android.cc',
'android/video_capture_android.h',
],
}], # android
['OS=="ios"', {
'sources': [
'ios/device_info_ios.h',
'ios/device_info_ios.mm',
'ios/device_info_ios_objc.h',
'ios/device_info_ios_objc.mm',
'ios/rtc_video_capture_ios_objc.h',
'ios/rtc_video_capture_ios_objc.mm',
'ios/video_capture_ios.h',
'ios/video_capture_ios.mm',
],
'xcode_settings': {
'CLANG_ENABLE_OBJC_ARC': 'YES',
'WARNING_CFLAGS': [
# To avoid warnings for deprecated videoMinFrameDuration and
# videoMaxFrameDuration properties in iOS 7.0.
# See webrtc:3705 for more details.
'-Wno-deprecated-declarations',
],
},
'all_dependent_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework AVFoundation',
'-framework CoreMedia',
'-framework CoreVideo',
'-framework UIKit',
],
},
},
}], # ios
], # 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',