Bug 935857 - Replace MOZ_RTSP with proper NECKO_PROTOCOL handling. r=gps,r=vchang
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 12 Nov 2013 07:52:33 +0900
changeset 154475 260fbed9b3efc47a42a6caa46f99c69504f69e1d
parent 154474 30a667407079c0252b8e1c005eafa2dd06ef57e6
child 154476 60122ebcfee39e6a009b81fa0b3a20ea46879fe1
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersgps, vchang
bugs935857
milestone28.0a1
Bug 935857 - Replace MOZ_RTSP with proper NECKO_PROTOCOL handling. r=gps,r=vchang
b2g/installer/Makefile.in
configure.in
content/media/DecoderTraits.cpp
content/media/MediaDecoder.cpp
content/media/MediaDecoder.h
content/media/omx/moz.build
netwerk/base/src/Makefile.in
netwerk/base/src/StreamingProtocolService.cpp
netwerk/base/src/moz.build
netwerk/build/Makefile.in
netwerk/build/nsNetModule.cpp
netwerk/ipc/NeckoChild.cpp
netwerk/ipc/NeckoParent.cpp
netwerk/necko-config.h.in
netwerk/protocol/moz.build
toolkit/library/Makefile.in
--- a/b2g/installer/Makefile.in
+++ b/b2g/installer/Makefile.in
@@ -45,16 +45,20 @@ else
 BINPATH = bin
 endif
 DEFINES += -DBINPATH=$(BINPATH)
 
 ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
 DEFINES += -DMOZ_SHARED_MOZGLUE=1
 endif
 
+ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS)))
+DEFINES += -DMOZ_RTSP
+endif
+
 ifdef MOZ_PKG_MANIFEST_P
 $(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) FORCE
 	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
 ifdef MOZ_CHROME_MULTILOCALE
 	printf "\n[multilocale]\n" >> $@
 	for LOCALE in $(MOZ_CHROME_MULTILOCALE) ;\
 	do \
 	  printf "$(BINPATH)/chrome/$$LOCALE$(JAREXT)\n" >> $@; \
--- a/configure.in
+++ b/configure.in
@@ -3974,16 +3974,19 @@ MOZ_URL_CLASSIFIER=
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 NS_PRINTING=1
 MOZ_PDF_PRINTING=
 MOZ_DISABLE_CRYPTOLEGACY=
 NSS_DISABLE_DBM=
 NECKO_COOKIES=1
 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
+if test -n "$MOZ_RTSP"; then
+  NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
+fi
 USE_ARM_KUSER=
 BUILD_CTYPES=1
 MOZ_USE_NATIVE_POPUP_WINDOWS=
 MOZ_ANDROID_HISTORY=
 MOZ_WEBSMS_BACKEND=
 MOZ_ANDROID_BEAM=
 ACCESSIBILITY=1
 MOZ_TIME_MANAGER=
@@ -7285,24 +7288,16 @@ dnl ====================================
 dnl = Enable Radio FM for B2G (Gonk usually)
 dnl ========================================================
 if test -n "$MOZ_B2G_FM"; then
     AC_DEFINE(MOZ_B2G_FM)
 fi
 AC_SUBST(MOZ_B2G_FM)
 
 dnl ========================================================
-dnl = Enable Rtsp Protocol for B2G (Gonk usually)
-dnl ========================================================
-if test -n "$MOZ_RTSP"; then
-    AC_DEFINE(MOZ_RTSP)
-fi
-AC_SUBST(MOZ_RTSP)
-
-dnl ========================================================
 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(b2g-bt,
 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
     MOZ_B2G_BT=1,
     MOZ_B2G_BT= )
 if test -n "$MOZ_B2G_BT"; then
     AC_DEFINE(MOZ_B2G_BT)
--- a/content/media/DecoderTraits.cpp
+++ b/content/media/DecoderTraits.cpp
@@ -40,17 +40,17 @@
 #include "MediaPluginHost.h"
 #endif
 #ifdef MOZ_OMX_DECODER
 #include "MediaOmxDecoder.h"
 #include "MediaOmxReader.h"
 #include "nsIPrincipal.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 #endif
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 #include "RtspOmxDecoder.h"
 #include "RtspOmxReader.h"
 #endif
 #ifdef MOZ_WMF
 #include "WMFDecoder.h"
 #include "WMFReader.h"
 #endif
 #ifdef MOZ_DIRECTSHOW
@@ -239,33 +239,33 @@ static char const *const gH264Codecs[9] 
 };
 
 static char const *const gMpegAudioCodecs[2] = {
   "mp3",          // MP3
   nullptr
 };
 #endif
 
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 static const char* const gRtspTypes[2] = {
     "RTSP",
     nullptr
 };
 
 static bool
 IsRtspSupportedType(const nsACString& aMimeType)
 {
   return MediaDecoder::IsRtspEnabled() &&
     CodecListContains(gRtspTypes, aMimeType);
 }
 #endif
 
 /* static */
 bool DecoderTraits::DecoderWaitsForOnConnected(const nsACString& aMimeType) {
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
   return CodecListContains(gRtspTypes, aMimeType);
 #else
   return false;
 #endif
 }
 
 #ifdef MOZ_MEDIA_PLUGINS
 static bool
@@ -481,17 +481,17 @@ DecoderTraits::CreateDecoder(const nsACS
       }
       if (principal->GetAppStatus() < nsIPrincipal::APP_STATUS_PRIVILEGED) {
         return nullptr;
       }
     }
     decoder = new MediaOmxDecoder();
   }
 #endif
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
   if (IsRtspSupportedType(aType)) {
     decoder = new RtspOmxDecoder();
   }
 #endif
 #ifdef MOZ_MEDIA_PLUGINS
   if (MediaDecoder::IsMediaPluginsEnabled() &&
       GetMediaPluginHost()->FindDecoder(aType, nullptr)) {
     decoder = new MediaPluginDecoder(aType);
--- a/content/media/MediaDecoder.cpp
+++ b/content/media/MediaDecoder.cpp
@@ -1701,17 +1701,17 @@ MediaDecoder::IsWaveEnabled()
 #ifdef MOZ_WEBM
 bool
 MediaDecoder::IsWebMEnabled()
 {
   return Preferences::GetBool("media.webm.enabled");
 }
 #endif
 
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 bool
 MediaDecoder::IsRtspEnabled()
 {
   //Currently the Rtsp decoded by omx.
   return (Preferences::GetBool("media.rtsp.enabled", false) && IsOmxEnabled());
 }
 #endif
 
--- a/content/media/MediaDecoder.h
+++ b/content/media/MediaDecoder.h
@@ -183,16 +183,17 @@ destroying the MediaDecoder object.
 #include "nsIObserver.h"
 #include "nsAutoPtr.h"
 #include "MediaResource.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/TimeStamp.h"
 #include "MediaStreamGraph.h"
 #include "AudioChannelCommon.h"
 #include "AbstractMediaDecoder.h"
+#include "necko-config.h"
 
 class nsIStreamListener;
 class nsIMemoryReporter;
 class nsIPrincipal;
 class nsITimer;
 
 namespace mozilla {
 namespace dom {
@@ -766,17 +767,17 @@ public:
 
 #ifdef MOZ_WAVE
   static bool IsWaveEnabled();
 #endif
 
 #ifdef MOZ_WEBM
   static bool IsWebMEnabled();
 #endif
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
   static bool IsRtspEnabled();
 #endif
 
 #ifdef MOZ_GSTREAMER
   static bool IsGStreamerEnabled();
 #endif
 
 #ifdef MOZ_OMX_DECODER
--- a/content/media/omx/moz.build
+++ b/content/media/omx/moz.build
@@ -13,17 +13,17 @@ EXPORTS += [
 
 SOURCES += [
     'MediaOmxDecoder.cpp',
     'MediaOmxReader.cpp',
     'OMXCodecProxy.cpp',
     'OmxDecoder.cpp',
 ]
 
-if CONFIG['MOZ_RTSP']:
+if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
     EXPORTS += [
         'RtspOmxDecoder.h',
         'RtspOmxReader.h',
     ]
     SOURCES += [
         'RtspOmxDecoder.cpp',
         'RtspOmxReader.cpp',
     ]
--- a/netwerk/base/src/Makefile.in
+++ b/netwerk/base/src/Makefile.in
@@ -1,23 +1,15 @@
 # vim:set ts=8 sw=8 sts=8 noet:
 #
 # 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/.
 
-LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/base
-
-ifdef MOZ_RTSP
-LOCAL_INCLUDES  += -I$(topsrcdir)/netwerk/protocol/rtsp/controller
-LOCAL_INCLUDES  += -I$(topsrcdir)/netwerk/protocol/rtsp/rtsp
-endif
-
 ifdef MOZ_ENABLE_QTNETWORK
-	LOCAL_INCLUDES += -I$(srcdir)/../../system/qt
 	OS_INCLUDES += $(MOZ_QT_CFLAGS)
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_TARGET),Android)
 # this works around a "branch out of range" error when compiling this file opt
 nsURLParsers.$(OBJ_SUFFIX): MOZ_OPTIMIZE_FLAGS=
--- a/netwerk/base/src/StreamingProtocolService.cpp
+++ b/netwerk/base/src/StreamingProtocolService.cpp
@@ -2,18 +2,19 @@
  * 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 "base/basictypes.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "StreamingProtocolService.h"
 #include "mozilla/net/NeckoChild.h"
 #include "nsIURI.h"
+#include "necko-config.h"
 
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 #include "RtspControllerChild.h"
 #include "RtspController.h"
 #endif
 
 namespace mozilla {
 namespace net {
 
 NS_IMPL_ISUPPORTS1(StreamingProtocolControllerService,
--- a/netwerk/base/src/moz.build
+++ b/netwerk/base/src/moz.build
@@ -111,8 +111,22 @@ FAIL_ON_WARNINGS = True
 LIBXUL_LIBRARY = True
 
 MSVC_ENABLE_PGO = True
 
 LIBRARY_NAME = 'neckobase_s'
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
+LOCAL_INCLUDES += [
+    '/dom/base',
+]
+
+if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
+    LOCAL_INCLUDES += [
+        '/netwerk/protocol/rtsp/controller',
+        '/netwerk/protocol/rtsp/rtsp',
+    ]
+
+if CONFIG['MOZ_ENABLE_QTNETWORK']:
+    LOCAL_INCLUDES += [
+        '/netwerk/system/qt',
+    ]
--- a/netwerk/build/Makefile.in
+++ b/netwerk/build/Makefile.in
@@ -13,20 +13,16 @@ SHARED_LIBRARY_LIBS = \
   ../cache/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \
   ../cache2/$(LIB_PREFIX)nkcache2_s.$(LIB_SUFFIX) \
   ../protocol/about/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \
   $(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \
     ../protocol/$(d)/$(LIB_PREFIX)nk$(d)_s.$(LIB_SUFFIX)) \
   ../ipc/$(LIB_PREFIX)neckoipc_s.$(LIB_SUFFIX) \
   $(NULL)
 
-ifdef MOZ_RTSP
-SHARED_LIBRARY_LIBS += ../protocol/rtsp/$(LIB_PREFIX)nkrtsp_s.$(LIB_SUFFIX)
-endif
-
 ifdef MOZ_SRTP
 SHARED_LIBRARY_LIBS += \
   ../srtp/src/$(LIB_PREFIX)nksrtp_s.$(LIB_SUFFIX) \
   $(NULL)
 endif
 
 ifdef MOZ_SCTP
 SHARED_LIBRARY_LIBS += \
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -314,17 +314,17 @@ type##Constructor(nsISupports *aOuter, R
 
 WEB_SOCKET_HANDLER_CONSTRUCTOR(WebSocketChannel, false)
 WEB_SOCKET_HANDLER_CONSTRUCTOR(WebSocketSSLChannel, true)
 #undef WEB_SOCKET_HANDLER_CONSTRUCTOR
 } // namespace mozilla::net
 } // namespace mozilla
 #endif
 
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 #include "RtspHandler.h"
 namespace mozilla {
 namespace net {
 NS_GENERIC_FACTORY_CONSTRUCTOR(RtspHandler)
 } // namespace mozilla::net
 } // namespace mozilla
 #endif
 
@@ -793,17 +793,17 @@ NS_DEFINE_NAMED_CID(NS_VIEWSOURCEHANDLER
 #endif
 #ifdef NECKO_PROTOCOL_wyciwyg
 NS_DEFINE_NAMED_CID(NS_WYCIWYGPROTOCOLHANDLER_CID);
 #endif
 #ifdef NECKO_PROTOCOL_websocket
 NS_DEFINE_NAMED_CID(NS_WEBSOCKETPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_WEBSOCKETSSLPROTOCOLHANDLER_CID);
 #endif
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 NS_DEFINE_NAMED_CID(NS_RTSPPROTOCOLHANDLER_CID);
 #endif
 #if defined(XP_WIN)
 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
 #elif defined(MOZ_WIDGET_COCOA)
 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
 #elif defined(MOZ_ENABLE_QTNETWORK)
 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
@@ -935,17 +935,17 @@ static const mozilla::Module::CIDEntry k
     { &kNS_WYCIWYGPROTOCOLHANDLER_CID, false, nullptr, nsWyciwygProtocolHandlerConstructor },
 #endif
 #ifdef NECKO_PROTOCOL_websocket
     { &kNS_WEBSOCKETPROTOCOLHANDLER_CID, false, nullptr,
       mozilla::net::WebSocketChannelConstructor },
     { &kNS_WEBSOCKETSSLPROTOCOLHANDLER_CID, false, nullptr,
       mozilla::net::WebSocketSSLChannelConstructor },
 #endif
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
     { &kNS_RTSPPROTOCOLHANDLER_CID, false, nullptr, mozilla::net::RtspHandlerConstructor },
 #endif
 #if defined(XP_WIN)
     { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNotifyAddrListenerConstructor },
 #elif defined(MOZ_WIDGET_COCOA)
     { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNetworkLinkServiceConstructor },
 #elif defined(MOZ_ENABLE_QTNETWORK)
     { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsQtNetworkLinkServiceConstructor },
@@ -1080,17 +1080,17 @@ static const mozilla::Module::ContractID
 #endif
 #ifdef NECKO_PROTOCOL_wyciwyg
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg", &kNS_WYCIWYGPROTOCOLHANDLER_CID },
 #endif
 #ifdef NECKO_PROTOCOL_websocket
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ws", &kNS_WEBSOCKETPROTOCOLHANDLER_CID },
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wss", &kNS_WEBSOCKETSSLPROTOCOLHANDLER_CID },
 #endif
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "rtsp", &kNS_RTSPPROTOCOLHANDLER_CID },
 #endif
 #if defined(XP_WIN)
     { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
 #elif defined(MOZ_WIDGET_COCOA)
     { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
 #elif defined(MOZ_ENABLE_QTNETWORK)
     { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
--- a/netwerk/ipc/NeckoChild.cpp
+++ b/netwerk/ipc/NeckoChild.cpp
@@ -1,28 +1,29 @@
 
 /* vim: set sw=2 ts=8 et 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 "necko-config.h"
 #include "nsHttp.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/net/HttpChannelChild.h"
 #include "mozilla/net/CookieServiceChild.h"
 #include "mozilla/net/WyciwygChannelChild.h"
 #include "mozilla/net/FTPChannelChild.h"
 #include "mozilla/net/WebSocketChannelChild.h"
 #include "mozilla/net/RemoteOpenFileChild.h"
 #include "mozilla/dom/network/TCPSocketChild.h"
 #include "mozilla/dom/network/TCPServerSocketChild.h"
 #include "mozilla/dom/network/UDPSocketChild.h"
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 #include "mozilla/net/RtspControllerChild.h"
 #endif
 #include "SerializedLoadContext.h"
 
 using mozilla::dom::TCPSocketChild;
 using mozilla::dom::TCPServerSocketChild;
 using mozilla::dom::UDPSocketChild;
 
@@ -166,17 +167,17 @@ NeckoChild::AllocPRtspControllerChild()
 {
   NS_NOTREACHED("AllocPRtspController should not be called");
   return nullptr;
 }
 
 bool
 NeckoChild::DeallocPRtspControllerChild(PRtspControllerChild* child)
 {
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
   RtspControllerChild* p = static_cast<RtspControllerChild*>(child);
   p->ReleaseIPDLReference();
 #endif
   return true;
 }
 
 PTCPSocketChild*
 NeckoChild::AllocPTCPSocketChild()
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -1,23 +1,24 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=8 et 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 "necko-config.h"
 #include "nsHttp.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/net/HttpChannelParent.h"
 #include "mozilla/net/CookieServiceParent.h"
 #include "mozilla/net/WyciwygChannelParent.h"
 #include "mozilla/net/FTPChannelParent.h"
 #include "mozilla/net/WebSocketChannelParent.h"
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
 #include "mozilla/net/RtspControllerParent.h"
 #endif
 #include "mozilla/net/RemoteOpenFileParent.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/network/TCPSocketParent.h"
 #include "mozilla/dom/network/TCPServerSocketParent.h"
 #include "mozilla/dom/network/UDPSocketParent.h"
@@ -308,29 +309,29 @@ NeckoParent::DeallocPWebSocketParent(PWe
   WebSocketChannelParent* p = static_cast<WebSocketChannelParent*>(actor);
   p->Release();
   return true;
 }
 
 PRtspControllerParent*
 NeckoParent::AllocPRtspControllerParent()
 {
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
   RtspControllerParent* p = new RtspControllerParent();
   p->AddRef();
   return p;
 #else
   return nullptr;
 #endif
 }
 
 bool
 NeckoParent::DeallocPRtspControllerParent(PRtspControllerParent* actor)
 {
-#ifdef MOZ_RTSP
+#ifdef NECKO_PROTOCOL_rtsp
   RtspControllerParent* p = static_cast<RtspControllerParent*>(actor);
   p->Release();
 #endif
   return true;
 }
 
 PTCPSocketParent*
 NeckoParent::AllocPTCPSocketParent()
--- a/netwerk/necko-config.h.in
+++ b/netwerk/necko-config.h.in
@@ -11,13 +11,14 @@
 
 #undef NECKO_PROTOCOL_about
 #undef NECKO_PROTOCOL_data
 #undef NECKO_PROTOCOL_device
 #undef NECKO_PROTOCOL_file
 #undef NECKO_PROTOCOL_ftp
 #undef NECKO_PROTOCOL_http
 #undef NECKO_PROTOCOL_res
+#undef NECKO_PROTOCOL_rtsp
 #undef NECKO_PROTOCOL_viewsource
 #undef NECKO_PROTOCOL_websocket
 #undef NECKO_PROTOCOL_wyciwyg
 
 #endif
--- a/netwerk/protocol/moz.build
+++ b/netwerk/protocol/moz.build
@@ -1,25 +1,7 @@
 # -*- 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/.
 
-PARALLEL_DIRS += [
-    'about',
-    'app',
-    'data',
-    'device',
-    'file',
-    'ftp',
-    'http',
-    'res',
-    'viewsource',
-    'websocket',
-    'wyciwyg',
-]
-
-if CONFIG['MOZ_RTSP']:
-    PARALLEL_DIRS += [
-        'rtsp',
-    ]
-
+PARALLEL_DIRS += sorted(CONFIG['NECKO_PROTOCOLS'])
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -466,17 +466,17 @@ OS_LIBS += \
   -lstagefright_foundation \
   -lstagefright_omx \
   -lbinder \
   -lgui \
   $(DEPTH)/widget/gonk/nativewindow/$(LIB_PREFIX)nativewindow.$(LIB_SUFFIX) \
   $(NULL)
 endif
 
-ifdef MOZ_RTSP
+ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS)))
 OS_LIBS += -lstagefright_foundation
 endif
 
 ifdef MOZ_WMF
 OS_LIBS += $(call EXPAND_LIBNAME,mfuuid wmcodecdspuuid strmiids)
 endif
 
 ifdef MOZ_DIRECTSHOW