From a74eda1b6f25234198dc5ebf433dc78c718a77e0 Mon Sep 17 00:00:00 2001 From: "andresp@webrtc.org" Date: Wed, 17 Sep 2014 11:50:19 +0000 Subject: [PATCH] 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 --- talk/libjingle.gyp | 10 +- webrtc/build/common.gypi | 4 - webrtc/build/webrtc.gni | 4 - webrtc/modules/video_capture/BUILD.gn | 240 +++++++++-------- .../modules/video_capture/video_capture.gypi | 245 +++++++++--------- webrtc/test/webrtc_test_common.gyp | 4 +- .../test/auto_test/vie_auto_test.gypi | 2 +- webrtc/video_engine/video_engine_core.gypi | 1 + webrtc/webrtc_examples.gyp | 1 + 9 files changed, 272 insertions(+), 239 deletions(-) diff --git a/talk/libjingle.gyp b/talk/libjingle.gyp index 9b5ac592a..281499915 100755 --- a/talk/libjingle.gyp +++ b/talk/libjingle.gyp @@ -396,7 +396,6 @@ 'dependencies': [ '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv', '<(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)/webrtc.gyp:webrtc', '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine', @@ -499,6 +498,15 @@ 'media/webrtc/webrtcvoiceengine.h', ], '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"', { 'sources': [ 'media/devices/gtkvideorenderer.cc', diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index 4b17eb4de..728760092 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -132,9 +132,6 @@ # Exclude internal ADM since Chromium uses its own IO handling. 'include_internal_audio_device%': 0, - # Exclude internal VCM in Chromium build. - 'include_internal_video_capture%': 0, - # Exclude internal video render module in Chromium build. 'include_internal_video_render%': 0, }, { # Settings for the standalone (not-in-Chromium) build. @@ -145,7 +142,6 @@ 'include_pulse_audio%': 1, 'include_internal_audio_device%': 1, - 'include_internal_video_capture%': 1, 'include_internal_video_render%': 1, }], ['build_with_libjingle==1', { diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni index d46b8c649..5e3adfaa2 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -74,9 +74,6 @@ declare_args() { # Exclude internal ADM since Chromium uses its own IO handling. 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. rtc_include_internal_video_render = false } else { @@ -89,7 +86,6 @@ declare_args() { rtc_include_pulse_audio = true rtc_include_internal_audio_device = true - rtc_include_internal_video_capture = true rtc_include_internal_video_render = true } diff --git a/webrtc/modules/video_capture/BUILD.gn b/webrtc/modules/video_capture/BUILD.gn index 7d6ddc0e8..563227388 100644 --- a/webrtc/modules/video_capture/BUILD.gn +++ b/webrtc/modules/video_capture/BUILD.gn @@ -8,16 +8,10 @@ import("../../build/webrtc.gni") -config("video_capture_config") { - if (is_ios) { - libs = [ - "AVFoundation.framework", - "CoreMedia.framework", - "CoreVideo.framework", - ] - } -} - +# Note this target is missing an implementation for the video capture. +# Targets must link with either 'video_capture_impl' or +# 'video_capture_internal_impl' depending on whether they want to +# use the internal capturer. source_set("video_capture") { sources = [ "device_info_impl.cc", @@ -32,108 +26,138 @@ source_set("video_capture") { "video_capture_impl.h", ] - libs = [] - deps = [] - - if (rtc_include_internal_video_capture) { - if (is_linux) { - sources += [ - "linux/device_info_linux.cc", - "linux/device_info_linux.h", - "linux/video_capture_linux.cc", - "linux/video_capture_linux.h", - ] - } - if (is_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", - ] - - libs += [ - "CoreVideo.framework", - "QTKit.framework", - ] - } - if (is_win) { - 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", - ] - - libs += [ "Strmiids.lib" ] - 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", - ] - } - } else { - sources += [ - "external/device_info_external.cc", - "external/video_capture_external.cc", - ] - } - - all_dependent_configs = [ ":video_capture_config"] + 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 (is_linux) { + sources = [ + "linux/device_info_linux.cc", + "linux/device_info_linux.h", + "linux/video_capture_linux.cc", + "linux/video_capture_linux.h", + ] + } + if (is_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", + ] + + libs = [ + "CoreVideo.framework", + "QTKit.framework", + ] + } + if (is_win) { + 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", + ] + + libs = [ "Strmiids.lib" ] + + 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) { # 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" ] } - - deps += [ - "../../common_video", - "../../system_wrappers", - "../utility", - ] } diff --git a/webrtc/modules/video_capture/video_capture.gypi b/webrtc/modules/video_capture/video_capture.gypi index 68d419680..1843405e0 100644 --- a/webrtc/modules/video_capture/video_capture.gypi +++ b/webrtc/modules/video_capture/video_capture.gypi @@ -9,6 +9,10 @@ { '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', 'type': 'static_library', 'dependencies': [ @@ -28,128 +32,130 @@ 'video_capture_impl.cc', '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': [ - ['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', { 'targets': [ { @@ -157,6 +163,7 @@ 'type': '<(gtest_target_type)', 'dependencies': [ 'video_capture_module', + 'video_capture_module_internal_impl', 'webrtc_utility', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(DEPTH)/testing/gtest.gyp:gtest', diff --git a/webrtc/test/webrtc_test_common.gyp b/webrtc/test/webrtc_test_common.gyp index be6b303f8..9d7cfce51 100644 --- a/webrtc/test/webrtc_test_common.gyp +++ b/webrtc/test/webrtc_test_common.gyp @@ -59,7 +59,7 @@ '<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', '<(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:test_support', '<(webrtc_root)/webrtc.gyp:webrtc', @@ -107,7 +107,7 @@ ], 'dependencies': [ '<(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)/test/test.gyp:frame_generator', '<(webrtc_root)/test/test.gyp:test_support', diff --git a/webrtc/video_engine/test/auto_test/vie_auto_test.gypi b/webrtc/video_engine/test/auto_test/vie_auto_test.gypi index 962916607..602908496 100644 --- a/webrtc/video_engine/test/auto_test/vie_auto_test.gypi +++ b/webrtc/video_engine/test/auto_test/vie_auto_test.gypi @@ -15,7 +15,7 @@ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(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_capture_module', + '<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl', '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine', '<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', diff --git a/webrtc/video_engine/video_engine_core.gypi b/webrtc/video_engine/video_engine_core.gypi index 8ce252347..ffe63c563 100644 --- a/webrtc/video_engine/video_engine_core.gypi +++ b/webrtc/video_engine/video_engine_core.gypi @@ -122,6 +122,7 @@ 'type': '<(gtest_target_type)', 'dependencies': [ 'video_engine_core', + '<(webrtc_root)/modules/modules.gyp:video_capture_module_internal_impl', '<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gmock.gyp:gmock', '<(webrtc_root)/test/test.gyp:test_support_main', diff --git a/webrtc/webrtc_examples.gyp b/webrtc/webrtc_examples.gyp index 8d8e2277f..f4e3f6f75 100644 --- a/webrtc/webrtc_examples.gyp +++ b/webrtc/webrtc_examples.gyp @@ -15,6 +15,7 @@ 'type': 'loadable_module', 'dependencies': [ '<(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)/test/test.gyp:channel_transport', '<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core',