Bug 1251737 - Remove remaining references to MOZILLA_XPCOMRT_API from media. r=jesup

This commit is contained in:
Eric Rahm 2016-02-27 11:12:07 -08:00
parent 579d900588
commit 813f5c3428
18 changed files with 16 additions and 131 deletions

View File

@ -11,9 +11,3 @@ DIRS += [
'/media/mtransport/build',
'/media/mtransport/testlib',
]
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
DIRS += [
'/media/mtransport/standalone',
]

View File

@ -114,7 +114,7 @@ nrappkit copyright:
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
// csi_platform.h deep in nrappkit defines LOG_INFO and LOG_WARNING
#ifdef LOG_INFO
#define LOG_TEMP_INFO LOG_INFO
@ -172,7 +172,7 @@ extern "C" {
// Implement the nsISupports ref counting
namespace mozilla {
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
class SingletonThreadHolder final
{
private:
@ -260,7 +260,7 @@ static void ClearSingletonOnShutdown()
static nsIThread* GetIOThreadAndAddUse_s()
{
// Always runs on STS thread!
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
// We need to safely release this on shutdown to avoid leaks
if (!sThread) {
sThread = new SingletonThreadHolder(NS_LITERAL_CSTRING("mtransport"));
@ -1076,7 +1076,7 @@ NrUdpSocketIpc::~NrUdpSocketIpc()
// also guarantees socket_child_ is released from the io_thread, and
// tells the SingletonThreadHolder we're done with it
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
// close(), but transfer the socket_child_ reference to die as well
RUN_ON_THREAD(io_thread_,
mozilla::WrapRunnableNM(&NrUdpSocketIpc::release_child_i,
@ -1544,7 +1544,7 @@ void NrUdpSocketIpc::close_i() {
}
}
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
// close(), but transfer the socket_child_ reference to die as well
// static
void NrUdpSocketIpc::release_child_i(nsIUDPSocketChild* aChild,
@ -1583,7 +1583,7 @@ void NrUdpSocketIpc::recv_callback_s(RefPtr<nr_udp_message> msg) {
}
}
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
// TCPSocket.
class NrTcpSocketIpc::TcpSocketReadyRunner: public nsRunnable
{
@ -2078,7 +2078,7 @@ NrSocketBase::CreateSocket(nr_transport_addr *addr, RefPtr<NrSocketBase> *sock)
*sock = new NrUdpSocketIpc();
break;
case IPPROTO_TCP:
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
{
nsCOMPtr<nsIThread> main_thread;
NS_GetMainThread(getter_AddRefs(main_thread));

View File

@ -73,7 +73,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
typedef struct nr_socket_vtbl_ nr_socket_vtbl;
typedef struct nr_socket_ nr_socket;
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
namespace mozilla {
namespace dom {
class TCPSocketChild;

View File

@ -422,7 +422,6 @@ void NrIceCtx::Init(bool allow_loopback,
int32_t ice_tcp_so_sock_count = 3;
int32_t ice_tcp_listen_backlog = 10;
nsAutoCString force_net_interface;
#ifndef MOZILLA_XPCOMRT_API
nsresult res;
nsCOMPtr<nsIPrefService> prefs =
do_GetService("@mozilla.org/preferences-service;1", &res);
@ -447,7 +446,7 @@ void NrIceCtx::Init(bool allow_loopback,
getter_Copies(force_net_interface));
}
}
#endif
NR_reg_set_uint4((char *)"stun.client.maximum_transmits",
stun_client_maximum_transmits);
NR_reg_set_uint4((char *)NR_ICE_REG_TRICKLE_GRACE_PERIOD,

View File

@ -1,21 +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/.
Library('mtransport_standalone')
include('../common.build')
include("/ipc/chromium/chromium-config.mozbuild")
# 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
FORCE_STATIC_LIB = True
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE'):
DEFINES[var] = True

View File

@ -14,10 +14,6 @@ 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 {
@ -214,26 +210,3 @@ 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

View File

@ -293,7 +293,6 @@
],
'defines' : [
'MOZILLA_INTERNAL_API',
'MOZILLA_XPCOMRT_API',
'MOZILLA_EXTERNAL_LINKAGE',
'NO_CHROMIUM_LOGGING',
'USE_FAKE_MEDIA_STREAMS',

View File

@ -12,9 +12,7 @@
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
#include "nsXULAppAPI.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "mozilla/Preferences.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
#else
#include "nsStringAPI.h"
#endif
@ -68,13 +66,11 @@ 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

View File

@ -5,9 +5,7 @@
#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;
@ -126,10 +124,8 @@ 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
@ -151,22 +147,16 @@ 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

View File

@ -260,7 +260,7 @@ bool WebrtcVideoConduit::GetRTCPSenderReport(DOMHighResTimeStamp* timestamp,
MediaConduitErrorCode
WebrtcVideoConduit::InitMain()
{
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
#if defined(MOZILLA_INTERNAL_API)
// already know we must be on MainThread barring unit test weirdness
MOZ_ASSERT(NS_IsMainThread());

View File

@ -1512,9 +1512,7 @@ MediaPipelineReceiveVideo::PipelineListener::PipelineListener(
: GenericReceiveListener(source, track_id, source->GraphRate(), queue_track),
width_(640),
height_(480),
#if defined(MOZILLA_XPCOMRT_API)
image_(new SimpleImageBuffer),
#elif defined(MOZILLA_INTERNAL_API)
#if defined(MOZILLA_INTERNAL_API)
image_container_(),
image_(),
#endif
@ -1547,11 +1545,7 @@ void MediaPipelineReceiveVideo::PipelineListener::RenderVideoFrame(
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 defined(MOZILLA_INTERNAL_API)
if (buffer) {
// Create a video frame using |buffer|.
#ifdef MOZ_WIDGET_GONK
@ -1595,9 +1589,7 @@ void MediaPipelineReceiveVideo::PipelineListener::
NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) {
ReentrantMonitorAutoEnter enter(monitor_);
#if defined(MOZILLA_XPCOMRT_API)
RefPtr<SimpleImageBuffer> image = image_;
#elif defined(MOZILLA_INTERNAL_API)
#if defined(MOZILLA_INTERNAL_API)
RefPtr<Image> image = image_;
// our constructor sets track_rate_ to the graph rate
MOZ_ASSERT(track_rate_ == source_->GraphRate());
@ -1621,12 +1613,6 @@ 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
}

View File

@ -780,9 +780,7 @@ class MediaPipelineReceiveVideo : public MediaPipelineReceive {
private:
int width_;
int height_;
#if defined(MOZILLA_XPCOMRT_API)
RefPtr<mozilla::SimpleImageBuffer> image_;
#elif defined(MOZILLA_INTERNAL_API)
#if defined(MOZILLA_INTERNAL_API)
RefPtr<layers::ImageContainer> image_container_;
RefPtr<layers::Image> image_;
#endif

View File

@ -953,7 +953,7 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
#ifdef MOZ_WEBRTC_OMX
encoder =
OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
#elif !defined(MOZILLA_XPCOMRT_API)
#else
encoder = GmpVideoCodec::CreateEncoder();
#endif
if (encoder) {
@ -966,7 +966,7 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
#ifdef MOZ_WEBRTC_OMX
decoder =
OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
#elif !defined(MOZILLA_XPCOMRT_API)
#else
decoder = GmpVideoCodec::CreateDecoder();
#endif
if (decoder) {

View File

@ -973,7 +973,6 @@ class CompareCodecPriority {
std::string mPreferredCodec;
};
#if !defined(MOZILLA_XPCOMRT_API)
class ConfigureCodec {
public:
explicit ConfigureCodec(nsCOMPtr<nsIPrefBranch>& branch) :
@ -1121,11 +1120,9 @@ class ConfigureCodec {
int32_t mVP8MaxFr;
bool mUseTmmbr;
};
#endif // !defined(MOZILLA_XPCOMRT_API)
nsresult
PeerConnectionImpl::ConfigureJsepSessionCodecs() {
#if !defined(MOZILLA_XPCOMRT_API)
nsresult res;
nsCOMPtr<nsIPrefService> prefs =
do_GetService("@mozilla.org/preferences-service;1", &res);
@ -1159,7 +1156,6 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
}
mJsepSession->SortCodecs(comparator);
#endif // !defined(MOZILLA_XPCOMRT_API)
return NS_OK;
}

View File

@ -23,7 +23,6 @@
#include "signaling/src/jsep/JsepSession.h"
#include "signaling/src/jsep/JsepTransport.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
@ -34,7 +33,6 @@
#include "nsIContentPolicy.h"
#include "nsIProxyInfo.h"
#include "nsIProtocolProxyService.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
#include "nsProxyRelease.h"
@ -158,7 +156,6 @@ PeerConnectionImpl* PeerConnectionImpl::CreatePeerConnection()
return pc;
}
#if !defined(MOZILLA_XPCOMRT_API)
NS_IMETHODIMP PeerConnectionMedia::ProtocolProxyQueryHandler::
OnProxyAvailable(nsICancelable *request,
nsIChannel *aChannel,
@ -221,7 +218,6 @@ PeerConnectionMedia::ProtocolProxyQueryHandler::SetProxyOnPcm(
}
NS_IMPL_ISUPPORTS(PeerConnectionMedia::ProtocolProxyQueryHandler, nsIProtocolProxyCallback)
#endif // !defined(MOZILLA_XPCOMRT_API)
PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
: mParent(parent),
@ -240,11 +236,6 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
NrIceCtx::Policy policy)
{
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);
if (NS_FAILED(rv)) {
@ -306,7 +297,6 @@ 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)
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool ice_tcp = Preferences::GetBool("media.peerconnection.ice.tcp", false);

View File

@ -15,9 +15,7 @@
#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"
@ -401,7 +399,6 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
SignalEndOfLocalCandidates;
private:
#if !defined(MOZILLA_XPCOMRT_API)
class ProtocolProxyQueryHandler : public nsIProtocolProxyCallback {
public:
explicit ProtocolProxyQueryHandler(PeerConnectionMedia *pcm) :
@ -418,7 +415,6 @@ 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();

View File

@ -5,7 +5,6 @@
#ifndef FakeLogging_h
#define FakeLogging_h
#if !defined(MOZILLA_XPCOMRT_API)
namespace mozilla {
namespace detail {
void log_print(const PRLogModuleInfo* aModule,
@ -13,6 +12,5 @@ void log_print(const PRLogModuleInfo* aModule,
const char* aFmt, ...) { }
}
}
#endif
#endif

View File

@ -2176,9 +2176,6 @@ 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) {
@ -2228,7 +2225,6 @@ class FsFrPrefClearer {
private:
nsCOMPtr<nsIPrefBranch> mPrefs;
};
#endif // !defined(MOZILLA_XPCOMRT_API)
TEST_P(SignalingTest, JustInit)
{
@ -4014,10 +4010,6 @@ 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)
{
@ -4152,7 +4144,6 @@ 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)