Bug 1101651 - Part 2: Enable WebRTC unit tests to be built using standalone WebRTC library. r=jesup

--HG--
extra : rebase_source : 97215946f8152cc8df425449b7052b0b365ab0e9
This commit is contained in:
Randall Barker 2015-04-09 09:15:00 -04:00
Родитель abe07cabea
Коммит 3263a9649b
40 изменённых файлов: 693 добавлений и 429 удалений

Просмотреть файл

@ -25,7 +25,7 @@ EXPORTS.mtransport += [
'../transportlayerprsock.h',
]
include('../objs.mozbuild')
include('../common.build')
# These files cannot be built in unified mode because of the redefinition of
# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
@ -34,67 +34,7 @@ SOURCES += mtransport_cppsrcs
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',
'/media/mtransport/third_party/nICEr/src/crypto',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nICEr/src/util',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
]
if CONFIG['OS_TARGET'] in ['Darwin', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD']:
if CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['DARWIN'] = True
else:
DEFINES['BSD'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
elif CONFIG['OS_TARGET'] == 'Linux':
DEFINES['LINUX'] = True
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
elif CONFIG['OS_TARGET'] == 'Android':
DEFINES['LINUX'] = True
DEFINES['ANDROID'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WIN'] = True
# for stun.h
DEFINES['WIN32'] = True
DEFINES['NOMINMAX'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/win32/include',
]
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
NO_VISIBILITY_FLAGS = True
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
DEFINES[var] = True
DEFINES['R_DEFINED_INT2'] = 'int16_t'
DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
DEFINES['R_DEFINED_INT4'] = 'int32_t'
DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
DEFINES['R_DEFINED_INT8'] = 'int64_t'
DEFINES['R_DEFINED_UINT8'] = 'uint64_t'

Просмотреть файл

@ -0,0 +1,95 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
mtransport_lcppsrcs = [
'dtlsidentity.cpp',
'nr_socket_prsock.cpp',
'nr_timer.cpp',
'nricectx.cpp',
'nricemediastream.cpp',
'nriceresolver.cpp',
'nriceresolverfake.cpp',
'nrinterfaceprioritizer.cpp',
'rlogringbuffer.cpp',
'simpletokenbucket.cpp',
'stun_udp_socket_filter.cpp',
'transportflow.cpp',
'transportlayer.cpp',
'transportlayerdtls.cpp',
'transportlayerice.cpp',
'transportlayerlog.cpp',
'transportlayerloopback.cpp',
'transportlayerprsock.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
mtransport_lcppsrcs += [
'gonk_addrs.cpp',
]
mtransport_cppsrcs = [
'%s/media/mtransport/%s' % (TOPSRCDIR, s) for s in sorted(mtransport_lcppsrcs)
]
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',
'/media/mtransport/third_party/nICEr/src/crypto',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nICEr/src/util',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
]
if CONFIG['OS_TARGET'] in ['Darwin', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD']:
if CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['DARWIN'] = True
else:
DEFINES['BSD'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
elif CONFIG['OS_TARGET'] == 'Linux':
DEFINES['LINUX'] = True
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
elif CONFIG['OS_TARGET'] == 'Android':
DEFINES['LINUX'] = True
DEFINES['ANDROID'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WIN'] = True
# for stun.h
DEFINES['WIN32'] = True
DEFINES['NOMINMAX'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/win32/include',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
DEFINES[var] = True
DEFINES['R_DEFINED_INT2'] = 'int16_t'
DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
DEFINES['R_DEFINED_INT4'] = 'int32_t'
DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
DEFINES['R_DEFINED_INT8'] = 'int64_t'
DEFINES['R_DEFINED_UINT8'] = 'uint64_t'

Просмотреть файл

@ -0,0 +1,17 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DIRS += [
'/media/mtransport/third_party',
'/media/mtransport/build',
'/media/mtransport/testlib',
]
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
DIRS += [
'/media/mtransport/standalone',
]

Просмотреть файл

@ -1,35 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
mtransport_lcppsrcs = [
'dtlsidentity.cpp',
'nr_socket_prsock.cpp',
'nr_timer.cpp',
'nricectx.cpp',
'nricemediastream.cpp',
'nriceresolver.cpp',
'nriceresolverfake.cpp',
'nrinterfaceprioritizer.cpp',
'rlogringbuffer.cpp',
'simpletokenbucket.cpp',
'stun_udp_socket_filter.cpp',
'transportflow.cpp',
'transportlayer.cpp',
'transportlayerdtls.cpp',
'transportlayerice.cpp',
'transportlayerlog.cpp',
'transportlayerloopback.cpp',
'transportlayerprsock.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
mtransport_lcppsrcs += [
'gonk_addrs.cpp',
]
mtransport_cppsrcs = [
'%s/media/mtransport/%s' % (TOPSRCDIR, s) for s in sorted(mtransport_lcppsrcs)
]

Просмотреть файл

@ -4,73 +4,17 @@
# 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/.
include('../objs.mozbuild')
Library('mtransport_standalone')
include('../common.build')
# These files cannot be built in unified mode because of the redefinition of
# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
# nr_socket_short_term_violation_time.
SOURCES += mtransport_cppsrcs
Library('mtransport_s')
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',
'/media/mtransport/third_party/nICEr/src/crypto',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nICEr/src/util',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
]
if CONFIG['OS_TARGET'] in ['Darwin', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD']:
if CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['DARWIN'] = True
else:
DEFINES['BSD'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
elif CONFIG['OS_TARGET'] == 'Linux':
DEFINES['LINUX'] = True
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
elif CONFIG['OS_TARGET'] == 'Android':
DEFINES['LINUX'] = True
DEFINES['ANDROID'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WIN'] = True
# for stun.h
DEFINES['WIN32'] = True
DEFINES['NOMINMAX'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/win32/include',
]
FORCE_STATIC_LIB = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE'):
DEFINES[var] = True
DEFINES['R_DEFINED_INT2'] = 'int16_t'
DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
DEFINES['R_DEFINED_INT4'] = 'int32_t'
DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
DEFINES['R_DEFINED_INT8'] = 'int64_t'
DEFINES['R_DEFINED_UINT8'] = 'uint64_t'

Просмотреть файл

@ -14,6 +14,10 @@ extern "C" {
#include "mozilla/net/DNS.h"
#include "stun_udp_socket_filter.h"
#include "nr_socket_prsock.h"
#if defined(MOZILLA_XPCOMRT_API)
#include "mozilla/Module.h"
#include "mozilla/ModuleUtils.h"
#endif
namespace {
@ -206,3 +210,26 @@ NS_IMETHODIMP nsStunUDPSocketFilterHandler::NewFilter(nsIUDPSocketFilter **resul
NS_ADDREF(*result = ret);
return NS_OK;
}
#if defined(MOZILLA_XPCOMRT_API)
NS_DEFINE_NAMED_CID(NS_STUN_UDP_SOCKET_FILTER_HANDLER_CID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStunUDPSocketFilterHandler)
static const mozilla::Module::CIDEntry kCIDs[] = {
{ &kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID, false, nullptr, nsStunUDPSocketFilterHandlerConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kContracts[] = {
{ NS_STUN_UDP_SOCKET_FILTER_HANDLER_CONTRACTID, &kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID },
{ nullptr }
};
extern const mozilla::Module kStunUDPSocketFilterHandlerModule;
const mozilla::Module kStunUDPSocketFilterHandlerModule = {
mozilla::Module::kVersion,
kCIDs,
kContracts
};
#endif

Просмотреть файл

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
GeckoCppUnitTests([
CppUnitTests([
'buffered_stun_socket_unittest',
'ice_unittest',
'nrappkit_unittest',
@ -20,13 +20,13 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
])
if CONFIG['MOZ_SCTP']:
GeckoCppUnitTests([
CppUnitTests([
'sctp_unittest',
])
FAIL_ON_WARNINGS = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR', 'SCTP_DEBUG', 'INET'):
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE', 'HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR', 'SCTP_DEBUG', 'INET'):
DEFINES[var] = True
if CONFIG['OS_TARGET'] == 'Android':
@ -40,6 +40,12 @@ if CONFIG['OS_TARGET'] == 'Linux':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
USE_LIBS += [
'static:/nsprpub/lib/libc/src/plc4',
]
OS_LIBS += [
'-lrt',
]
if CONFIG['OS_TARGET'] == 'Darwin':
LOCAL_INCLUDES += [
@ -80,14 +86,22 @@ LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/util/libekr',
'/media/webrtc/trunk/testing/gtest/include/',
'/netwerk/sctp/src/',
'/xpcom/libxpcomrt',
]
USE_LIBS += [
'/media/webrtc/trunk/testing/gtest_gtest/gtest',
'mtransport_s',
'fallible',
'mfbt',
'mozglue',
'mtransport_standalone',
'necko_standalone',
'nicer',
'nrappkit',
'nspr',
'nss',
'unicharutil_standalone',
'xpcomrt',
]
if not CONFIG['MOZ_NATIVE_NSS'] and not CONFIG['MOZ_FOLD_LIBS']:
@ -100,3 +114,5 @@ if CONFIG['MOZ_SCTP']:
USE_LIBS += [
'nksctp_s',
]
USE_LIBS += ['mozglue']

Просмотреть файл

@ -19,7 +19,7 @@
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsNetUtil.h"
#include "nsIEventTarget.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
#include "nsISocketTransportService.h"
@ -30,7 +30,22 @@
#endif
#include "nsPISocketTransportService.h"
#include "nsServiceManagerUtils.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "TestHarness.h"
#else
#include "XPCOMRTInit.h"
class ScopedXPCOM {
public:
explicit ScopedXPCOM(const char*)
{
NS_InitXPCOMRT();
}
~ScopedXPCOM()
{
NS_ShutdownXPCOMRT();
}
};
#endif
class MtransportTestUtils {
public:
@ -46,8 +61,6 @@ class MtransportTestUtils {
void InitServices() {
nsresult rv;
ioservice_ = do_GetIOService(&rv);
MOZ_ASSERT(NS_SUCCEEDED(rv));
sts_target_ = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
MOZ_ASSERT(NS_SUCCEEDED(rv));
sts_ = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
@ -80,7 +93,6 @@ class MtransportTestUtils {
private:
ScopedXPCOM xpcom_;
nsCOMPtr<nsIIOService> ioservice_;
nsCOMPtr<nsIEventTarget> sts_target_;
nsCOMPtr<nsPISocketTransportService> sts_;
#ifdef MOZ_CRASHREPORTER

Просмотреть файл

@ -0,0 +1,16 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
include('../common.build')
# These files cannot be built in unified mode because of the redefinition of
# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
# nr_socket_short_term_violation_time.
SOURCES += mtransport_cppsrcs
Library('mtransport_s')
FORCE_STATIC_LIB = True

Просмотреть файл

@ -48,7 +48,8 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
GYP_DIRS['signaling'].input = 'signaling/signaling.gyp'
GYP_DIRS['signaling'].variables = gyp_vars.copy()
GYP_DIRS['signaling'].variables.update(
build_for_test=0
build_for_test=0,
build_for_standalone=0
)
GYP_DIRS['signaling'].sandbox_vars['FINAL_LIBRARY'] = 'xul'
# Excluded for various symbol conflicts
@ -92,7 +93,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
GYP_DIRS['signalingtest'].input = 'signaling/signaling.gyp'
GYP_DIRS['signalingtest'].variables = gyp_vars.copy()
GYP_DIRS['signalingtest'].variables.update(
build_for_test=1
build_for_test=1,
build_for_standalone=0
)
GYP_DIRS['signalingtest'].non_unified_sources += signaling_non_unified_sources
GYP_DIRS += ['signalingstandalone']
GYP_DIRS['signalingstandalone'].input = 'signaling/signaling.gyp'
GYP_DIRS['signalingstandalone'].variables = gyp_vars.copy()
GYP_DIRS['signalingstandalone'].variables.update(
build_for_test=0,
build_for_standalone=1
)
GYP_DIRS['signalingstandalone'].non_unified_sources += signaling_non_unified_sources

Просмотреть файл

@ -77,8 +77,6 @@
'./src/media-conduit/CodecStatistics.h',
'./src/media-conduit/CodecStatistics.cpp',
'./src/media-conduit/RunningStat.h',
'./src/media-conduit/GmpVideoCodec.cpp',
'./src/media-conduit/WebrtcGmpVideoCodec.cpp',
# Common
'./src/common/CommonTypes.h',
'./src/common/csf_common.h',
@ -98,8 +96,6 @@
# PeerConnection
'./src/peerconnection/MediaPipelineFactory.cpp',
'./src/peerconnection/MediaPipelineFactory.h',
'./src/peerconnection/MediaStreamList.cpp',
'./src/peerconnection/MediaStreamList.h',
'./src/peerconnection/PeerConnectionCtx.cpp',
'./src/peerconnection/PeerConnectionCtx.h',
'./src/peerconnection/PeerConnectionImpl.cpp',
@ -220,11 +216,13 @@
'MOZ_WEBRTC_OMX'
],
}],
['build_for_test==0', {
['(build_for_test==0) and (build_for_standalone==0)', {
'defines' : [
'MOZILLA_INTERNAL_API'
'MOZILLA_INTERNAL_API',
],
'sources': [
'./src/peerconnection/MediaStreamList.cpp',
'./src/peerconnection/MediaStreamList.h',
'./src/peerconnection/WebrtcGlobalInformation.cpp',
'./src/peerconnection/WebrtcGlobalInformation.h',
],
@ -236,7 +234,27 @@
'defines' : [
'NO_CHROMIUM_LOGGING',
'USE_FAKE_MEDIA_STREAMS',
'USE_FAKE_PCOBSERVER'
'USE_FAKE_PCOBSERVER',
'MOZILLA_EXTERNAL_LINKAGE',
],
}],
['build_for_standalone==0', {
'sources': [
'./src/media-conduit/GmpVideoCodec.cpp',
'./src/media-conduit/WebrtcGmpVideoCodec.cpp',
],
}],
['build_for_standalone!=0', {
'include_dirs': [
'./test'
],
'defines' : [
'MOZILLA_INTERNAL_API',
'MOZILLA_XPCOMRT_API',
'MOZILLA_EXTERNAL_LINKAGE',
'NO_CHROMIUM_LOGGING',
'USE_FAKE_MEDIA_STREAMS',
'USE_FAKE_PCOBSERVER',
],
}],
['(OS=="linux") or (OS=="android")', {

Просмотреть файл

@ -11,7 +11,9 @@
#include "nscore.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "mozilla/Preferences.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
#else
#include "nsStringAPI.h"
#endif
@ -57,11 +59,13 @@ static WebRtcTraceCallback gWebRtcCallback;
#ifdef MOZILLA_INTERNAL_API
void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog)
{
#if !defined(MOZILLA_XPCOMRT_API)
*aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log");
*aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask");
mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile);
mozilla::Preferences::GetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size"));
#endif // !defined(MOZILLA_XPCOMRT_API)
}
#endif
@ -141,7 +145,7 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo
webrtc::Trace::SetTraceFile(aLogFile.get(), multi_log);
}
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Capture the final choices for the trace settings.
mozilla::Preferences::SetCString("media.webrtc.debug.log_file", aLogFile);
mozilla::Preferences::SetUint("media.webrtc.debug.trace_mask", trace_mask);

Просмотреть файл

@ -18,7 +18,7 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsThreadUtils.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "Latency.h"
#include "mozilla/Telemetry.h"
#endif
@ -369,7 +369,7 @@ WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig)
return kMediaConduitUnknownError;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// TEMPORARY - see bug 694814 comment 2
nsresult rv;
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
@ -530,7 +530,7 @@ WebrtcAudioConduit::SendAudioFrame(const int16_t audio_data[],
return kMediaConduitSessionNotInited;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
struct Processing insert = { TimeStamp::Now(), 0 };
mProcessing.AppendElement(insert);
@ -624,7 +624,7 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
if (GetAVStats(&jitter_buffer_delay_ms,
&playout_buffer_delay_ms,
&avsync_offset_ms)) {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (avsync_offset_ms < 0) {
Telemetry::Accumulate(Telemetry::WEBRTC_AVSYNC_WHEN_VIDEO_LAGS_AUDIO_MS,
-avsync_offset_ms);
@ -642,7 +642,7 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
mLastSyncLog = mSamples;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
if (mProcessing.Length() > 0) {
unsigned int now;
@ -679,7 +679,7 @@ WebrtcAudioConduit::ReceivedRTPPacket(const void *data, int len)
if(mEngineReceiving)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
// timestamp is at 32 bits in ([1])
struct Processing insert = { TimeStamp::Now(),
@ -817,7 +817,7 @@ int WebrtcAudioConduit::SendPacket(int channel, const void* data, int len)
{
CSFLogDebug(logTag, "%s : channel %d", __FUNCTION__, channel);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
if (mProcessing.Length() > 0) {
TimeStamp started = mProcessing[0].mTimeStamp;

Просмотреть файл

@ -171,7 +171,7 @@ public:
mChannel(-1),
mCurSendCodecConfig(nullptr),
mCaptureDelay(150),
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mLastTimestamp(0),
#endif // MOZILLA_INTERNAL_API
mSamples(0),
@ -282,7 +282,7 @@ private:
// Current "capture" delay (really output plus input delay)
int32_t mCaptureDelay;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
uint32_t mLastTimestamp;
#endif // MOZILLA_INTERNAL_API

Просмотреть файл

@ -5,7 +5,9 @@
#include "CodecStatistics.h"
#include "CSFLog.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "mozilla/Telemetry.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
using namespace mozilla;
using namespace webrtc;
@ -117,8 +119,10 @@ void VideoCodecStatistics::ReceiveStateChange(const int aChannel,
TimeDuration timeDelta = TimeStamp::Now() - mReceiveFailureTime;
CSFLogError(logTag, "Video error duration: %u ms",
static_cast<uint32_t>(timeDelta.ToMilliseconds()));
#if !defined(MOZILLA_XPCOMRT_API)
Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_ERROR_RECOVERY_MS,
static_cast<uint32_t>(timeDelta.ToMilliseconds()));
#endif //
mRecoveredLosses++; // to calculate losses per minute
mTotalLossTime += timeDelta; // To calculate % time in recovery
@ -140,16 +144,22 @@ void VideoCodecStatistics::EndOfCallStats()
if (callDelta.ToSeconds() != 0) {
uint32_t recovered_per_min = mRecoveredBeforeLoss/(callDelta.ToSeconds()/60);
CSFLogError(logTag, "Video recovery before error per min %u", recovered_per_min);
#if !defined(MOZILLA_XPCOMRT_API)
Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_RECOVERY_BEFORE_ERROR_PER_MIN,
recovered_per_min);
#endif // !defined(MOZILLA_XPCOMRT_API)
uint32_t err_per_min = mRecoveredLosses/(callDelta.ToSeconds()/60);
CSFLogError(logTag, "Video recovery after error per min %u", err_per_min);
#if !defined(MOZILLA_XPCOMRT_API)
Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_RECOVERY_AFTER_ERROR_PER_MIN,
err_per_min);
#endif // !defined(MOZILLA_XPCOMRT_API)
float percent = (mTotalLossTime.ToSeconds()*100)/callDelta.ToSeconds();
CSFLogError(logTag, "Video error time percentage %f%%", percent);
#if !defined(MOZILLA_XPCOMRT_API)
Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_DECODE_ERROR_TIME_PERMILLE,
static_cast<uint32_t>(percent*10));
#endif // !defined(MOZILLA_XPCOMRT_API)
}
}
#endif

Просмотреть файл

@ -278,7 +278,7 @@ WebrtcVideoConduit::Init()
{
CSFLogDebug(logTag, "%s this=%p", __FUNCTION__, this);
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_INTERNAL_API)
// already know we must be on MainThread barring unit test weirdness
MOZ_ASSERT(NS_IsMainThread());

Просмотреть файл

@ -16,7 +16,7 @@
#include "nspr.h"
#include "srtp.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "VideoSegment.h"
#include "Layers.h"
#include "ImageTypes.h"
@ -38,7 +38,7 @@
#include "transportlayerice.h"
#include "runnable_utils.h"
#include "libyuv/convert.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "mozilla/PeerIdentity.h"
#endif
#include "mozilla/gfx/Point.h"
@ -643,7 +643,7 @@ void MediaPipelineTransmit::AttachToTrack(const std::string& track_id) {
#endif
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void MediaPipelineTransmit::UpdateSinkIdentity_m(nsIPrincipal* principal,
const PeerIdentity* sinkIdentity) {
ASSERT_ON_THREAD(main_thread_);
@ -931,7 +931,7 @@ NewData(MediaStreamGraph* graph, TrackID tid,
iter.Next();
}
} else if (media.GetType() == MediaSegment::VIDEO) {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
VideoSegment* video = const_cast<VideoSegment *>(
static_cast<const VideoSegment *>(&media));
@ -1044,7 +1044,7 @@ void MediaPipelineTransmit::PipelineListener::ProcessAudioChunk(
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk(
VideoSessionConduit* conduit,
VideoChunk& chunk) {
@ -1234,7 +1234,7 @@ static void AddTrackAndListener(MediaStream* source,
const RefPtr<TrackAddedCallback>& completed,
bool queue_track) {
// This both adds the listener and the track
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class Message : public ControlMessage {
public:
Message(MediaStream* stream, TrackID track, TrackRate rate,
@ -1396,7 +1396,7 @@ nsresult MediaPipelineReceiveVideo::Init() {
description_ += track_id_;
description_ += "]";
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_INTERNAL_API)
listener_->AddSelf(new VideoSegment());
#endif
@ -1412,12 +1412,14 @@ MediaPipelineReceiveVideo::PipelineListener::PipelineListener(
: GenericReceiveListener(source, track_id, source->GraphRate(), queue_track),
width_(640),
height_(480),
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_XPCOMRT_API)
image_(new mozilla::SimpleImageBuffer),
#elif defined(MOZILLA_INTERNAL_API)
image_container_(),
image_(),
#endif
monitor_("Video PipelineListener") {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
image_container_ = layers::LayerManager::CreateImageContainer();
#endif
}
@ -1428,9 +1430,16 @@ void MediaPipelineReceiveVideo::PipelineListener::RenderVideoFrame(
uint32_t time_stamp,
int64_t render_time,
const RefPtr<layers::Image>& video_image) {
#ifdef MOZILLA_INTERNAL_API
ReentrantMonitorAutoEnter enter(monitor_);
#endif // MOZILLA_INTERNAL_API
#if defined(MOZILLA_XPCOMRT_API)
if (buffer) {
image_->SetImage(buffer, buffer_size, width_, height_);
}
#elif defined(MOZILLA_INTERNAL_API)
if (buffer) {
// Create a video frame using |buffer|.
#ifdef MOZ_WIDGET_GONK
@ -1473,10 +1482,15 @@ void MediaPipelineReceiveVideo::PipelineListener::
NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) {
ReentrantMonitorAutoEnter enter(monitor_);
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_XPCOMRT_API)
nsRefPtr<SimpleImageBuffer> image = image_;
#elif defined(MOZILLA_INTERNAL_API)
nsRefPtr<layers::Image> image = image_;
// our constructor sets track_rate_ to the graph rate
MOZ_ASSERT(track_rate_ == source_->GraphRate());
#endif
#if defined(MOZILLA_INTERNAL_API)
StreamTime delta = desired_time - played_ticks_;
// Don't append if we've already provided a frame that supposedly
@ -1494,6 +1508,12 @@ NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) {
}
}
#endif
#if defined(MOZILLA_XPCOMRT_API)
// Clear the image without deleting the memory.
// This prevents image_ from being used if it
// does not have new content during the next NotifyPull.
image_->SetImage(nullptr, 0, 0, 0);
#endif
}

Просмотреть файл

@ -27,7 +27,7 @@
#include "runnable_utils.h"
#include "transportflow.h"
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_INTERNAL_API)
#include "VideoSegment.h"
#endif
@ -406,7 +406,7 @@ public:
// written and used from MainThread
virtual bool IsVideo() const override { return is_video_; }
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// when the principal of the PeerConnection changes, it calls through to here
// so that we can determine whether to enable stream transmission
virtual void UpdateSinkIdentity_m(nsIPrincipal* principal,
@ -449,7 +449,7 @@ public:
samples_10ms_buffer_(nullptr),
buffer_current_(0),
samplenum_10ms_(0)
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
, last_img_(-1)
#endif // MOZILLA_INTERNAL_API
{
@ -494,7 +494,7 @@ public:
virtual void ProcessAudioChunk(AudioSessionConduit *conduit,
TrackRate rate, AudioChunk& chunk);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
virtual void ProcessVideoChunk(VideoSessionConduit *conduit,
VideoChunk& chunk);
#endif
@ -525,7 +525,7 @@ public:
// The number of samples in a 10ms audio chunk.
int64_t samplenum_10ms_;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
int32_t last_img_; // serial number of last Image
#endif // MOZILLA_INTERNAL_API
};
@ -746,7 +746,9 @@ class MediaPipelineReceiveVideo : public MediaPipelineReceive {
private:
int width_;
int height_;
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_XPCOMRT_API)
nsRefPtr<mozilla::SimpleImageBuffer> image_;
#elif defined(MOZILLA_INTERNAL_API)
nsRefPtr<layers::ImageContainer> image_container_;
nsRefPtr<layers::Image> image_;
#endif

Просмотреть файл

@ -16,7 +16,7 @@
#include "signaling/src/jsep/JsepTransport.h"
#include "signaling/src/common/PtrVector.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "MediaStreamTrack.h"
#include "nsIPrincipal.h"
#include "nsIDocument.h"
@ -519,7 +519,7 @@ MediaPipelineFactory::CreateMediaPipelineSending(
aRtcpFlow,
aFilter);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// implement checking for peerIdentity (where failure == black/silence)
nsIDocument* doc = mPC->GetWindow()->GetExtantDoc();
if (doc) {
@ -787,7 +787,7 @@ nsresult
MediaPipelineFactory::ConfigureVideoCodecMode(const JsepTrack& aTrack,
VideoSessionConduit& aConduit)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsRefPtr<LocalSourceStreamInfo> stream =
mPCMedia->GetLocalStreamById(aTrack.GetStreamId());
@ -858,7 +858,7 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
#ifdef MOZ_WEBRTC_OMX
encoder =
OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
#else
#elif !defined(MOZILLA_XPCOMRT_API)
encoder = GmpVideoCodec::CreateEncoder();
#endif
if (encoder) {
@ -867,11 +867,11 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
return kMediaConduitInvalidSendCodec;
}
} else {
VideoDecoder* decoder;
VideoDecoder* decoder = nullptr;
#ifdef MOZ_WEBRTC_OMX
decoder =
OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
#else
#elif !defined(MOZILLA_XPCOMRT_API)
decoder = GmpVideoCodec::CreateDecoder();
#endif
if (decoder) {

Просмотреть файл

@ -12,7 +12,7 @@
#include "mozilla/Telemetry.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "mozilla/dom/RTCPeerConnectionBinding.h"
#include "mozilla/Preferences.h"
#include <mozilla/Types.h>
@ -151,7 +151,7 @@ void PeerConnectionCtx::Destroy() {
}
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
typedef Vector<nsAutoPtr<RTCStatsQuery>> RTCStatsQueries;
// Telemetry reporting every second after start of first call.
@ -309,7 +309,7 @@ PeerConnectionCtx::EverySecondTelemetryCallback_m(nsITimer* timer, void *closure
nsresult PeerConnectionCtx::Initialize() {
initGMP();
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mConnectionCounter = 0;
Telemetry::GetHistogramById(Telemetry::WEBRTC_CALL_COUNT)->Add(0);
@ -372,7 +372,7 @@ nsresult PeerConnectionCtx::Cleanup() {
PeerConnectionCtx::~PeerConnectionCtx() {
// ensure mTelemetryTimer ends on main thread
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mTelemetryTimer) {
mTelemetryTimer->Cancel();
}

Просмотреть файл

@ -49,7 +49,7 @@ class PeerConnectionCtx {
friend class PeerConnectionWrapper;
friend class mozilla::dom::WebrtcGlobalInformation;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// WebrtcGlobalInformation uses this; we put it here so we don't need to
// create another shutdown observer class.
mozilla::dom::Sequence<mozilla::dom::RTCStatsReportInternal>
@ -74,7 +74,7 @@ class PeerConnectionCtx {
static void
EverySecondTelemetryCallback_m(nsITimer* timer, void *);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Telemetry Peer conection counter
int mConnectionCounter;

Просмотреть файл

@ -46,7 +46,7 @@
#include "signaling/src/jsep/JsepSession.h"
#include "signaling/src/jsep/JsepSessionImpl.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#ifdef XP_WIN
// We need to undef the MS macro for nsIDocument::CreateEvent
#ifdef CreateEvent
@ -54,9 +54,7 @@
#endif
#endif // XP_WIN
#ifdef MOZILLA_INTERNAL_API
#include "nsIDocument.h"
#endif
#include "nsPerformance.h"
#include "nsGlobalWindow.h"
#include "nsDOMDataChannel.h"
@ -136,7 +134,7 @@ class JSErrorResult : public ErrorResult
public:
~JSErrorResult()
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
WouldReportJSException();
if (IsJSException()) {
MOZ_ASSERT(NS_IsMainThread());
@ -174,7 +172,7 @@ private:
};
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class TracksAvailableCallback : public DOMMediaStream::OnTracksAvailableCallback
{
public:
@ -264,7 +262,7 @@ private:
};
#endif
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
static nsresult InitNSSInContent()
{
NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_NOT_SAME_THREAD);
@ -320,7 +318,7 @@ const nsIID nsISupportsWeakReference::COMTypeInfo<nsSupportsWeakReference, void>
namespace mozilla {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RTCStatsQuery::RTCStatsQuery(bool internal) :
failed(false),
internalStats(internal),
@ -335,7 +333,7 @@ RTCStatsQuery::~RTCStatsQuery() {
NS_IMPL_ISUPPORTS0(PeerConnectionImpl)
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool
PeerConnectionImpl::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto,
@ -392,7 +390,7 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
, mTrickle(true) // TODO(ekr@rtfm.com): Use pref
, mShouldSuppressNegotiationNeeded(false)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
MOZ_ASSERT(NS_IsMainThread());
if (aGlobal) {
mWindow = do_QueryInterface(aGlobal->GetAsSupports());
@ -401,7 +399,7 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
CSFLogInfo(logTag, "%s: PeerConnectionImpl constructor for %s",
__FUNCTION__, mHandle.c_str());
STAMP_TIMECARD(mTimeCard, "Constructor Completed");
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mAllowIceLoopback = Preferences::GetBool(
"media.peerconnection.ice.loopback", false);
#endif
@ -428,7 +426,7 @@ PeerConnectionImpl::~PeerConnectionImpl()
Close();
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
{
// Deregister as an NSS Shutdown Object
nsNSSShutDownPreventionLock locker;
@ -454,7 +452,7 @@ PeerConnectionImpl::MakeMediaStream()
nsRefPtr<DOMMediaStream> stream =
DOMMediaStream::CreateSourceStream(GetWindow());
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Make the stream data (audio/video samples) accessible to the receiving page.
// We're only certain that privacy hasn't been requested if we're connected.
if (mDtlsConnected && !PrivacyRequested()) {
@ -510,7 +508,7 @@ nsresult
PeerConnectionImpl::ConvertRTCConfiguration(const RTCConfiguration& aSrc,
IceConfiguration *aDst)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (aSrc.mIceServers.WasPassed()) {
for (size_t i = 0; i < aSrc.mIceServers.Value().Length(); i++) {
nsresult rv = AddIceServer(aSrc.mIceServers.Value()[i], aDst);
@ -525,7 +523,7 @@ nsresult
PeerConnectionImpl::AddIceServer(const RTCIceServer &aServer,
IceConfiguration *aDst)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
NS_ENSURE_STATE(aServer.mUrls.WasPassed());
NS_ENSURE_STATE(aServer.mUrls.Value().IsStringSequence());
auto &urls = aServer.mUrls.Value().GetAsStringSequence();
@ -645,7 +643,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
mSTSThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &res);
MOZ_ASSERT(mSTSThread);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Initialize NSS if we are in content process. For chrome process, NSS should already
// been initialized.
@ -673,7 +671,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
// Ok if we truncate this.
char temp[128];
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsAutoCString locationCStr;
nsIDOMLocation* location;
res = mWindow->GetLocation(&location);
@ -840,6 +838,7 @@ class CompareCodecPriority {
nsresult
PeerConnectionImpl::ConfigureJsepSessionCodecs() {
#if !defined(MOZILLA_XPCOMRT_API)
nsresult res;
nsCOMPtr<nsIPrefService> prefs =
do_GetService("@mozilla.org/preferences-service;1", &res);
@ -890,7 +889,7 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
#endif // MOZ_WEBRTC_OMX
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool softwareH264Enabled = PeerConnectionCtx::GetInstance()->gmpHasH264();
#else
// For unit-tests
@ -991,7 +990,7 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
}
std::stable_sort(codecs.begin(), codecs.end(), comparator);
#endif // !defined(MOZILLA_XPCOMRT_API)
return NS_OK;
}
@ -1010,7 +1009,7 @@ PeerConnectionImpl::EnsureDataConnection(uint16_t aNumstreams)
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mDataConnection) {
CSFLogDebug(logTag,"%s DataConnection already connected",__FUNCTION__);
// Ignore the request to connect when already connected. This entire
@ -1120,7 +1119,7 @@ PeerConnectionImpl::InitializeDataChannel()
return NS_OK;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
uint32_t channels = codec->mChannels;
if (channels > MAX_NUM_STREAMS) {
channels = MAX_NUM_STREAMS;
@ -1166,7 +1165,7 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel,
uint16_t aStream,
ErrorResult &rv)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsRefPtr<nsDOMDataChannel> result;
rv = CreateDataChannel(aLabel, aProtocol, aType, outOfOrderAllowed,
aMaxTime, aMaxNum, aExternalNegotiated,
@ -1191,7 +1190,7 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel,
PC_AUTO_ENTER_API_CALL_NO_CHECK();
MOZ_ASSERT(aRetval);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsRefPtr<DataChannel> dataChannel;
DataChannelConnection::Type theType =
static_cast<DataChannelConnection::Type>(aType);
@ -1275,7 +1274,7 @@ do_QueryObjectReferent(nsIWeakReference* aRawPtr) {
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Not a member function so that we don't need to keep the PC live.
static void NotifyDataChannel_m(nsRefPtr<nsIDOMDataChannel> aChannel,
nsRefPtr<PeerConnectionObserver> aObserver)
@ -1303,7 +1302,7 @@ PeerConnectionImpl::NotifyDataChannel(already_AddRefed<DataChannel> aChannel)
CSFLogDebug(logTag, "%s: channel: %p", __FUNCTION__, channel);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsCOMPtr<nsIDOMDataChannel> domchannel;
nsresult rv = NS_NewDOMDataChannel(already_AddRefed<DataChannel>(channel),
mWindow, getter_AddRefs(domchannel));
@ -1328,7 +1327,7 @@ NS_IMETHODIMP
PeerConnectionImpl::CreateOffer(const RTCOfferOptions& aOptions)
{
JsepOfferOptions options;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (aOptions.mOfferToReceiveAudio.WasPassed()) {
options.mOfferToReceiveAudio =
mozilla::Some(size_t(aOptions.mOfferToReceiveAudio.Value()));
@ -1475,7 +1474,7 @@ PeerConnectionImpl::SetLocalDescription(int32_t aAction, const char* aSDP)
STAMP_TIMECARD(mTimeCard, "Set Local Description");
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool isolated = mMedia->AnyLocalStreamHasPeerIdentity();
mPrivacyRequested = mPrivacyRequested || isolated;
#endif
@ -1656,7 +1655,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
}
CSFLogDebug(logTag, "Added remote stream %s", info->GetId().c_str());
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
info->GetMediaStream()->AssignId(NS_ConvertUTF8toUTF16(streamId.c_str()));
#else
info->GetMediaStream()->AssignId((streamId));
@ -1687,7 +1686,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
}
// Now that the streams are all set up, notify about track availability.
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
TracksAvailableCallback* tracksAvailableCallback =
new TracksAvailableCallback(numNewAudioTracks,
numNewVideoTracks,
@ -1722,7 +1721,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
}
pco->OnSetRemoteDescriptionSuccess(jrv);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
startCallTelem();
#endif
}
@ -1733,7 +1732,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
// WebRTC uses highres time relative to the UNIX epoch (Jan 1, 1970, UTC).
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::GetTimeSinceEpoch(DOMHighResTimeStamp *result) {
MOZ_ASSERT(NS_IsMainThread());
@ -1765,7 +1764,7 @@ NS_IMETHODIMP
PeerConnectionImpl::GetStats(MediaStreamTrack *aSelector) {
PC_AUTO_ENTER_API_CALL(true);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!mMedia) {
// Since we zero this out before the d'tor, we should check.
return NS_ERROR_UNEXPECTED;
@ -1800,7 +1799,7 @@ PeerConnectionImpl::AddIceCandidate(const char* aCandidate, const char* aMid, un
CSFLogDebug(logTag, "AddIceCandidate: %s", aCandidate);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// When remote candidates are added before our ICE ctx is up and running
// (the transition to New is async through STS, so this is not impossible),
// we won't record them as trickle candidates. Is this what we want?
@ -1863,7 +1862,7 @@ PeerConnectionImpl::CloseStreams() {
return NS_OK;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::SetPeerIdentity(const nsAString& aPeerIdentity)
{
@ -1897,7 +1896,7 @@ PeerConnectionImpl::SetDtlsConnected(bool aPrivacyRequested)
// fixate on that peer. Dealing with multiple peers or connections is more
// than this run-down wreck of an object can handle.
// Besides, this is only used to say if we have been connected ever.
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!mPrivacyRequested && !aPrivacyRequested && !mDtlsConnected) {
// now we know that privacy isn't needed for sure
nsIDocument* doc = GetWindow()->GetExtantDoc();
@ -1913,7 +1912,7 @@ PeerConnectionImpl::SetDtlsConnected(bool aPrivacyRequested)
return NS_OK;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void
PeerConnectionImpl::PrincipalChanged(DOMMediaStream* aMediaStream) {
nsIDocument* doc = GetWindow()->GetExtantDoc();
@ -1925,7 +1924,7 @@ PeerConnectionImpl::PrincipalChanged(DOMMediaStream* aMediaStream) {
}
#endif
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::GetRemoteTrackId(const std::string streamId,
TrackID numericTrackId,
@ -1942,7 +1941,7 @@ PeerConnectionImpl::GetRemoteTrackId(const std::string streamId,
std::string
PeerConnectionImpl::GetTrackId(const MediaStreamTrack& aTrack)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString wideTrackId;
aTrack.GetId(wideTrackId);
return NS_ConvertUTF16toUTF8(wideTrackId).get();
@ -1954,7 +1953,7 @@ PeerConnectionImpl::GetTrackId(const MediaStreamTrack& aTrack)
std::string
PeerConnectionImpl::GetStreamId(const DOMMediaStream& aStream)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString wideStreamId;
aStream.GetId(wideStreamId);
return NS_ConvertUTF16toUTF8(wideStreamId).get();
@ -2016,7 +2015,7 @@ PeerConnectionImpl::AddTrack(MediaStreamTrack& aTrack,
}
if (aTrack.AsVideoStreamTrack()) {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!Preferences::GetBool("media.peerconnection.video.enabled", true)) {
// Before this code was moved, this would silently ignore just like it
// does now. Is this actually what we want to do?
@ -2091,7 +2090,7 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
}
JSErrorResult jrv;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (&aThisTrack == &aWithTrack) {
pco->OnReplaceTrackSuccess(jrv);
if (jrv.Failed()) {
@ -2308,7 +2307,7 @@ PeerConnectionImpl::PluginCrash(uint64_t aPluginID,
CSFLogError(logTag, "%s: Our plugin %llu crashed", __FUNCTION__, static_cast<unsigned long long>(aPluginID));
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
if (!doc) {
NS_WARNING("Couldn't get document for PluginCrashed event!");
@ -2350,7 +2349,7 @@ PeerConnectionImpl::CloseInt()
if (mJsepSession) {
mJsepSession->Close();
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mDataConnection) {
CSFLogInfo(logTag, "%s: Destroying DataChannelConnection %p for %s",
__FUNCTION__, (void *) mDataConnection.get(), mHandle.c_str());
@ -2373,7 +2372,7 @@ PeerConnectionImpl::ShutdownMedia()
if (!mMedia)
return;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// before we destroy references to local streams, detach from them
for(uint32_t i = 0; i < media()->LocalStreamsLength(); ++i) {
LocalSourceStreamInfo *info = media()->GetLocalStreamByIndex(i);
@ -2392,7 +2391,7 @@ PeerConnectionImpl::ShutdownMedia()
mMedia.forget().take()->SelfDestruct();
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// If NSS is shutting down, then we need to get rid of the DTLS
// identity right now; otherwise, we'll cause wreckage when we do
// finally deallocate it in our destructor.
@ -2648,7 +2647,7 @@ PeerConnectionImpl::SendLocalIceCandidateToContent(
NS_DISPATCH_NORMAL);
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
static bool isDone(PCImplIceConnectionState state) {
return state != PCImplIceConnectionState::Checking &&
state != PCImplIceConnectionState::New;
@ -2674,7 +2673,7 @@ void PeerConnectionImpl::IceConnectionStateChange(
auto domState = toDomIceConnectionState(state);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!isDone(mIceConnectionState) && isDone(domState)) {
// mIceStartTime can be null if going directly from New to Closed, in which
// case we don't count it as a success or a failure.
@ -2710,7 +2709,7 @@ void PeerConnectionImpl::IceConnectionStateChange(
STAMP_TIMECARD(mTimeCard, "Ice state: new");
break;
case PCImplIceConnectionState::Checking:
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// For telemetry
mIceStartTime = TimeStamp::Now();
#endif
@ -2800,7 +2799,7 @@ PeerConnectionImpl::EndOfLocalCandidates(const std::string& defaultAddr,
mJsepSession->EndOfLocalCandidates(defaultAddr, defaultPort, level);
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::BuildStatsQuery_m(
mozilla::dom::MediaStreamTrack *aSelector,
@ -3248,7 +3247,7 @@ void PeerConnectionImpl::DeliverStatsReportToPCObserver_m(
void
PeerConnectionImpl::RecordLongtermICEStatistics() {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
WebrtcGlobalInformation::StoreLongTermICEStatistics(*this);
#endif
}
@ -3280,7 +3279,7 @@ PeerConnectionImpl::IceStreamReady(NrIceMediaStream *aStream)
CSFLogDebug(logTag, "%s: %s", __FUNCTION__, aStream->name().c_str());
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
//Telemetry for when calls start
void
PeerConnectionImpl::startCallTelem() {
@ -3299,7 +3298,7 @@ NS_IMETHODIMP
PeerConnectionImpl::GetLocalStreams(nsTArray<nsRefPtr<DOMMediaStream > >& result)
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
for(uint32_t i=0; i < media()->LocalStreamsLength(); i++) {
LocalSourceStreamInfo *info = media()->GetLocalStreamByIndex(i);
NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
@ -3315,7 +3314,7 @@ NS_IMETHODIMP
PeerConnectionImpl::GetRemoteStreams(nsTArray<nsRefPtr<DOMMediaStream > >& result)
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
for(uint32_t i=0; i < media()->RemoteStreamsLength(); i++) {
RemoteSourceStreamInfo *info = media()->GetRemoteStreamByIndex(i);
NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);

Просмотреть файл

@ -33,7 +33,7 @@
#include "mozilla/dom/PeerConnectionImplEnumsBinding.h"
#include "StreamBuffer.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "mozilla/TimeStamp.h"
#include "mozilla/net/DataChannel.h"
#include "VideoUtils.h"
@ -129,7 +129,7 @@ using mozilla::DtlsIdentity;
using mozilla::ErrorResult;
using mozilla::NrIceStunServer;
using mozilla::NrIceTurnServer;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
using mozilla::PeerIdentity;
#endif
@ -186,7 +186,7 @@ private:
std::vector<NrIceTurnServer> mTurnServers;
};
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Not an inner class so we can forward declare.
class RTCStatsQuery {
public:
@ -228,7 +228,7 @@ class RTCStatsQuery {
#define PC_AUTO_ENTER_API_CALL_NO_CHECK() CheckThread()
class PeerConnectionImpl final : public nsISupports,
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
public mozilla::DataChannelConnection::DataConnectionListener,
public nsNSSShutDownObject,
public DOMMediaStream::PrincipalChangeObserver,
@ -253,7 +253,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
#endif
@ -271,7 +271,7 @@ public:
// DataConnection observers
void NotifyDataChannel(already_AddRefed<mozilla::DataChannel> aChannel)
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// PeerConnectionImpl only inherits from mozilla::DataChannelConnection
// inside libxul.
override
@ -425,7 +425,7 @@ public:
nsresult GetPeerIdentity(nsAString& peerIdentity)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mPeerIdentity) {
peerIdentity = mPeerIdentity->ToString();
return NS_OK;
@ -436,7 +436,7 @@ public:
return NS_OK;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
const PeerIdentity* GetPeerIdentity() const { return mPeerIdentity; }
nsresult SetPeerIdentity(const nsAString& peerIdentity);
@ -583,7 +583,7 @@ public:
bool HasMedia() const;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// initialize telemetry for when calls start
void startCallTelem();
@ -626,9 +626,11 @@ private:
MOZ_ASSERT(CheckThreadInt(), "Wrong thread");
}
bool CheckThreadInt() const {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Thread assertions are disabled in the C++ unit tests because those
// make API calls off the main thread.
// This affects the standalone version of WebRTC since it is also used
// for an alternate build of the unit tests.
// TODO(ekr@rtfm.com): Fix the unit tests so they don't do that.
bool on;
NS_ENSURE_SUCCESS(mThread->IsOnCurrentThread(&on), false);
@ -637,7 +639,7 @@ private:
return true;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void virtualDestroyNSSReference() final;
void destructorSafeDestroyNSSReference();
nsresult GetTimeSinceEpoch(DOMHighResTimeStamp *result);
@ -655,7 +657,7 @@ private:
const mozilla::JsepApplicationCodecDescription** codec,
uint16_t* level) const;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
static void GetStatsForPCObserver_s(
const std::string& pcHandle,
nsAutoPtr<RTCStatsQuery> query);
@ -707,7 +709,7 @@ private:
// identity-related fields
mozilla::RefPtr<DtlsIdentity> mIdentity;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// The entity on the other end of the peer-to-peer connection;
// void if they are not yet identified, and no identity setting has been set
nsAutoPtr<PeerIdentity> mPeerIdentity;
@ -729,7 +731,7 @@ private:
// The target to run stuff on
nsCOMPtr<nsIEventTarget> mSTSThread;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// DataConnection that's used to get all the DataChannels
nsRefPtr<mozilla::DataChannelConnection> mDataConnection;
#endif
@ -741,7 +743,7 @@ private:
mozilla::UniquePtr<PCUuidGenerator> mUuidGen;
mozilla::UniquePtr<mozilla::JsepSession> mJsepSession;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Start time of ICE, used for telemetry
mozilla::TimeStamp mIceStartTime;
// Start time of call used for Telemetry

Просмотреть файл

@ -23,6 +23,7 @@
#include "signaling/src/jsep/JsepSession.h"
#include "signaling/src/jsep/JsepTransport.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsICancelable.h"
@ -31,9 +32,11 @@
#include "nsIContentPolicy.h"
#include "nsIProxyInfo.h"
#include "nsIProtocolProxyService.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
#include "nsProxyRelease.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "MediaStreamList.h"
#include "nsIScriptGlobalObject.h"
#include "mozilla/Preferences.h"
@ -153,6 +156,7 @@ PeerConnectionImpl* PeerConnectionImpl::CreatePeerConnection()
return pc;
}
#if !defined(MOZILLA_XPCOMRT_API)
NS_IMETHODIMP PeerConnectionMedia::ProtocolProxyQueryHandler::
OnProxyAvailable(nsICancelable *request,
nsIChannel *aChannel,
@ -199,6 +203,7 @@ OnProxyAvailable(nsICancelable *request,
}
NS_IMPL_ISUPPORTS(PeerConnectionMedia::ProtocolProxyQueryHandler, nsIProtocolProxyCallback)
#endif // !defined(MOZILLA_XPCOMRT_API)
PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
: mParent(parent),
@ -217,6 +222,10 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
const std::vector<NrIceTurnServer>& turn_servers)
{
nsresult rv;
#if defined(MOZILLA_XPCOMRT_API)
// TODO(Bug 1126039) Standalone XPCOMRT does not currently support nsIProtocolProxyService or nsIIOService
mProxyResolveCompleted = true;
#else
nsCOMPtr<nsIProtocolProxyService> pps =
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv);
@ -237,7 +246,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
nsCOMPtr<nsIChannel> channel;
#ifdef MOZILLA_INTERNAL_API
#if defined(MOZILLA_INTERNAL_API)
nsCOMPtr<nsIDocument> principal = mParent->GetWindow()->GetExtantDoc();
#else
// For unit-tests
@ -256,7 +265,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
CSFLogError(logTag, "%s: Failed to get systemPrincipal: %d", __FUNCTION__, (int)rv);
return NS_ERROR_FAILURE;
}
#endif
#endif // defined(MOZILLA_INTERNAL_API)
rv = NS_NewChannel(getter_AddRefs(channel),
fakeHttpsLocation,
@ -279,6 +288,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
CSFLogError(logTag, "%s: Failed to resolve protocol proxy: %d", __FUNCTION__, (int)rv);
return NS_ERROR_FAILURE;
}
#endif // defined(MOZILLA_XPCOMRT_API)
// TODO(ekr@rtfm.com): need some way to set not offerer later
// Looks like a bug in the NrIceCtx API.
@ -296,7 +306,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
return rv;
}
// Give us a way to globally turn off TURN support
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool disabled = Preferences::GetBool("media.peerconnection.turn.disable", false);
#else
bool disabled = false;
@ -1045,7 +1055,7 @@ LocalSourceStreamInfo::TakePipelineFrom(RefPtr<LocalSourceStreamInfo>& info,
return NS_OK;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
/**
* Tells you if any local streams is isolated to a specific peer identity.
* Obviously, we want all the streams to be isolated equally so that they can
@ -1139,7 +1149,7 @@ SourceStreamInfo::AnyCodecHasPluginID(uint64_t aPluginID)
return false;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsRefPtr<mozilla::dom::VideoStreamTrack>
SourceStreamInfo::GetVideoTrackByTrackId(const std::string& trackId)
{

Просмотреть файл

@ -15,7 +15,9 @@
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsComponentManagerUtils.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "nsIProtocolProxyCallback.h"
#endif
#ifdef USE_FAKE_MEDIA_STREAMS
#include "FakeMediaStreams.h"
@ -27,7 +29,7 @@
#include "signaling/src/jsep/JsepSession.h"
#include "AudioSegment.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "Layers.h"
#include "VideoUtils.h"
#include "ImageLayers.h"
@ -105,7 +107,7 @@ public:
void DetachTransport_s();
void DetachMedia_m();
bool AnyCodecHasPluginID(uint64_t aPluginID);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsRefPtr<mozilla::dom::VideoStreamTrack> GetVideoTrackByTrackId(const std::string& trackId);
#endif
protected:
@ -134,7 +136,7 @@ public:
const std::string& oldTrackId,
const std::string& newTrackId);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void UpdateSinkIdentity_m(nsIPrincipal* aPrincipal,
const PeerIdentity* aSinkIdentity);
#endif
@ -159,7 +161,7 @@ class RemoteSourceStreamInfo : public SourceStreamInfo {
void SyncPipeline(RefPtr<MediaPipelineReceive> aPipeline);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void UpdatePrincipal_m(nsIPrincipal* aPrincipal);
#endif
@ -296,7 +298,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
const std::string& newStreamId,
const std::string& aNewTrack);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// In cases where the peer isn't yet identified, we disable the pipeline (not
// the stream, that would potentially affect others), so that it sends
// black/silence. Once the peer is identified, re-enable those streams.
@ -391,6 +393,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
SignalEndOfLocalCandidates;
private:
#if !defined(MOZILLA_XPCOMRT_API)
class ProtocolProxyQueryHandler : public nsIProtocolProxyCallback {
public:
explicit ProtocolProxyQueryHandler(PeerConnectionMedia *pcm) :
@ -406,6 +409,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
RefPtr<PeerConnectionMedia> pcm_;
virtual ~ProtocolProxyQueryHandler() {}
};
#endif // !defined(MOZILLA_XPCOMRT_API)
// Shutdown media transport. Must be called on STS thread.
void ShutdownMediaTransport_s();

Просмотреть файл

@ -33,6 +33,15 @@ namespace mozilla {
class MediaSegment;
};
class Fake_VideoSink {
public:
Fake_VideoSink() {}
virtual void SegmentReady(mozilla::MediaSegment* aSegment) = 0;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fake_VideoSink)
protected:
virtual ~Fake_VideoSink() {}
};
class Fake_SourceMediaStream;
class Fake_MediaStreamListener
@ -82,6 +91,16 @@ class Fake_MediaStream {
mListeners.erase(aListener);
}
void NotifyPull(mozilla::MediaStreamGraph* graph,
mozilla::StreamTime aDesiredTime) {
mozilla::MutexAutoLock lock(mMutex);
std::set<Fake_MediaStreamListener *>::iterator it;
for (it = mListeners.begin(); it != mListeners.end(); ++it) {
(*it)->NotifyPull(graph, aDesiredTime);
}
}
virtual Fake_SourceMediaStream *AsSourceStream() { return nullptr; }
virtual nsresult Start() { return NS_OK; }
@ -134,6 +153,11 @@ class Fake_SourceMediaStream : public Fake_MediaStream {
enum {
ADDTRACK_QUEUED = 0x01 // Queue track add until FinishAddTracks()
};
void AddVideoSink(const nsRefPtr<Fake_VideoSink>& aSink) {
mSink = aSink;
}
void AddTrack(mozilla::TrackID aID, mozilla::StreamTime aStart,
mozilla::MediaSegment* aSegment, uint32_t aFlags = 0) {
delete aSegment;
@ -182,6 +206,9 @@ class Fake_SourceMediaStream : public Fake_MediaStream {
} else {
//in the case of video segment appended, we just increase the
//segment count.
if (mSink.get()) {
mSink->SegmentReady(aSegment);
}
++mSegmentsAdded;
}
return true;
@ -217,6 +244,7 @@ class Fake_SourceMediaStream : public Fake_MediaStream {
bool mPullEnabled;
bool mStop;
nsRefPtr<Fake_MediaPeriodic> mPeriodic;
nsRefPtr<Fake_VideoSink> mSink;
nsCOMPtr<nsITimer> mTimer;
};
@ -249,6 +277,14 @@ public:
{
return mIsVideo? nullptr : this;
}
const uint32_t typeSize () const
{
return sizeof(Fake_MediaStreamTrack);
}
const char* typeName () const
{
return "Fake_MediaStreamTrack";
}
private:
~Fake_MediaStreamTrack() {}

Просмотреть файл

@ -55,6 +55,13 @@ public:
pc(peerConnection) {
}
AFakePCObserver() :
state(stateNoResponse), addIceSuccessCount(0),
onAddStreamCalled(false),
name(""),
pc(nullptr) {
}
virtual ~AFakePCObserver() {}
std::vector<mozilla::DOMMediaStream *> GetStreams() { return streams; }

Просмотреть файл

@ -0,0 +1,143 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
if CONFIG['OS_TARGET'] in ('Darwin', 'Android'):
DEFINES['GTEST_USE_OWN_TR1_TUPLE'] = 1
for var in ('MOZILLA_EXTERNAL_LINKAGE', 'USE_FAKE_MEDIA_STREAMS', 'USE_FAKE_PCOBSERVER',
'NR_SOCKET_IS_VOID_PTR', 'HAVE_STRDUP'):
DEFINES[var] = True
GENERATED_INCLUDES += [
'/dom/bindings',
]
LOCAL_INCLUDES += [
'/dom/media/',
'/ipc/chromium/src',
'/media/mtransport',
'/media/mtransport/test',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
'/media/webrtc',
'/media/webrtc/signaling/src/common/browser_logging',
'/media/webrtc/signaling/src/common/time_profiling',
'/media/webrtc/signaling/src/media',
'/media/webrtc/signaling/src/media-conduit',
'/media/webrtc/signaling/src/mediapipeline',
'/media/webrtc/signaling/src/peerconnection',
'/media/webrtc/signaling/src/sdp/sipcc',
'/media/webrtc/trunk',
'/media/webrtc/trunk/testing/gtest/include',
'/xpcom/base',
]
if CONFIG['OS_TARGET'] == 'Android':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
if CONFIG['OS_TARGET'] == 'Linux':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
if CONFIG['OS_TARGET'] == 'Darwin':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
OS_LIBS += [
'-framework AudioToolbox',
'-framework AudioUnit',
'-framework Carbon',
'-framework CoreAudio',
'-framework OpenGL',
'-framework QTKit',
'-framework QuartzCore',
'-framework Security',
'-framework SystemConfiguration',
'-framework IOKit',
'-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
'-framework CoreUI',
]
if CONFIG['OS_TARGET'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
]
USE_LIBS += [
'/media/webrtc/trunk/testing/gtest_gtest/gtest',
'gkmedias',
'nksrtp_s',
'nss',
'webrtc',
'yuv',
'zlib',
]
if CONFIG['BUILD_ARM_NEON']:
USE_LIBS += [
'yuv_neon',
]
if CONFIG['JS_SHARED_LIBRARY']:
USE_LIBS += [
'js',
]
USE_LIBS += ['mozglue']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
OS_LIBS += CONFIG['REALTIME_LIBS']
if CONFIG['MOZ_ALSA']:
OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
if CONFIG['MOZ_NATIVE_JPEG']:
OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
if CONFIG['MOZ_NATIVE_LIBVPX']:
OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS']
if not CONFIG['MOZ_TREE_PIXMAN']:
OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['MOZ_GTK2_LIBS']
OS_LIBS += [
'gmodule-2.0',
'gthread-2.0',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
OS_LIBS += CONFIG['MOZ_GTK3_LIBS']
USE_LIBS += [
'freetype',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['TK_LIBS']
OS_LIBS += CONFIG['MOZ_PANGO_LIBS']
if CONFIG['OS_TARGET'] in ('Linux', 'DragonFly', 'FreeBSD', 'NetBSD',
'OpenBSD'):
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
if CONFIG['OS_TARGET'] == 'Darwin':
OS_LIBS += CONFIG['TK_LIBS']
FAIL_ON_WARNINGS = True

Просмотреть файл

@ -28,7 +28,7 @@
#include "signaling/src/jsep/JsepSessionImpl.h"
#include "signaling/src/jsep/JsepTrack.h"
#include "TestHarness.h"
#include "mtransport_test_utils.h"
namespace mozilla {
static const char* kCandidates[] = {

Просмотреть файл

@ -9,145 +9,15 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'jsep_session_unittest',
'mediaconduit_unittests',
'mediapipeline_unittest',
'sdp_unittests',
'signaling_unittests',
'sdp_unittests',
'signaling_unittests',
])
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['OS_TARGET'] in ('Darwin', 'Android'):
DEFINES['GTEST_USE_OWN_TR1_TUPLE'] = 1
for var in ('USE_FAKE_MEDIA_STREAMS', 'USE_FAKE_PCOBSERVER',
'NR_SOCKET_IS_VOID_PTR', 'HAVE_STRDUP'):
DEFINES[var] = True
GENERATED_INCLUDES += [
'/dom/bindings',
]
LOCAL_INCLUDES += [
'/ipc/chromium/src',
'/media/mtransport',
'/media/mtransport/test',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
'/media/webrtc',
'/media/webrtc/signaling/src/common/browser_logging',
'/media/webrtc/signaling/src/common/time_profiling',
'/media/webrtc/signaling/src/media',
'/media/webrtc/signaling/src/media-conduit',
'/media/webrtc/signaling/src/mediapipeline',
'/media/webrtc/signaling/src/peerconnection',
'/media/webrtc/signaling/src/sdp/sipcc',
'/media/webrtc/trunk',
'/media/webrtc/trunk/testing/gtest/include',
'/xpcom/base',
]
if CONFIG['OS_TARGET'] == 'Android':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
if CONFIG['OS_TARGET'] == 'Linux':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
if CONFIG['OS_TARGET'] == 'Darwin':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
OS_LIBS += [
'-framework AudioToolbox',
'-framework AudioUnit',
'-framework Carbon',
'-framework CoreAudio',
'-framework OpenGL',
'-framework QTKit',
'-framework QuartzCore',
'-framework Security',
'-framework SystemConfiguration',
'-framework IOKit',
'-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
'-framework CoreUI',
]
if CONFIG['OS_TARGET'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
]
include('common.build')
USE_LIBS += [
'/media/webrtc/signalingtest/signaling_ecc/ecc',
'/media/webrtc/trunk/testing/gtest_gtest/gtest',
'gkmedias',
'mtransport_s',
'nksrtp_s',
'nss',
'webrtc',
'yuv',
'zlib',
]
if CONFIG['BUILD_ARM_NEON']:
USE_LIBS += [
'yuv_neon',
]
if CONFIG['JS_SHARED_LIBRARY']:
USE_LIBS += [
'js',
]
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
OS_LIBS += CONFIG['REALTIME_LIBS']
if CONFIG['MOZ_ALSA']:
OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
if CONFIG['MOZ_NATIVE_JPEG']:
OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
if CONFIG['MOZ_NATIVE_LIBVPX']:
OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS']
if not CONFIG['MOZ_TREE_PIXMAN']:
OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['MOZ_GTK2_LIBS']
OS_LIBS += [
'gmodule-2.0',
'gthread-2.0',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
OS_LIBS += CONFIG['MOZ_GTK3_LIBS']
USE_LIBS += [
'freetype',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['TK_LIBS']
OS_LIBS += CONFIG['MOZ_PANGO_LIBS']
if CONFIG['OS_TARGET'] in ('Linux', 'DragonFly', 'FreeBSD', 'NetBSD',
'OpenBSD'):
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
if CONFIG['OS_TARGET'] == 'Darwin':
OS_LIBS += CONFIG['TK_LIBS']
FAIL_ON_WARNINGS = True

Просмотреть файл

@ -31,8 +31,6 @@
#include "mozilla/Services.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsNetUtil.h"
#include "nsIIOService.h"
#include "nsIDNSService.h"
#include "nsWeakReference.h"
#include "nricectx.h"
@ -2112,6 +2110,9 @@ public:
uint16_t stun_port_;
};
#if !defined(MOZILLA_XPCOMRT_API)
// FIXME XPCOMRT doesn't support nsPrefService
// See Bug 1129188 - Create standalone libpref for use in standalone WebRTC
static void SetIntPrefOnMainThread(nsCOMPtr<nsIPrefBranch> prefs,
const char *pref_name,
int new_value) {
@ -2161,6 +2162,7 @@ class FsFrPrefClearer {
private:
nsCOMPtr<nsIPrefBranch> mPrefs;
};
#endif // !defined(MOZILLA_XPCOMRT_API)
TEST_P(SignalingTest, JustInit)
{
@ -3908,6 +3910,10 @@ TEST_P(SignalingTest, hugeSdp)
a2_->CreateAnswer(OFFER_AV);
}
#if !defined(MOZILLA_XPCOMRT_API)
// FIXME XPCOMRT doesn't support nsPrefService
// See Bug 1129188 - Create standalone libpref for use in standalone WebRTC
// Test max_fs and max_fr prefs have proper impact on SDP offer
TEST_P(SignalingTest, MaxFsFrInOffer)
{
@ -4042,6 +4048,7 @@ TEST_P(SignalingTest, MaxFsFrCallerCodec)
ASSERT_EQ(video_conduit->SendingMaxFs(), (unsigned short) 600);
ASSERT_EQ(video_conduit->SendingMaxFr(), (unsigned short) 60);
}
#endif // !defined(MOZILLA_XPCOMRT_API)
// Validate offer with multiple video codecs
TEST_P(SignalingTest, ValidateMultipleVideoCodecsInOffer)

Просмотреть файл

@ -0,0 +1,7 @@
/* -*- Mode: C++; tab-width: 8; 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/. */
#include "../jsep_session_unittest.cpp"

Просмотреть файл

@ -0,0 +1,5 @@
/* 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/. */
#include "../mediaconduit_unittests.cpp"

Просмотреть файл

@ -0,0 +1,7 @@
/* 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/. */
// Original author: ekr@rtfm.com
#include "../mediapipeline_unittest.cpp"

Просмотреть файл

@ -0,0 +1,58 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
# Standalone WebRTC does not link on Android.
# See Bug 1127510 - Standalone WebRTC unit tests fail to link on Android
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['OS_TARGET'] != 'Android':
CppUnitTests([
'jsep_session_unittest_standalone',
# mediaconduit_unittests disabled for standalone build until GMP support added.
# See Bug 1121677 - Enable GMP for WebRTC standalone.
# 'mediaconduit_unittests_standalone',
'mediapipeline_unittest_standalone',
'sdp_unittests_standalone',
'signaling_unittests_standalone',
])
include('/ipc/chromium/chromium-config.mozbuild')
include('../common.build')
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API'):
DEFINES[var] = True
if CONFIG['OS_TARGET'] == 'Linux':
USE_LIBS += [
'static:/nsprpub/lib/libc/src/plc4',
]
OS_LIBS += [
'-lrt',
]
LOCAL_INCLUDES += [
'..',
'/xpcom/libxpcomrt',
]
USE_LIBS += [
'/media/webrtc/signalingstandalone/signaling_ecc/ecc',
'fallible',
'media_standalone',
'mfbt',
'mozglue',
'mtransport_standalone',
'necko_standalone',
'nspr',
'nss',
'unicharutil_standalone',
'xpcomrt',
]
if CONFIG['OS_TARGET'] == 'Android':
USE_LIBS += [
'freetype',
]
USE_LIBS += ['mozglue']

Просмотреть файл

@ -0,0 +1,7 @@
/* -*- Mode: C++; tab-width: 8; 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/. */
#include "../sdp_unittests.cpp"

Просмотреть файл

@ -0,0 +1,5 @@
/* 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/. */
#include "../signaling_unittests.cpp"

Просмотреть файл

@ -61,9 +61,7 @@ DIRS += [
if CONFIG['MOZ_WEBRTC']:
DIRS += [
'/media/webrtc',
'/media/mtransport/third_party',
'/media/mtransport/build',
'/media/mtransport/standalone',
'/media/mtransport',
]
if CONFIG['MOZ_OMX_PLUGIN']:
@ -192,5 +190,6 @@ if CONFIG['ENABLE_TESTS']:
if CONFIG['MOZ_WEBRTC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
DIRS += [
'/media/webrtc/signaling/test',
'/media/webrtc/signaling/test/standalone',
'/media/mtransport/test',
]

Просмотреть файл

@ -397,6 +397,7 @@ nsComponentManagerImpl::Init()
#if defined(MOZILLA_XPCOMRT_API)
RegisterModule(&kXPCOMRTModule, nullptr);
RegisterModule(&kNeckoStandaloneModule, nullptr);
RegisterModule(&kStunUDPSocketFilterHandlerModule, nullptr);
#else
RegisterModule(&kXPCOMModule, nullptr);
#endif // defined(MOZILLA_XPCOMRT_API)

Просмотреть файл

@ -71,6 +71,7 @@ extern const char staticComponentType[];
#if defined(MOZILLA_XPCOMRT_API)
extern const mozilla::Module kXPCOMRTModule;
extern const mozilla::Module kNeckoStandaloneModule;
extern const mozilla::Module kStunUDPSocketFilterHandlerModule;
#else
extern const mozilla::Module kXPCOMModule;
#endif