Bug 1389598 - Part 2: Remove gonk references from media/ r=jesup

--HG--
extra : rebase_source : d1af2d0987038e1c0b0b0c971d0d2e4e9f08364a
This commit is contained in:
Eric Rahm 2017-08-11 17:46:15 -07:00
parent 79e2533076
commit 50513900c7
16 changed files with 10 additions and 224 deletions

View File

@ -60,7 +60,6 @@ gyp_vars.update({
'arm_neon': 0,
'arm_neon_optional': 1,
'moz_widget_toolkit_gonk': 0,
'moz_webrtc_omx': 0,
'moz_webrtc_mediacodec': 0,

View File

@ -28,11 +28,6 @@ mtransport_lcppsrcs = [
'transportlayerprsock.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
mtransport_lcppsrcs += [
'gonk_addrs.cpp',
]
mtransport_cppsrcs = [
'/media/mtransport/%s' % s for s in sorted(mtransport_lcppsrcs)
]

View File

@ -1,170 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
extern "C" {
#include <arpa/inet.h>
#include "r_types.h"
#include "stun.h"
#include "addrs.h"
}
#include <vector>
#include <string>
#include "nsINetworkInterface.h"
#include "nsINetworkInterfaceListService.h"
#include "runnable_utils.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsThreadUtils.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/SyncRunnable.h"
namespace {
struct NetworkInterface {
struct sockaddr_in addr;
std::string name;
// See NR_INTERFACE_TYPE_* in nICEr/src/net/local_addrs.h
int type;
};
nsresult
GetInterfaces(std::vector<NetworkInterface>* aInterfaces)
{
MOZ_ASSERT(aInterfaces);
// Obtain network interfaces from network manager.
nsresult rv;
nsCOMPtr<nsINetworkInterfaceListService> listService =
do_GetService("@mozilla.org/network/interface-list-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
int32_t flags =
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_SUPL_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_MMS_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_IMS_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_DUN_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_FOTA_INTERFACES;
nsCOMPtr<nsINetworkInterfaceList> networkList;
NS_ENSURE_SUCCESS(listService->GetDataInterfaceList(flags,
getter_AddRefs(networkList)),
NS_ERROR_FAILURE);
// Translate nsINetworkInterfaceList to NetworkInterface.
int32_t listLength;
NS_ENSURE_SUCCESS(networkList->GetNumberOfInterface(&listLength),
NS_ERROR_FAILURE);
aInterfaces->clear();
for (int32_t i = 0; i < listLength; i++) {
nsCOMPtr<nsINetworkInfo> info;
if (NS_FAILED(networkList->GetInterfaceInfo(i, getter_AddRefs(info)))) {
continue;
}
char16_t **ips = nullptr;
uint32_t *prefixs = nullptr;
uint32_t count = 0;
bool isAddressGot = false;
NetworkInterface interface;
memset(&(interface.addr), 0, sizeof(interface.addr));
interface.addr.sin_family = AF_INET;
if (NS_FAILED(info->GetAddresses(&ips, &prefixs, &count))) {
continue;
}
for (uint32_t j = 0; j < count; j++) {
nsAutoString ip;
ip.Assign(ips[j]);
if (inet_pton(AF_INET, NS_ConvertUTF16toUTF8(ip).get(),
&(interface.addr.sin_addr.s_addr)) == 1) {
isAddressGot = true;
break;
}
}
free(prefixs);
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, ips);
if (!isAddressGot) {
continue;
}
nsAutoString ifaceName;
if (NS_FAILED(info->GetName(ifaceName))) {
continue;
}
interface.name = NS_ConvertUTF16toUTF8(ifaceName).get();
int32_t type;
if (NS_FAILED(info->GetType(&type))) {
continue;
}
switch (type) {
case nsINetworkInfo::NETWORK_TYPE_WIFI:
interface.type = NR_INTERFACE_TYPE_WIFI;
break;
case nsINetworkInfo::NETWORK_TYPE_MOBILE:
interface.type = NR_INTERFACE_TYPE_MOBILE;
break;
}
aInterfaces->push_back(interface);
}
return NS_OK;
}
} // anonymous namespace
int
nr_stun_get_addrs(nr_local_addr aAddrs[], int aMaxAddrs,
int aDropLoopback, int aDropLinkLocal, int* aCount)
{
nsresult rv;
int r;
// Get network interface list.
std::vector<NetworkInterface> interfaces;
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
mozilla::SyncRunnable::DispatchToThread(
mainThread.get(),
mozilla::WrapRunnableNMRet(&rv, &GetInterfaces, &interfaces),
false);
if (NS_FAILED(rv)) {
return R_FAILED;
}
// Translate to nr_transport_addr.
int32_t n = 0;
size_t num_interface = std::min(interfaces.size(), (size_t)aMaxAddrs);
for (size_t i = 0; i < num_interface; ++i) {
NetworkInterface &interface = interfaces[i];
if (nr_sockaddr_to_transport_addr((sockaddr*)&(interface.addr),
IPPROTO_UDP, 0, &(aAddrs[n].addr))) {
r_log(NR_LOG_STUN, LOG_WARNING, "Problem transforming address");
return R_FAILED;
}
strlcpy(aAddrs[n].addr.ifname, interface.name.c_str(),
sizeof(aAddrs[n].addr.ifname));
aAddrs[n].interface.type = interface.type;
aAddrs[n].interface.estimated_speed = 0;
n++;
}
*aCount = n;
r = nr_stun_remove_duplicate_addrs(aAddrs, aDropLoopback, aDropLinkLocal, aCount);
if (r != 0) {
return r;
}
for (int i = 0; i < *aCount; ++i) {
char typestr[100];
nr_local_addr_fmt_info_string(aAddrs + i, typestr, sizeof(typestr));
r_log(NR_LOG_STUN, LOG_DEBUG, "Address %d: %s on %s, type: %s\n",
i, aAddrs[i].addr.as_string, aAddrs[i].addr.ifname, typestr);
}
return 0;
}

View File

@ -7,7 +7,6 @@
#
{
'variables' : {
'build_with_gonk%': 0,
'have_ethtool_cmd_speed_hi%': 1
},
'targets' : [
@ -234,18 +233,6 @@
'sources': [
],
}],
['moz_widget_toolkit_gonk==1', {
'defines' : [
'WEBRTC_GONK',
'NO_REG_RPC',
],
}],
# Gonk has its own nr_stun_get_addrs implementation.
['build_with_gonk==1', {
'defines': [
"USE_PLATFORM_NR_STUN_GET_ADDRS",
]
}],
['have_ethtool_cmd_speed_hi==0', {
'defines': [

View File

@ -39,16 +39,6 @@
'chromium_code': 1,
},
'target_defaults': {
'conditions': [
['moz_widget_toolkit_gonk==1', {
'defines' : [
'WEBRTC_GONK',
],
}],
],
},
'targets': [
#
@ -296,7 +286,7 @@
'cflags_mozilla': [
],
}],
['OS=="android" or moz_widget_toolkit_gonk==1', {
['OS=="android"', {
'cflags_mozilla': [
# This warning complains about important MOZ_EXPORT attributes
# on forward declarations for Android API types.

View File

@ -2259,12 +2259,8 @@ JsepSessionImpl::SetupDefaultCodecs()
48000,
2,
960,
#ifdef WEBRTC_GONK
// TODO Move this elsewhere to be adaptive to rate - Bug 1207925
16000 // B2G uses lower capture sampling rate
#else
40000
#endif
));
mSupportedCodecs.values.push_back(new JsepAudioCodecDescription(

View File

@ -25,10 +25,6 @@
#include "MediaStreamVideoSink.h"
#include "VideoUtils.h"
#include "VideoStreamTrack.h"
#ifdef WEBRTC_GONK
#include "GrallocImages.h"
#include "mozilla/layers/GrallocTextureClient.h"
#endif
#include "nsError.h"
#include "AudioSegment.h"

View File

@ -428,7 +428,7 @@
}],
# Flags to use X11 on non-Mac POSIX platforms
['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or moz_widget_toolkit_gonk==1', {
['OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', {
'use_glib%': 0,
'use_x11%': 0,
}, {

View File

@ -23,7 +23,7 @@
// TODO(jesup) better adjust per platform ability
// Note: if these are changed (higher), you may need to change the
// KernelDelay values in the unit tests here and in output_mixer.
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_GONK)
#if defined(WEBRTC_ANDROID)
#define RESAMPLER_QUALITY 2
#else
#define RESAMPLER_QUALITY 3

View File

@ -1 +0,0 @@
#include "../android/audio_manager.cc"

View File

@ -1,6 +0,0 @@
#ifndef WEBRTC_MODULES_AUDIO_DEVICE_GONK_AUDIO_MANAGER_H_
#define WEBRTC_MODULES_AUDIO_DEVICE_GONK_AUDIO_MANAGER_H_
#include "../android/audio_manager.h"
#endif

View File

@ -29,7 +29,7 @@
namespace webrtc_adm_linux_pulse {
#if defined(__OpenBSD__) || defined(WEBRTC_GONK)
#if defined(__OpenBSD__)
LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so")
#else
LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so.0")

View File

@ -17,7 +17,7 @@
#include "webrtc/modules/include/module.h"
#include "webrtc/modules/video_capture/video_capture_defines.h"
#if defined(ANDROID) && !defined(WEBRTC_GONK)
#if defined(ANDROID)
#include <jni.h>
#endif

View File

@ -13,7 +13,7 @@
#include <assert.h>
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_GONK)
#if defined(WEBRTC_ANDROID)
#define OS_LINUX
#endif
#include "base/singleton.h"

View File

@ -67,7 +67,7 @@ static int GetCPUInfo(CPUFeature feature) {
return 0;
}
#if !defined(WEBRTC_GONK) && !defined(ANDROID)
#if !defined(ANDROID)
#ifdef WEBRTC_ARCH_ARM_V7
uint64_t WebRtc_GetCPUFeaturesARM(void) {
return kCPUFeatureARMv7
@ -77,7 +77,7 @@ uint64_t WebRtc_GetCPUFeaturesARM(void) {
| kCPUFeatureVFPv3;
}
#endif // WEBRTC_ARCH_ARM_V7
#endif // !WEBRTC_GONK && !ANDROID
#endif // !ANDROID
#endif

View File

@ -60,13 +60,13 @@ enum { kVoiceEngineMaxModuleVersionSize = 960 };
// Audio processing
const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate;
const GainControl::Mode kDefaultAgcMode =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_GONK)
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
GainControl::kAdaptiveDigital;
#else
GainControl::kAdaptiveAnalog;
#endif
const bool kDefaultAgcState =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_GONK)
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
false;
#else
true;