Eliminate defines in talk/

Replace LINUX, OSX and IOS defines with WEBRTC_ prefixed versions.
Remove no longer used defines from talk/build/common.gypi due to
previously migrated sources (into webrtc/p2p and webrtc/libjingle).

When this is rolled into Chromium, we can also clean up the platform
defines in
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/libjingle/libjingle.gyp

NOTRY=True
BUG=webrtc:5420
TESTED=Ran all compile trybots with --clobber flag.
TBR=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1588453005

Cr-Commit-Position: refs/heads/master@{#11254}
This commit is contained in:
kjellander
2016-01-14 11:01:09 -08:00
committed by Commit bot
parent 3542013f58
commit fcfc804e43
12 changed files with 30 additions and 40 deletions

View File

@ -60,17 +60,9 @@
'../../webrtc', '../../webrtc',
], ],
'defines': [ 'defines': [
'EXPAT_RELATIVE_PATH',
'FEATURE_ENABLE_VOICEMAIL',
'GTEST_RELATIVE_PATH',
'JSONCPP_RELATIVE_PATH',
'LOGGING=1',
'SRTP_RELATIVE_PATH', 'SRTP_RELATIVE_PATH',
# Feature selection # Feature selection
'FEATURE_ENABLE_SSL',
'FEATURE_ENABLE_VOICEMAIL',
'FEATURE_ENABLE_PSTN',
'HAVE_SCTP', 'HAVE_SCTP',
'HAVE_SRTP', 'HAVE_SRTP',
'HAVE_WEBRTC_VIDEO', 'HAVE_WEBRTC_VIDEO',
@ -79,7 +71,6 @@
'conditions': [ 'conditions': [
['OS=="linux"', { ['OS=="linux"', {
'defines': [ 'defines': [
'LINUX',
'WEBRTC_LINUX', 'WEBRTC_LINUX',
], ],
# Remove Chromium's disabling of the -Wformat warning. # Remove Chromium's disabling of the -Wformat warning.
@ -111,7 +102,6 @@
}], }],
['OS=="mac"', { ['OS=="mac"', {
'defines': [ 'defines': [
'OSX',
'WEBRTC_MAC', 'WEBRTC_MAC',
], ],
}], }],
@ -128,7 +118,6 @@
}], }],
['OS=="ios"', { ['OS=="ios"', {
'defines': [ 'defines': [
'IOS',
'WEBRTC_MAC', 'WEBRTC_MAC',
'WEBRTC_IOS', 'WEBRTC_IOS',
], ],

View File

@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_ #ifndef TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_
#define TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_ #define TALK_MEDIA_BASE_EXECUTABLEHELPERS_H_
#ifdef OSX #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#endif #endif
@ -62,15 +62,15 @@ inline Pathname GetExecutablePath() {
#else // UNICODE #else // UNICODE
rtc::Pathname path(exe_path_buffer); rtc::Pathname path(exe_path_buffer);
#endif // UNICODE #endif // UNICODE
#elif defined(OSX) || defined(LINUX) #elif (defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)) || defined(WEBRTC_LINUX)
char exe_path_buffer[kMaxExePathSize]; char exe_path_buffer[kMaxExePathSize];
#ifdef OSX #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
uint32_t copied_length = kMaxExePathSize - 1; uint32_t copied_length = kMaxExePathSize - 1;
if (_NSGetExecutablePath(exe_path_buffer, &copied_length) == -1) { if (_NSGetExecutablePath(exe_path_buffer, &copied_length) == -1) {
LOG(LS_ERROR) << "Buffer too small"; LOG(LS_ERROR) << "Buffer too small";
return rtc::Pathname(); return rtc::Pathname();
} }
#elif defined LINUX #elif defined WEBRTC_LINUX
int32_t copied_length = kMaxExePathSize - 1; int32_t copied_length = kMaxExePathSize - 1;
const char* kProcExeFmt = "/proc/%d/exe"; const char* kProcExeFmt = "/proc/%d/exe";
char proc_exe_link[40]; char proc_exe_link[40];
@ -86,11 +86,11 @@ inline Pathname GetExecutablePath() {
return rtc::Pathname(); return rtc::Pathname();
} }
exe_path_buffer[copied_length] = '\0'; exe_path_buffer[copied_length] = '\0';
#endif // LINUX #endif // WEBRTC_LINUX
rtc::Pathname path(exe_path_buffer); rtc::Pathname path(exe_path_buffer);
#else // Android || IOS #else // Android || iOS
rtc::Pathname path; rtc::Pathname path;
#endif // OSX || LINUX #endif // Mac || Linux
return path; return path;
} }

View File

@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_MEDIAENGINE_H_ #ifndef TALK_MEDIA_BASE_MEDIAENGINE_H_
#define TALK_MEDIA_BASE_MEDIAENGINE_H_ #define TALK_MEDIA_BASE_MEDIAENGINE_H_
#ifdef OSX #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include <CoreAudio/CoreAudio.h> #include <CoreAudio/CoreAudio.h>
#endif #endif

View File

@ -59,7 +59,7 @@ enum {
}; };
static const int64_t kMaxDistance = ~(static_cast<int64_t>(1) << 63); static const int64_t kMaxDistance = ~(static_cast<int64_t>(1) << 63);
#ifdef LINUX #ifdef WEBRTC_LINUX
static const int kYU12Penalty = 16; // Needs to be higher than MJPG index. static const int kYU12Penalty = 16; // Needs to be higher than MJPG index.
#endif #endif
static const int kDefaultScreencastFps = 5; static const int kDefaultScreencastFps = 5;
@ -594,7 +594,7 @@ int64_t VideoCapturer::GetFormatDistance(const VideoFormat& desired,
for (size_t i = 0; i < preferred_fourccs.size(); ++i) { for (size_t i = 0; i < preferred_fourccs.size(); ++i) {
if (supported_fourcc == CanonicalFourCC(preferred_fourccs[i])) { if (supported_fourcc == CanonicalFourCC(preferred_fourccs[i])) {
delta_fourcc = i; delta_fourcc = i;
#ifdef LINUX #ifdef WEBRTC_LINUX
// For HD avoid YU12 which is a software conversion and has 2 bugs // For HD avoid YU12 which is a software conversion and has 2 bugs
// b/7326348 b/6960899. Reenable when fixed. // b/7326348 b/6960899. Reenable when fixed.
if (supported.height >= 720 && (supported_fourcc == FOURCC_YU12 || if (supported.height >= 720 && (supported_fourcc == FOURCC_YU12 ||

View File

@ -123,7 +123,7 @@ bool DeviceManager::GetAudioOutputDevice(const std::string& name, Device* out) {
bool DeviceManager::GetVideoCaptureDevices(std::vector<Device>* devices) { bool DeviceManager::GetVideoCaptureDevices(std::vector<Device>* devices) {
devices->clear(); devices->clear();
#if defined(ANDROID) || defined(IOS) #if defined(ANDROID) || defined(WEBRTC_IOS)
// On Android and iOS, we treat the camera(s) as a single device. Even if // On Android and iOS, we treat the camera(s) as a single device. Even if
// there are multiple cameras, that's abstracted away at a higher level. // there are multiple cameras, that's abstracted away at a higher level.
Device dev("camera", "1"); // name and ID Device dev("camera", "1"); // name and ID

View File

@ -48,10 +48,10 @@
#include "webrtc/base/stream.h" #include "webrtc/base/stream.h"
#include "webrtc/base/windowpickerfactory.h" #include "webrtc/base/windowpickerfactory.h"
#ifdef LINUX #ifdef WEBRTC_LINUX
// TODO(juberti): Figure out why this doesn't compile on Windows. // TODO(juberti): Figure out why this doesn't compile on Windows.
#include "webrtc/base/fileutils_mock.h" #include "webrtc/base/fileutils_mock.h"
#endif // LINUX #endif // WEBRTC_LINUX
using rtc::Pathname; using rtc::Pathname;
using rtc::FileTimeType; using rtc::FileTimeType;
@ -285,7 +285,7 @@ TEST(DeviceManagerTest, VerifyFilterDevices) {
arraysize(kDevicesName))); arraysize(kDevicesName)));
} }
#ifdef LINUX #ifdef WEBRTC_LINUX
class FakeV4LLookup : public cricket::V4LLookup { class FakeV4LLookup : public cricket::V4LLookup {
public: public:
explicit FakeV4LLookup(std::vector<std::string> device_paths) explicit FakeV4LLookup(std::vector<std::string> device_paths)
@ -377,7 +377,7 @@ TEST(DeviceManagerTest, GetVideoCaptureDevices_KUnknown) {
EXPECT_EQ("/dev/video0", video_ins.at(0).name); EXPECT_EQ("/dev/video0", video_ins.at(0).name);
EXPECT_EQ("/dev/video5", video_ins.at(1).name); EXPECT_EQ("/dev/video5", video_ins.at(1).name);
} }
#endif // LINUX #endif // WEBRTC_LINUX
// TODO(noahric): These are flaky on windows on headless machines. // TODO(noahric): These are flaky on windows on headless machines.
#ifndef WIN32 #ifndef WIN32

View File

@ -156,7 +156,7 @@ class FakeDeviceManager : public DeviceManagerInterface {
return true; return true;
} }
#ifdef OSX #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
bool QtKitToSgDevice(const std::string& qtkit_name, Device* out) { bool QtKitToSgDevice(const std::string& qtkit_name, Device* out) {
out->name = qtkit_name; out->name = qtkit_name;
out->id = "sg:" + qtkit_name; out->id = "sg:" + qtkit_name;

View File

@ -37,7 +37,7 @@
#include <string> #include <string>
#ifdef LINUX #ifdef WEBRTC_LINUX
namespace cricket { namespace cricket {
class V4LLookup { class V4LLookup {
public: public:
@ -66,5 +66,5 @@ class V4LLookup {
} // namespace cricket } // namespace cricket
#endif // LINUX #endif // WEBRTC_LINUX
#endif // TALK_MEDIA_DEVICES_V4LLOOKUP_H_ #endif // TALK_MEDIA_DEVICES_V4LLOOKUP_H_

View File

@ -32,9 +32,9 @@
#define TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_ #define TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_
#include "talk/media/base/videorenderer.h" #include "talk/media/base/videorenderer.h"
#if defined(LINUX) && defined(HAVE_GTK) #if defined(WEBRTC_LINUX) && defined(HAVE_GTK)
#include "talk/media/devices/gtkvideorenderer.h" #include "talk/media/devices/gtkvideorenderer.h"
#elif defined(OSX) && !defined(CARBON_DEPRECATED) #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && !defined(CARBON_DEPRECATED)
#include "talk/media/devices/carbonvideorenderer.h" #include "talk/media/devices/carbonvideorenderer.h"
#elif defined(WIN32) #elif defined(WIN32)
#include "talk/media/devices/gdivideorenderer.h" #include "talk/media/devices/gdivideorenderer.h"
@ -45,9 +45,10 @@ namespace cricket {
class VideoRendererFactory { class VideoRendererFactory {
public: public:
static VideoRenderer* CreateGuiVideoRenderer(int x, int y) { static VideoRenderer* CreateGuiVideoRenderer(int x, int y) {
#if defined(LINUX) && defined(HAVE_GTK) #if defined(WEBRTC_LINUX) && defined(HAVE_GTK)
return new GtkVideoRenderer(x, y); return new GtkVideoRenderer(x, y);
#elif defined(OSX) && !defined(CARBON_DEPRECATED) #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && \
!defined(CARBON_DEPRECATED)
CarbonVideoRenderer* renderer = new CarbonVideoRenderer(x, y); CarbonVideoRenderer* renderer = new CarbonVideoRenderer(x, y);
// Needs to be initialized on the main thread. // Needs to be initialized on the main thread.
if (renderer->Initialize()) { if (renderer->Initialize()) {

View File

@ -601,7 +601,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
<< " (default is false)."; << " (default is false).";
} }
#if defined(IOS) #if defined(WEBRTC_IOS)
// On iOS, VPIO provides built-in EC and AGC. // On iOS, VPIO provides built-in EC and AGC.
options.echo_cancellation = rtc::Optional<bool>(false); options.echo_cancellation = rtc::Optional<bool>(false);
options.auto_gain_control = rtc::Optional<bool>(false); options.auto_gain_control = rtc::Optional<bool>(false);
@ -610,7 +610,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
ec_mode = webrtc::kEcAecm; ec_mode = webrtc::kEcAecm;
#endif #endif
#if defined(IOS) || defined(ANDROID) #if defined(WEBRTC_IOS) || defined(ANDROID)
// Set the AGC mode for iOS as well despite disabling it above, to avoid // Set the AGC mode for iOS as well despite disabling it above, to avoid
// unsupported configuration errors from webrtc. // unsupported configuration errors from webrtc.
agc_mode = webrtc::kAgcFixedDigital; agc_mode = webrtc::kAgcFixedDigital;
@ -623,7 +623,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
// Delay Agnostic AEC automatically turns on EC if not set except on iOS // Delay Agnostic AEC automatically turns on EC if not set except on iOS
// where the feature is not supported. // where the feature is not supported.
bool use_delay_agnostic_aec = false; bool use_delay_agnostic_aec = false;
#if !defined(IOS) #if !defined(WEBRTC_IOS)
if (options.delay_agnostic_aec) { if (options.delay_agnostic_aec) {
use_delay_agnostic_aec = *options.delay_agnostic_aec; use_delay_agnostic_aec = *options.delay_agnostic_aec;
if (use_delay_agnostic_aec) { if (use_delay_agnostic_aec) {
@ -861,7 +861,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
void WebRtcVoiceEngine::SetDefaultDevices() { void WebRtcVoiceEngine::SetDefaultDevices() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
#if !defined(IOS) #if !defined(WEBRTC_IOS)
int in_id = kDefaultAudioDeviceId; int in_id = kDefaultAudioDeviceId;
int out_id = kDefaultAudioDeviceId; int out_id = kDefaultAudioDeviceId;
LOG(LS_INFO) << "Setting microphone to (id=" << in_id LOG(LS_INFO) << "Setting microphone to (id=" << in_id
@ -886,7 +886,7 @@ void WebRtcVoiceEngine::SetDefaultDevices() {
LOG(LS_INFO) << "Set microphone to (id=" << in_id LOG(LS_INFO) << "Set microphone to (id=" << in_id
<< ") and speaker to (id=" << out_id << ")"; << ") and speaker to (id=" << out_id << ")";
} }
#endif // !IOS #endif // !WEBRTC_IOS
} }
bool WebRtcVoiceEngine::GetOutputVolume(int* level) { bool WebRtcVoiceEngine::GetOutputVolume(int* level) {

View File

@ -373,7 +373,7 @@ bool UnixFilesystem::GetAppPathname(Pathname* path) {
return success; return success;
#elif defined(__native_client__) #elif defined(__native_client__)
return false; return false;
#elif IOS #elif WEBRTC_IOS
IOSAppName(path); IOSAppName(path);
return true; return true;
#else // WEBRTC_MAC && !defined(WEBRTC_IOS) #else // WEBRTC_MAC && !defined(WEBRTC_IOS)

View File

@ -244,7 +244,7 @@ int WebRtcCreateWindow(Window *outWindow, Display **outDisplay, int winNum, int
return 0; return 0;
} }
#endif // LINUX #endif // WEBRTC_LINUX
// Note: Mac code is in testApi_mac.mm. // Note: Mac code is in testApi_mac.mm.