Bug 792188: rollup of changes to signaling from alder r=jesup,ekr,derf,ehugg,ted
authorRandell Jesup <rjesup@jesup.org>
Sun, 07 Oct 2012 01:34:29 -0400
changeset 109552 4bea9e9d2e2c0cbd23c59cb12ac97b0c8cc26e17
parent 109551 f1b524d51e6b055a5e8fd1c07d37ddc4805c4a03
child 109553 7c84f16616074286430165034bcf0e990c04e655
push id23632
push userphilringnalda@gmail.com
push dateSun, 07 Oct 2012 19:14:37 +0000
treeherdermozilla-central@83d38854c21e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, ekr, derf, ehugg, ted
bugs792188, 797258
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 792188: rollup of changes to signaling from alder r=jesup,ekr,derf,ehugg,ted Bug 797258: Increase max sdp line length to work with longer SHA-256 fingerprints. r=jesup
configure.in
media/webrtc/Makefile.in
media/webrtc/signaling/include/CC_Call.h
media/webrtc/signaling/include/CC_CallInfo.h
media/webrtc/signaling/include/CC_Common.h
media/webrtc/signaling/include/CC_Device.h
media/webrtc/signaling/include/CC_Observer.h
media/webrtc/signaling/include/CC_Service.h
media/webrtc/signaling/include/CSFVideoControl.h
media/webrtc/signaling/include/CallControlManager.h
media/webrtc/signaling/include/ECC_Observer.h
media/webrtc/signaling/include/ECC_Types.h
media/webrtc/signaling/include/SharedPtr.h
media/webrtc/signaling/signaling.gyp
media/webrtc/signaling/src/callcontrol/CallControlManagerImpl.cpp
media/webrtc/signaling/src/callcontrol/CallControlManagerImpl.h
media/webrtc/signaling/src/common/Wrapper.h
media/webrtc/signaling/src/common/browser_logging/CSFLogStream.h
media/webrtc/signaling/src/common/csf_common.h
media/webrtc/signaling/src/media-conduit/AudioConduit.cpp
media/webrtc/signaling/src/media-conduit/AudioConduit.h
media/webrtc/signaling/src/media-conduit/CodecConfig.h
media/webrtc/signaling/src/media-conduit/MediaConduitErrors.h
media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
media/webrtc/signaling/src/media-conduit/MediaEngineWrapper.h
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/media-conduit/VideoConduit.h
media/webrtc/signaling/src/media-conduit/VideoTypes.h
media/webrtc/signaling/src/media/CSFAudioTermination.h
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
media/webrtc/signaling/src/media/VcmSIPCCBinding.h
media/webrtc/signaling/src/media/cip_mmgr_mediadefinitions.h
media/webrtc/signaling/src/media/webrtc/WebrtcAudioCodecSelector.cpp
media/webrtc/signaling/src/media/webrtc/WebrtcAudioCodecSelector.h
media/webrtc/signaling/src/media/webrtc/WebrtcAudioProvider.cpp
media/webrtc/signaling/src/media/webrtc/WebrtcAudioProvider.h
media/webrtc/signaling/src/media/webrtc/WebrtcLogging.h
media/webrtc/signaling/src/media/webrtc/WebrtcMediaProvider.cpp
media/webrtc/signaling/src/media/webrtc/WebrtcMediaProvider.h
media/webrtc/signaling/src/media/webrtc/WebrtcRingGenerator.cpp
media/webrtc/signaling/src/media/webrtc/WebrtcRingGenerator.h
media/webrtc/signaling/src/media/webrtc/WebrtcToneGenerator.cpp
media/webrtc/signaling/src/media/webrtc/WebrtcToneGenerator.h
media/webrtc/signaling/src/media/webrtc/WebrtcVideoProvider.cpp
media/webrtc/signaling/src/media/webrtc/WebrtcVideoProvider.h
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
media/webrtc/signaling/src/mediapipeline/SrtpFlow.cpp
media/webrtc/signaling/src/mediapipeline/SrtpFlow.h
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
media/webrtc/signaling/src/sipcc/core/ccapp/call_logger.c
media/webrtc/signaling/src/sipcc/core/ccapp/capability_set.c
media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
media/webrtc/signaling/src/sipcc/core/ccapp/cc_device_manager.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_config.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_service.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_snapshot.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapp_task.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
media/webrtc/signaling/src/sipcc/core/ccapp/conf_roster.c
media/webrtc/signaling/src/sipcc/core/ccapp/conf_roster.h
media/webrtc/signaling/src/sipcc/core/common/cfgfile_utils.c
media/webrtc/signaling/src/sipcc/core/common/config_api.c
media/webrtc/signaling/src/sipcc/core/common/config_parser.c
media/webrtc/signaling/src/sipcc/core/common/config_parser.h
media/webrtc/signaling/src/sipcc/core/common/init.c
media/webrtc/signaling/src/sipcc/core/common/misc.c
media/webrtc/signaling/src/sipcc/core/common/prot_cfgmgr_private.h
media/webrtc/signaling/src/sipcc/core/common/prot_configmgr.c
media/webrtc/signaling/src/sipcc/core/common/prot_configmgr.h
media/webrtc/signaling/src/sipcc/core/common/sip_socket_api.c
media/webrtc/signaling/src/sipcc/core/common/subscription_handler.c
media/webrtc/signaling/src/sipcc/core/common/ui.c
media/webrtc/signaling/src/sipcc/core/common/vcm_util.c
media/webrtc/signaling/src/sipcc/core/common/xml_util.c
media/webrtc/signaling/src/sipcc/core/gsm/ccapi.c
media/webrtc/signaling/src/sipcc/core/gsm/dcsm.c
media/webrtc/signaling/src/sipcc/core/gsm/fim.c
media/webrtc/signaling/src/sipcc/core/gsm/fsmcac.c
media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp_crypto.c
media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
media/webrtc/signaling/src/sipcc/core/gsm/h/lsm.h
media/webrtc/signaling/src/sipcc/core/gsm/lsm.c
media/webrtc/signaling/src/sipcc/core/gsm/media_cap_tbl.c
media/webrtc/signaling/src/sipcc/core/gsm/subapi.c
media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
media/webrtc/signaling/src/sipcc/core/includes/config.h
media/webrtc/signaling/src/sipcc/core/includes/debug.h
media/webrtc/signaling/src/sipcc/core/includes/phone_platform_constants.h
media/webrtc/signaling/src/sipcc/core/includes/platform_api.h
media/webrtc/signaling/src/sipcc/core/includes/sessionConstants.h
media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
media/webrtc/signaling/src/sipcc/core/includes/uiapi.h
media/webrtc/signaling/src/sipcc/core/includes/xml_util.h
media/webrtc/signaling/src/sipcc/core/sdp/sdp.h
media/webrtc/signaling/src/sipcc/core/sdp/sdp_access.c
media/webrtc/signaling/src/sipcc/core/sdp/sdp_attr.c
media/webrtc/signaling/src/sipcc/core/sdp/sdp_attr_access.c
media/webrtc/signaling/src/sipcc/core/sdp/sdp_main.c
media/webrtc/signaling/src/sipcc/core/sdp/sdp_private.h
media/webrtc/signaling/src/sipcc/core/sdp/sdp_token.c
media/webrtc/signaling/src/sipcc/core/sdp/sdp_utils.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_callinfo.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_common_util.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_core.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_info.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_messaging.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_platform_tcp.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_platform_timers.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_platform_udp.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_pmh.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_publish.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_register.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_spi_utils.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_subsmanager.c
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_task.c
media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_platform_tcp.h
media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_sdp.h
media/webrtc/signaling/src/sipcc/core/sipstack/httpish.c
media/webrtc/signaling/src/sipcc/core/sipstack/sip_common_regmgr.c
media/webrtc/signaling/src/sipcc/core/sipstack/sip_common_transport.c
media/webrtc/signaling/src/sipcc/core/sipstack/sip_platform_task.c
media/webrtc/signaling/src/sipcc/core/src-common/dialplan.c
media/webrtc/signaling/src/sipcc/core/src-common/dialplanint.c
media/webrtc/signaling/src/sipcc/core/src-common/kpml_common_util.c
media/webrtc/signaling/src/sipcc/core/src-common/kpmlmap.c
media/webrtc/signaling/src/sipcc/core/src-common/misc_apps_task.c
media/webrtc/signaling/src/sipcc/core/src-common/pres_sub_not_handler.c
media/webrtc/signaling/src/sipcc/core/src-common/util_string.c
media/webrtc/signaling/src/sipcc/cpr/common/cpr_string.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_chunk.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_chunk.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_init.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_memory.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_memory.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_memory_api.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_socket.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_socket.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_stdlib.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_stdlib.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_string.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_string.h
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_threads.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c
media/webrtc/signaling/src/sipcc/cpr/include/cpr_memory.h
media/webrtc/signaling/src/sipcc/cpr/include/cpr_stdlib.h
media/webrtc/signaling/src/sipcc/cpr/include/cpr_string.h
media/webrtc/signaling/src/sipcc/cpr/include/cpr_threads.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_chunk.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_chunk.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_ipc.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_ipc.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_memory.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_memory.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_memory_api.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_socket.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_socket.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_stdlib.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_stdlib.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_string.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_string.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_timers_using_select.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_init.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_ipc.h
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_memory.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_memory.h
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_socket.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_socket.h
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_stdlib.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_stdlib.h
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_string.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_string.h
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_timers.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_types.h
media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
media/webrtc/signaling/src/sipcc/include/cc_config.h
media/webrtc/signaling/src/sipcc/include/cc_constants.h
media/webrtc/signaling/src/sipcc/include/cc_types.h
media/webrtc/signaling/src/sipcc/include/ccapi_call.h
media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h
media/webrtc/signaling/src/sipcc/include/ccapi_call_listener.h
media/webrtc/signaling/src/sipcc/include/ccapi_service.h
media/webrtc/signaling/src/sipcc/include/ccsdp.h
media/webrtc/signaling/src/sipcc/include/config_api.h
media/webrtc/signaling/src/sipcc/include/peer_connection_types.h
media/webrtc/signaling/src/sipcc/include/plat_api.h
media/webrtc/signaling/src/sipcc/include/vcm.h
media/webrtc/signaling/src/sipcc/include/xml_parser.h
media/webrtc/signaling/src/sipcc/plat/common/libxml_parser.c
media/webrtc/signaling/src/sipcc/plat/common/plat_sec_api.c
media/webrtc/signaling/src/sipcc/plat/darwin/plat_api_stub.c
media/webrtc/signaling/src/sipcc/plat/linux/plat_api_stub.c
media/webrtc/signaling/src/sipcc/plat/win32/mystub.c
media/webrtc/signaling/src/sipcc/plat/win32/plat_api_stub.c
media/webrtc/signaling/src/sipcc/plat/win32/plat_api_win.c
media/webrtc/signaling/src/sipcc/stub/vcm_stub.c
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCDevice.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCDevice.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCLine.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.h
media/webrtc/signaling/src/softphonewrapper/ccapi_plat_api_impl.cpp
media/webrtc/signaling/test/FakeMediaStreams.h
media/webrtc/signaling/test/FakeMediaStreamsImpl.h
media/webrtc/signaling/test/Makefile.in
media/webrtc/signaling/test/mediaconduit_unittests.cpp
media/webrtc/signaling/test/mediapipeline_unittest.cpp
media/webrtc/signaling/test/signaling_unittests.cpp
toolkit/toolkit-makefiles.sh
toolkit/toolkit-tiers.mk
--- a/configure.in
+++ b/configure.in
@@ -5239,18 +5239,18 @@ MOZ_ARG_DISABLE_BOOL(webrtc,
 if test -n "$MOZ_WEBRTC"; then
     AC_DEFINE(MOZ_WEBRTC)
     MOZ_MEDIA=1
     MOZ_RAW=1
     MOZ_VP8=1
     MOZ_VP8_ENCODER=1
     MOZ_VP8_ERROR_CONCEALMENT=1
 dnl enable once Signaling lands
-dnl MOZ_WEBRTC_SIGNALING=1
-dnl AC_DEFINE(MOZ_WEBRTC_SIGNALING)
+    MOZ_WEBRTC_SIGNALING=1
+    AC_DEFINE(MOZ_WEBRTC_SIGNALING)
     if test "${OS_TARGET}" = "WINNT"; then
         MOZ_WEBRTC_IN_LIBXUL=1
     fi
 dnl enable once PeerConnection lands
 dnl MOZ_PEERCONNECTION=1
 dnl AC_DEFINE(MOZ_PEERCONNECTION)
     MOZ_SCTP=1
     MOZ_SRTP=1
--- a/media/webrtc/Makefile.in
+++ b/media/webrtc/Makefile.in
@@ -7,13 +7,15 @@ topsrcdir	= @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   trunk \
   trunk/testing \
+  signaling \
+  signalingtest \
   $(NULL)
 
 # These Makefiles don't have corresponding Makefile.ins
 NO_SUBMAKEFILES_RULE = 1
 include $(topsrcdir)/config/rules.mk
--- a/media/webrtc/signaling/include/CC_Call.h
+++ b/media/webrtc/signaling/include/CC_Call.h
@@ -70,17 +70,17 @@ namespace CSF
         /**
            Originate call - API to go offhook and dial specified digits on a given call
 
            @param [in] video_pref - video direction desired on call
            @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook
 
            @return true or false.
          */
-        virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits, char* sdp, int audioPort, int videoPort) = 0;
+        virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits) = 0;
 
         /**
            Use this function to answer an incoming call.
 
            @param[in] video_pref - video direction desired on call
 
            @return true or false.
          */
@@ -294,14 +294,32 @@ namespace CSF
 
         /**
            Originate P2P call - API to go offhook and dial specified digits\user on a given call
 
            @param [in] video_pref - video direction desired on call
            @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook
            @param [in] ip address - the ip address of the peer to call
 
-           @return true or false.
-         */
-        virtual bool originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0;
+           @return void
+          */
+        virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0;
+
+        virtual void createOffer (const std::string & hints) = 0;
+
+        virtual void createAnswer(const std::string & hints, const std::string & offersdp) = 0;
+
+        virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
+
+        virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
 
+        virtual void setPeerConnection(const std::string& handle) = 0;
+
+        virtual void addStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) = 0;
+
+        virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) = 0;
+
+        virtual const std::string& getPeerConnection() const = 0;
+
+        virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level) = 0;
     };
-};
+}
+
--- a/media/webrtc/signaling/include/CC_CallInfo.h
+++ b/media/webrtc/signaling/include/CC_CallInfo.h
@@ -43,16 +43,17 @@
 
 extern "C"
 {
 #include "ccapi_types.h"
 }
 
 #include "CC_Common.h"
 #include "CC_CallTypes.h"
+#include "peer_connection_types.h"
 
 namespace CSF
 {
 
 	class ECC_API CC_CallInfo
     {
     protected:
         CC_CallInfo() { }
@@ -71,16 +72,30 @@ namespace CSF
         /**
            get Call state
            @param [in] handle - call info handle
            @return call state
          */
         virtual cc_call_state_t getCallState () = 0;
 
         /**
+           print Call state
+           @param [in] handle - call info handle
+           @return call state as string
+         */
+        virtual std::string callStateToString (cc_call_state_t state) = 0;
+
+        /**
+           print Call event
+           @param [in] call event
+           @return call event as string
+         */
+        virtual std::string callEventToString (ccapi_call_event_e callEvent) = 0;
+
+        /**
            Get ringer state.
 
            @return bool ringer state.
          */
         virtual bool getRingerState() = 0;
 
         /**
            Get call attributes
@@ -325,10 +340,32 @@ namespace CSF
           */
         virtual bool isVideoMuted(void) = 0;
 
         /**
           Get the current call volume level
           @return int - the current call volume level, or -1 if it cannot be determined
         */
         virtual int getVolume() = 0;
+
+        /**
+           get SDP from info object returned from JSEP functions 
+           @param [in] handle - call info handle
+           @return SDP string
+         */
+        virtual std::string getSDP() = 0;
+
+        /**
+           get status code
+           @param [in] handle - call info handle
+           @return code
+         */
+        virtual cc_int32_t getStatusCode() = 0;
+
+        /**
+           get media streams
+           @return media stream table
+           Note:Ownership of the MediaStreamTable is responsibiliy of 
+           the caller.
+         */
+        virtual MediaStreamTable* getMediaStreams() const = 0;
     };
 };
--- a/media/webrtc/signaling/include/CC_Common.h
+++ b/media/webrtc/signaling/include/CC_Common.h
@@ -48,22 +48,22 @@
 #define ECC_API _declspec(dllimport)
 #else
 #define ECC_API
 #endif
 #endif
 
 namespace CSF
 {
-	DECLARE_PTR(CallControlManager);
-	DECLARE_PTR_VECTOR(PhoneDetails);
-    DECLARE_PTR(CC_Service);
-    DECLARE_PTR(VideoControl);
-    DECLARE_PTR(AudioControl);
-    DECLARE_PTR_VECTOR(CC_Device);
-    DECLARE_PTR(CC_DeviceInfo);
-    DECLARE_PTR(CC_CallServerInfo);
-    DECLARE_PTR(CC_FeatureInfo);
-    DECLARE_PTR_VECTOR(CC_Line);
-    DECLARE_PTR(CC_LineInfo);
-	DECLARE_PTR_VECTOR(CC_Call);
-    DECLARE_PTR(CC_CallInfo);
+    DECLARE_PTR(CallControlManager)
+    DECLARE_PTR_VECTOR(PhoneDetails)
+    DECLARE_PTR(CC_Service)
+    DECLARE_PTR(VideoControl)
+    DECLARE_PTR(AudioControl)
+    DECLARE_PTR_VECTOR(CC_Device)
+    DECLARE_PTR(CC_DeviceInfo)
+    DECLARE_PTR(CC_CallServerInfo)
+    DECLARE_PTR(CC_FeatureInfo)
+    DECLARE_PTR_VECTOR(CC_Line)
+    DECLARE_PTR(CC_LineInfo)
+    DECLARE_PTR_VECTOR(CC_Call)
+    DECLARE_PTR(CC_CallInfo)
 }
--- a/media/webrtc/signaling/include/CC_Device.h
+++ b/media/webrtc/signaling/include/CC_Device.h
@@ -75,9 +75,9 @@ namespace CSF
         virtual void enableCamera(bool enable) = 0;    
 		virtual void setDigestNamePasswd (char *name, char *pw) = 0;
 
     private:
 		// Cannot copy - clients should be passing the pointer not the object.
 		CC_Device& operator=(const CC_Device& rhs);
 		CC_Device(const CC_Device&);
     };
-};
+}
--- a/media/webrtc/signaling/include/CC_Observer.h
+++ b/media/webrtc/signaling/include/CC_Observer.h
@@ -52,12 +52,12 @@ namespace CSF
 	 * These callbacks relate to the "core" Call Control API objects CC_Device, CC_Line and CC_Call.
 	 */
     class ECC_API CC_Observer
     {
     public:
         virtual void onDeviceEvent  ( ccapi_device_event_e deviceEvent, CC_DevicePtr device, CC_DeviceInfoPtr info ) = 0;
         virtual void onFeatureEvent ( ccapi_device_event_e deviceEvent, CC_DevicePtr device, CC_FeatureInfoPtr feature_info) = 0;
         virtual void onLineEvent    ( ccapi_line_event_e lineEvent,     CC_LinePtr line,     CC_LineInfoPtr info ) = 0;
-        virtual void onCallEvent    ( ccapi_call_event_e callEvent,     CC_CallPtr call,     CC_CallInfoPtr infog, char* sdp ) = 0;
+        virtual void onCallEvent    ( ccapi_call_event_e callEvent,     CC_CallPtr call,     CC_CallInfoPtr infog ) = 0;
     };
 
 }
--- a/media/webrtc/signaling/include/CC_Service.h
+++ b/media/webrtc/signaling/include/CC_Service.h
@@ -107,16 +107,15 @@ namespace CSF
          * TODO: Assuming for now that media init aligns with init/destroy.
          */
         virtual AudioControlPtr getAudioControl() = 0;
         virtual VideoControlPtr getVideoControl() = 0;
 
         virtual bool setLocalVoipPort(int port) = 0;
         virtual bool setRemoteVoipPort(int port) = 0;
         virtual bool setP2PMode(bool mode) = 0;
-        virtual bool setROAPProxyMode(bool mode) = 0;
-        virtual bool setROAPClientMode(bool mode) = 0;
+        virtual bool setSDPMode(bool mode) = 0;
 
     private:
         CC_Service(const CC_Service& rhs);
         CC_Service& operator=(const CC_Service& rhs);
     };
 }
--- a/media/webrtc/signaling/include/CSFVideoControl.h
+++ b/media/webrtc/signaling/include/CSFVideoControl.h
@@ -46,16 +46,18 @@
 #include <vector>
 
 namespace CSF
 {
 	DECLARE_PTR(VideoControl);
 	class ECC_API VideoControl
 	{
 	public:
+		virtual ~VideoControl() {};
+
 		virtual void setVideoMode( bool enable ) = 0;
 
 		// window type is platform-specific
 		virtual void setPreviewWindow( VideoWindowHandle window, int top, int left, int bottom, int right, RenderScaling style ) = 0;
 		virtual void showPreviewWindow( bool show ) = 0;
 
 		// device names are in UTF-8 encoding
 		virtual std::vector<std::string> getCaptureDevices() = 0;
--- a/media/webrtc/signaling/include/CallControlManager.h
+++ b/media/webrtc/signaling/include/CallControlManager.h
@@ -64,17 +64,17 @@
  *  @li Call Control events are raised to the CSF::CC_Observer interface.
  *  @li Audio/Video device selection and global media configuration is performed via CSF::AudioControl
  *      and CSF::VideoControl.  Per-call media operations (mute, volume, etc) are integrated onto
  *      the CSF::CC_Call and CSF::CC_CallInfo interfaces.
  */
 
 namespace CSF
 {
-	DECLARE_PTR(CallControlManager);
+	DECLARE_PTR(CallControlManager)
 	/**
 	 * CallControlManager
 	 *
 	 * The class is partitioned into several blocks of functionality:
 	 * - Create/Destroy - Initialisation and clean shutdown.
 	 * 					  Destroy is optional if the destructor is used properly.
 	 * - Observer - Register for events when any state changes.  Optional but strongly advised.
 	 *
@@ -111,34 +111,32 @@ namespace CSF
         virtual void addECCObserver ( ECC_Observer * observer ) = 0;
         virtual void removeECCObserver ( ECC_Observer * observer ) = 0;
 
         virtual void setMultiClusterMode(bool allowMultipleClusters) = 0;
         virtual void setSIPCCLoggingMask(const cc_int32_t mask) = 0;
         virtual void setAuthenticationString(const std::string &authString) = 0;
         virtual void setSecureCachePath(const std::string &secureCachePath) = 0;
 
-        /**
-         * For now, recovery is not implemented.
-         * setLocalIpAddressAndGateway must be called before connect()ing in softphone mode.
-         */
-        virtual void setLocalIpAddressAndGateway(const std::string& localIpAddress, const std::string& defaultGW) = 0;
+        // Add local codecs
+        virtual void setAudioCodecs(int codecMask) = 0;
+        virtual void setVideoCodecs(int codecMask) = 0;
 
         virtual bool registerUser(const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain) = 0;
         virtual bool disconnect() = 0;
         virtual std::string getPreferredDeviceName() = 0;
         virtual std::string getPreferredLineDN() = 0;
         virtual ConnectionStatusEnum::ConnectionStatus getConnectionStatus() = 0;
         virtual std::string getCurrentServer() = 0;
 
-        /* P2P API */
+        /* P2P MODE */
         virtual bool startP2PMode(const std::string& user) = 0;
-
-        /* ROAP Proxy Mode */
-        virtual bool startROAPProxy( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain ) = 0;
+        
+        /* SDP MODE */
+        virtual bool startSDPMode() = 0;        
 
         /**
          * Obtain the device object, from which call control can be done.
          * getAvailablePhoneDetails lists all known devices which the user is likely to be able to control.
          */
         virtual CC_DevicePtr getActiveDevice() = 0;
         virtual PhoneDetailsVtrPtr getAvailablePhoneDetails() = 0;
         virtual PhoneDetailsPtr getAvailablePhoneDetails(const std::string& deviceName) = 0;
@@ -157,11 +155,9 @@ namespace CSF
         virtual std::string getProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key) = 0;
 
     protected:
         CallControlManager() {}
     private:
         CallControlManager(const CallControlManager&);
         CallControlManager& operator=(const CallControlManager&);
     };
-
-
-};//end namespace CSF
+} //end namespace CSF
--- a/media/webrtc/signaling/include/ECC_Observer.h
+++ b/media/webrtc/signaling/include/ECC_Observer.h
@@ -54,9 +54,9 @@ namespace CSF
 	{
 	public:
 		virtual void onAvailablePhoneEvent (AvailablePhoneEventType::AvailablePhoneEvent event,
 											const PhoneDetailsPtr availablePhoneDetails) = 0;
 
 		virtual void onAuthenticationStatusChange (AuthenticationStatusEnum::AuthenticationStatus) = 0;
 		virtual void onConnectionStatusChange(ConnectionStatusEnum::ConnectionStatus status) = 0;
 	};
-};
+}
--- a/media/webrtc/signaling/include/ECC_Types.h
+++ b/media/webrtc/signaling/include/ECC_Types.h
@@ -67,18 +67,18 @@
 #define KPML_DEBUG_BIT            (1 << 15) // Bit 15
 #define VCM_DEBUG_BIT             (1 << 17) // Bit 17
 #define CC_APP_DEBUG_BIT          (1 << 18) // Bit 18
 #define CC_LOG_DEBUG_BIT          (1 << 19) // Bit 19
 #define TNP_DEBUG_BIT             (1 << 20) // Bit 20
 
 namespace CSFUnified
 {
-    DECLARE_PTR(DeviceInfo);
-};
+    DECLARE_PTR(DeviceInfo)
+}
 
 namespace CSF
 {
 	namespace AuthenticationFailureCodeType
 	{
 		typedef enum {
 			eNoError,
 			eNoServersConfigured,
@@ -110,52 +110,52 @@ namespace CSF
 			eNoServersConfigured,
 			eNoDeviceNameConfigured,
 			eCouldNotConnect,
 			eFileNotFound,
 			eFileEmpty,
 			eFileInvalid
 		} DeviceRetrievalFailureCode;
 		std::string ECC_API toString(DeviceRetrievalFailureCode value);
-	};
+	}
 
     namespace ConnectionStatusEnum
     {
     	typedef enum {
     		eIdle,
     		eNone,
     		eFetchingDeviceConfig,
     		eRegistering,
     		eReady,
     		eConnectedButNoDeviceReady,
     		eRetrying,
     		eFailed
     	} ConnectionStatus;
 		std::string ECC_API toString(ConnectionStatus value);
-    };
+    }
 
 	namespace ServiceStateType {
 		typedef enum
 		{
 			eUnknown,
 			eInService,
 			eOutOfService
 		} ServiceState;
 		std::string ECC_API toString(ServiceState value);
-	};
+	}
 
 	namespace AvailablePhoneEventType
 	{
 		typedef enum {
 			eFound,		// New Phone device discovered and added to the Available list.
 			eUpdated,	// Change to an existing Phone details record in the Available list.
 			eLost		// Phone device removed from the Available list.
 		} AvailablePhoneEvent;
 		std::string ECC_API toString(AvailablePhoneEvent value);
-	};
+	}
 
 	namespace ConfigPropertyKeysEnum
 	{
 		typedef enum {
 			eLocalVoipPort,
 			eRemoteVoipPort,
 			eVersion,
 			eTransport
@@ -178,9 +178,10 @@ namespace CSF
 		RenderScaling_BORDER,	// scale to fit, fill without cropping
 		RenderScaling_CROP		// scale to fit, crop without filling
 
 	} RenderScaling;
 
     typedef void *VideoWindowHandle;
 	typedef void* ExternalRendererHandle;
 	typedef unsigned int VideoFormat;	
-};
+}
+
--- a/media/webrtc/signaling/include/SharedPtr.h
+++ b/media/webrtc/signaling/include/SharedPtr.h
@@ -37,27 +37,26 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #pragma once
 
 #include <vector>
 #include "base/linked_ptr.h"
 
-
 #ifndef DECLARE_PTR
 #define DECLARE_PTR(className)\
     class className;\
     typedef linked_ptr<className> className##Ptr;
 #endif
 
 
 #ifndef DECLARE_PTR_VECTOR
 #define DECLARE_PTR_VECTOR(className)\
-    DECLARE_PTR(className);\
+    DECLARE_PTR(className)\
     typedef std::vector<className##Ptr> className##Vtr;\
-    typedef linked_ptr<className##Vtr> className##Vtr##Ptr
+    typedef linked_ptr<className##Vtr> className##Vtr##Ptr;
 #endif
 
 
 #ifndef NULL_PTR
 #define NULL_PTR(className) linked_ptr<className>()
 #endif
--- a/media/webrtc/signaling/signaling.gyp
+++ b/media/webrtc/signaling/signaling.gyp
@@ -7,17 +7,17 @@
 #
 # sip.gyp - a library for SIP
 #
 
 {
   'variables': {
     'chromium_code': 1,
   },
-  
+
   'targets': [
   
     #
     # ECC
     #
     {
       'target_name': 'ecc',
       'type': 'static_library',
@@ -27,44 +27,59 @@
       #
       'include_dirs': [
         '..',
         './src',
         './src/callcontrol',
         './src/common',
         './src/common/browser_logging',
         './src/media',
+        './src/media-conduit',
+        './src/mediapipeline',
         './src/softphonewrapper',
+        './src/peerconnection',
         './include',
         './src/sipcc/include',
         './src/sipcc/cpr/include',
         '../../../nsprpub/pr/include',
         '../../../ipc/chromium/src',
         '../../../ipc/chromium/src/base/third_party/nspr',
         '../../../xpcom/base',
         '$(DEPTH)/dist/include',
+        '../../../dom/base',
+        '../../../media/mtransport',
         '../trunk/src',
         '../trunk/src/video_engine/include',
-        '../trunk/src/voice_engine/main/interface',
+        '../trunk/src/voice_engine/include',
+        '../trunk/src/modules/interface',
+        '../trunk/src/peerconnection',
+        '../../../netwerk/srtp/src/include',
+        '../../../netwerk/srtp/src/crypto/include',
+        '../../../ipc/chromium/src',
       ],	
 	  
       #
       # DEPENDENCIES
       #
       'dependencies': [
       ],
 
       'export_dependent_settings': [
       ],
       
       
       #
       # SOURCES
       #
       'sources': [
+        # Media Conduit 
+        './src/media-conduit/AudioConduit.h',
+        './src/media-conduit/AudioConduit.cpp',
+        './src/media-conduit/VideoConduit.h',
+        './src/media-conduit/VideoConduit.cpp',
         # Common
         './src/common/CommonTypes.h',
         './src/common/csf_common.h',
         './src/common/NullDeleter.h',
         './src/common/Wrapper.h',
         # Browser Logging
         './src/common/browser_logging/CSFLog.cpp',
         './src/common/browser_logging/CSFLog.h',
@@ -86,29 +101,16 @@
         './src/media/CSFAudioControlWrapper.h',
         './src/media/CSFAudioTermination.h',
         './src/media/CSFMediaProvider.h',
         './src/media/CSFMediaTermination.h',
         './src/media/CSFToneDefinitions.h',
         './src/media/CSFVideoCallMediaControl.h',
         './src/media/CSFVideoControlWrapper.h',
         './src/media/CSFVideoTermination.h',
-        './src/media/webrtc/WebrtcAudioCodecSelector.cpp',
-        './src/media/webrtc/WebrtcAudioProvider.cpp',
-        './src/media/webrtc/WebrtcMediaProvider.cpp',
-        './src/media/webrtc/WebrtcRingGenerator.cpp',
-        './src/media/webrtc/WebrtcToneGenerator.cpp',
-        './src/media/webrtc/WebrtcVideoProvider.cpp',
-        './src/media/webrtc/WebrtcAudioCodecSelector.h',
-        './src/media/webrtc/WebrtcAudioProvider.h',
-        './src/media/webrtc/WebrtcMediaProvider.h',
-        './src/media/webrtc/WebrtcRingGenerator.h',
-        './src/media/webrtc/WebrtcToneGenerator.h',
-        './src/media/webrtc/WebrtcVideoProvider.h',
-        './src/media/webrtc/WebrtcLogging.h',
         './src/media/VcmSIPCCBinding.h',
         # SoftPhoneWrapper
         './src/softphonewrapper/CC_SIPCCCall.cpp',
         './src/softphonewrapper/CC_SIPCCCallInfo.cpp',
         './src/softphonewrapper/CC_SIPCCCallServerInfo.cpp',
         './src/softphonewrapper/CC_SIPCCDevice.cpp',
         './src/softphonewrapper/CC_SIPCCDeviceInfo.cpp',
         './src/softphonewrapper/CC_SIPCCFeatureInfo.cpp',
@@ -120,80 +122,103 @@
         './src/softphonewrapper/CC_SIPCCCallInfo.h',
         './src/softphonewrapper/CC_SIPCCCallServerInfo.h',
         './src/softphonewrapper/CC_SIPCCDevice.h',
         './src/softphonewrapper/CC_SIPCCDeviceInfo.h',
         './src/softphonewrapper/CC_SIPCCFeatureInfo.h',
         './src/softphonewrapper/CC_SIPCCLine.h',
         './src/softphonewrapper/CC_SIPCCLineInfo.h',
         './src/softphonewrapper/CC_SIPCCService.h',
-
+        # PeerConnection
+        './src/peerconnection/PeerConnectionCtx.cpp',
+        './src/peerconnection/PeerConnectionCtx.h',
+        './src/peerconnection/PeerConnectionImpl.cpp',
+        './src/peerconnection/PeerConnectionImpl.h',
+        # Media pipeline
+        './src/mediapipeline/MediaPipeline.h',
+        './src/mediapipeline/MediaPipeline.cpp',
+        './src/mediapipeline/SrtpFlow.h',
+        './src/mediapipeline/SrtpFlow.cpp',
       ],
     
       #
       # DEFINES
       #
       
       'defines' : [
         'LOG4CXX_STATIC', 
         '_NO_LOG4CXX', 
         'USE_SSLEAY', 
-        'LIBXML_STATIC', 
         '_CPR_USE_EXTERNAL_LOGGER',
-   	'WEBRTC_RELATIVE_PATH',
+        'WEBRTC_RELATIVE_PATH',
       	'HAVE_WEBRTC_VIDEO',
         'HAVE_WEBRTC_VOICE',
       ],
 
       #
-      # OS SPECIFIC
-      #      
+      # Conditionals
+      #
       'conditions': [
+        ['build_for_test==0', {
+          'defines' : [
+            'MOZILLA_INTERNAL_API'
+          ],
+        }], 
+        ['build_for_test!=0', {
+          'include_dirs': [
+            './test'
+          ],
+          'defines' : [
+            'NO_CHROMIUM_LOGGING',
+            'USE_FAKE_MEDIA_STREAMS'
+          ],
+        }], 
         ['OS=="linux"', {
           'include_dirs': [
           ],
 
           'defines': [
             'SIP_OS_LINUX',
             '_GNU_SOURCE',
             'LINUX', 
             'GIPS_VER=3510', 
             'SECLIB_OPENSSL',
           ],
           
-          'cflags': [
-            '-fexceptions',
-            '-fno-common',
+          'cflags_mozilla': [
+            '-Werror',
           ],
         }],
         ['OS=="win"', {
           'include_dirs': [
           ],		
           'defines': [
             'SIP_OS_WINDOWS',
             'WIN32', 
             'GIPS_VER=3480',
-            'SIPCC_BUILD'
+            'SIPCC_BUILD',
+            'HAVE_WINSOCK2_H',
+            'CPR_STDINT_INCLUDE=\\"mozilla/StandardInteger.h\\"'
           ],
           
-          'cflags': [
+          'cflags_mozilla': [
           ],
         }],
         ['OS=="mac"', {
           'include_dirs': [
           ],
           'defines': [
             'SIP_OS_OSX',
             'OSX', 
             '_FORTIFY_SOURCE=2',
           ],
           
-          'cflags': [
-            '-fexceptions',
-            '-fno-common'
+          'cflags_mozilla': [
+            '-Werror',
+            '-Wno-error=conversion'
           ],
         }],
       ],
     },
   
     #
     # SIPCC
     #
@@ -211,16 +236,23 @@
         './src/sipcc/cpr/include',
         './src/sipcc/core/common',
         './src/sipcc/core/sipstack/h',
         './src/sipcc/core/ccapp',
         './src/sipcc/core/sdp',
         './src/sipcc/core/gsm/h',
         './src/sipcc/plat/common',
         '../../../nsprpub/pr/include',
+        '../../../media/mtransport',
+        '../../../dom/base',
+        '../trunk/third_party/libsrtp/srtp/include',
+        '../trunk/third_party/libsrtp/srtp/crypto/include',
+        '$(DEPTH)/dist/include',
+        # Danger: this is to include config.h. This could be bad.
+        '../trunk/third_party/libsrtp/config',
       ],
       
       #
       # DEPENDENCIES
       #
       'dependencies': [
       ],
       
@@ -285,17 +317,16 @@
         './src/sipcc/core/common/resource_manager.h',
         './src/sipcc/core/common/sip_socket_api.c',
         './src/sipcc/core/common/subscription_handler.c',
         './src/sipcc/core/common/subscription_handler.h',
         './src/sipcc/core/common/text_strings.c',
         './src/sipcc/core/common/text_strings.h',
         './src/sipcc/core/common/ui.c',
         './src/sipcc/core/common/vcm_util.c',
-        './src/sipcc/core/common/xml_util.c',
         # GSM
         './src/sipcc/core/gsm/ccapi.c',
         './src/sipcc/core/gsm/ccapi_strings.c',
         './src/sipcc/core/gsm/dcsm.c',
         './src/sipcc/core/gsm/fim.c',
         './src/sipcc/core/gsm/fsm.c',
         './src/sipcc/core/gsm/fsmb2bcnf.c',
         './src/sipcc/core/gsm/fsmcac.c',
@@ -367,17 +398,16 @@
         './src/sipcc/core/includes/uiapi.h',
         './src/sipcc/core/includes/upgrade.h',
         './src/sipcc/core/includes/util_ios_queue.h',
         './src/sipcc/core/includes/util_parse.h',
         './src/sipcc/core/includes/util_string.h',
         './src/sipcc/core/includes/vcm_util.h',
         './src/sipcc/core/includes/www.h',
         './src/sipcc/core/includes/xml_defs.h',
-        './src/sipcc/core/includes/xml_util.h',
         # SDP
         './src/sipcc/core/sdp/ccsdp.c',
         './src/sipcc/core/sdp/sdp_access.c',
         './src/sipcc/core/sdp/sdp_attr.c',
         './src/sipcc/core/sdp/sdp_attr_access.c',
         './src/sipcc/core/sdp/sdp_base64.c',
         './src/sipcc/core/sdp/sdp_config.c',
         './src/sipcc/core/sdp/sdp_main.c',
@@ -480,16 +510,17 @@
         './src/sipcc/cpr/include/cpr_stdio.h',
         './src/sipcc/cpr/include/cpr_stdlib.h',
         './src/sipcc/cpr/include/cpr_string.h',
         './src/sipcc/cpr/include/cpr_strings.h',
         './src/sipcc/cpr/include/cpr_threads.h',
         './src/sipcc/cpr/include/cpr_time.h',
         './src/sipcc/cpr/include/cpr_timers.h',
         './src/sipcc/cpr/include/cpr_types.h',
+        './src/sipcc/cpr/common/cpr_string.c',
         # INCLUDE
         './src/sipcc/include/cc_blf.h',
         './src/sipcc/include/cc_blf_listener.h',
         './src/sipcc/include/cc_call_feature.h',
         './src/sipcc/include/cc_call_listener.h',
         './src/sipcc/include/cc_config.h',
         './src/sipcc/include/cc_constants.h',
         './src/sipcc/include/cc_debug.h',
@@ -516,22 +547,19 @@
         './src/sipcc/include/ccapi_types.h',
         './src/sipcc/include/ccsdp.h',
         './src/sipcc/include/config_api.h',
         './src/sipcc/include/dns_util.h',
         './src/sipcc/include/plat_api.h',
         './src/sipcc/include/reset_api.h',
         './src/sipcc/include/sll_lite.h',
         './src/sipcc/include/vcm.h',
-        './src/sipcc/include/xml_parser.h',
         './src/sipcc/include/xml_parser_defines.h',
 
         # PLAT
-        # './src/sipcc/plat/common/plat_sec_api.c',
-        './src/sipcc/plat/common/libxml_parser.c',
         './src/sipcc/plat/csf2g/model.c',
         './src/sipcc/plat/csf2g/reset_api.c',
         # 
         # './src/sipcc/plat/common/plat_debug.h',
         # './src/sipcc/plat/common/tnp_blf.h',
 
         # STUB
         #'./src/sipcc/stub/cc_blf_stub.c',
@@ -547,57 +575,47 @@
       ],
 
       #
       # OS SPECIFIC
       #      
       'conditions': [
         ['OS=="linux"', {
           'include_dirs': [
-            '/usr/include/libxml2',
           ],
 
           'sources': [
             # SIPSTACK
             './src/sipcc/core/sipstack/sip_platform_task.c',
 
             # PLAT
             './src/sipcc/plat/common/dns_utils.c',
-            './src/sipcc/plat/unix-common/random.c',
-            './src/sipcc/plat/linux/plat_api_stub.c',
 
             # CPR
-            './src/sipcc/cpr/linux/cpr_linux_chunk.c',
             './src/sipcc/cpr/linux/cpr_linux_errno.c',
             './src/sipcc/cpr/linux/cpr_linux_init.c',
             './src/sipcc/cpr/linux/cpr_linux_ipc.c',
             './src/sipcc/cpr/linux/cpr_linux_locks.c',
-            './src/sipcc/cpr/linux/cpr_linux_memory.c',
             './src/sipcc/cpr/linux/cpr_linux_socket.c',
             './src/sipcc/cpr/linux/cpr_linux_stdio.c',
-            './src/sipcc/cpr/linux/cpr_linux_stdlib.c',
             './src/sipcc/cpr/linux/cpr_linux_string.c',
             './src/sipcc/cpr/linux/cpr_linux_threads.c',
             './src/sipcc/cpr/linux/cpr_linux_timers_using_select.c', 
         
             './src/sipcc/cpr/linux/cpr_assert.h',
             './src/sipcc/cpr/linux/cpr_linux_align.h',
             './src/sipcc/cpr/linux/cpr_linux_assert.h',
-            './src/sipcc/cpr/linux/cpr_linux_chunk.h',
             './src/sipcc/cpr/linux/cpr_linux_errno.h',
             './src/sipcc/cpr/linux/cpr_linux_in.h',
             './src/sipcc/cpr/linux/cpr_linux_ipc.h',
             './src/sipcc/cpr/linux/cpr_linux_locks.h',
-            './src/sipcc/cpr/linux/cpr_linux_memory_api.h',
-            './src/sipcc/cpr/linux/cpr_linux_memory.h',
             './src/sipcc/cpr/linux/cpr_linux_private.h',
             './src/sipcc/cpr/linux/cpr_linux_rand.h',
             './src/sipcc/cpr/linux/cpr_linux_socket.h',
             './src/sipcc/cpr/linux/cpr_linux_stdio.h',
-            './src/sipcc/cpr/linux/cpr_linux_stdlib.h',
             './src/sipcc/cpr/linux/cpr_linux_string.h',
             './src/sipcc/cpr/linux/cpr_linux_strings.h',
             './src/sipcc/cpr/linux/cpr_linux_time.h',
             './src/sipcc/cpr/linux/cpr_linux_timers.h',
             './src/sipcc/cpr/linux/cpr_linux_tst.h',
             './src/sipcc/cpr/linux/cpr_linux_types.h',
         
           ],
@@ -609,23 +627,22 @@
             'NO_SOCKET_POLLING',
             'USE_TIMER_SELECT_BASED',
             'FULL_BUILD',
             'STUBBED_OUT',
             'USE_PRINTF'
             'LINUX',
           ],
 
-          'cflags': [
-            '-g',
+          'cflags_mozilla': [
+            '-Werror',
           ],
         }],
         ['OS=="win"', {
           'include_dirs': [
-            './third_party/libxml2/include',
           ],
           
           'sources': [
             # SIPSTACK
             './src/sipcc/core/sipstack/sip_platform_win32_task.c',
             
             # PLAT
             './src/sipcc/plat/win32/dns_utils.c',
@@ -642,26 +659,22 @@
             './src/sipcc/cpr/win32/cpr_win_errno.c',
             './src/sipcc/cpr/win32/cpr_win_errno.h',
             './src/sipcc/cpr/win32/cpr_win_in.h',
             './src/sipcc/cpr/win32/cpr_win_init.c',
             './src/sipcc/cpr/win32/cpr_win_ipc.c',
             './src/sipcc/cpr/win32/cpr_win_ipc.h',
             './src/sipcc/cpr/win32/cpr_win_locks.c',
             './src/sipcc/cpr/win32/cpr_win_locks.h',
-            './src/sipcc/cpr/win32/cpr_win_memory.c',
-            './src/sipcc/cpr/win32/cpr_win_memory.h',
             './src/sipcc/cpr/win32/cpr_win_rand.c',
             './src/sipcc/cpr/win32/cpr_win_rand.h',
             './src/sipcc/cpr/win32/cpr_win_socket.c',
             './src/sipcc/cpr/win32/cpr_win_socket.h',
             './src/sipcc/cpr/win32/cpr_win_stdio.c',
             './src/sipcc/cpr/win32/cpr_win_stdio.h',
-            './src/sipcc/cpr/win32/cpr_win_stdlib.c',
-            './src/sipcc/cpr/win32/cpr_win_stdlib.h',
             './src/sipcc/cpr/win32/cpr_win_string.c',
             './src/sipcc/cpr/win32/cpr_win_string.h',
             './src/sipcc/cpr/win32/cpr_win_strings.h',
             './src/sipcc/cpr/win32/cpr_win_threads.c',
             './src/sipcc/cpr/win32/cpr_win_time.h',
             './src/sipcc/cpr/win32/cpr_win_timers.c',
             './src/sipcc/cpr/win32/cpr_win_timers.h',
             './src/sipcc/cpr/win32/cpr_win_types.h',
@@ -673,59 +686,51 @@
             'WIN32', 
             'SIPCC_BUILD',
             'SDP_WIN32',
             'STUBBED_OUT',
             'EXTERNAL_TICK_REQUIRED',
             'GIPS_VER=3480',
           ],
           
-          'cflags': [
+          'cflags_mozilla': [
           ],
           
         }],
         ['OS=="mac"', {
 
           'include_dirs': [
-            '/usr/include/libxml2',
           ],
           
           'sources': [
             # SIPSTACK
             './src/sipcc/core/sipstack/sip_platform_task.c',
             
             # PLAT
             './src/sipcc/plat/common/dns_utils.c',
             #'./src/sipcc/plat/darwin/netif.c',
             './src/sipcc/plat/darwin/plat_api_stub.c',
             #'./src/sipcc/plat/unix-common/random.c',
             
             # CPR
             './src/sipcc/cpr/darwin/cpr_darwin_assert.h',
-            './src/sipcc/cpr/darwin/cpr_darwin_chunk.c',
-            './src/sipcc/cpr/darwin/cpr_darwin_chunk.h',
             './src/sipcc/cpr/darwin/cpr_darwin_errno.c',
             './src/sipcc/cpr/darwin/cpr_darwin_errno.h',
             './src/sipcc/cpr/darwin/cpr_darwin_in.h',
             './src/sipcc/cpr/darwin/cpr_darwin_init.c',
             './src/sipcc/cpr/darwin/cpr_darwin_ipc.c',
             './src/sipcc/cpr/darwin/cpr_darwin_ipc.h',
             './src/sipcc/cpr/darwin/cpr_darwin_locks.c',
             './src/sipcc/cpr/darwin/cpr_darwin_locks.h',
-            './src/sipcc/cpr/darwin/cpr_darwin_memory.c',
-            './src/sipcc/cpr/darwin/cpr_darwin_memory.h',
-            './src/sipcc/cpr/darwin/cpr_darwin_memory_api.h',
             './src/sipcc/cpr/darwin/cpr_darwin_private.h',
             './src/sipcc/cpr/darwin/cpr_darwin_rand.h',
             './src/sipcc/cpr/darwin/cpr_darwin_socket.c',
             './src/sipcc/cpr/darwin/cpr_darwin_socket.h',
             './src/sipcc/cpr/darwin/cpr_darwin_stdio.c',
             './src/sipcc/cpr/darwin/cpr_darwin_stdio.h',
-            './src/sipcc/cpr/darwin/cpr_darwin_stdlib.c',
-            './src/sipcc/cpr/darwin/cpr_darwin_stdlib.h',
             './src/sipcc/cpr/darwin/cpr_darwin_string.c',
             './src/sipcc/cpr/darwin/cpr_darwin_string.h',
             './src/sipcc/cpr/darwin/cpr_darwin_strings.h',
             './src/sipcc/cpr/darwin/cpr_darwin_threads.c',
             './src/sipcc/cpr/darwin/cpr_darwin_time.h',
             './src/sipcc/cpr/darwin/cpr_darwin_timers.h',
             './src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c',
             './src/sipcc/cpr/darwin/cpr_darwin_tst.h',
@@ -738,25 +743,22 @@
             '_POSIX_SOURCE',
             'CPR_MEMORY_LITTLE_ENDIAN',
             'NO_SOCKET_POLLING',
             'USE_TIMER_SELECT_BASED',
             'FULL_BUILD',
             'STUBBED_OUT',
             'USE_PRINTF',
             '_DARWIN_C_SOURCE',
+            'NO_NSPR_10_SUPPORT',
           ],
           
-          'cflags': [
-            '-g',
-            '-fexceptions',
-            '-fno-common',
-            '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk',
-            '-mmacosx-version-min=10.5',
-            '-fast'
+          'cflags_mozilla': [
+            '-Werror',
+            '-Wno-error=conversion'
           ],
         }],
       ],
             
     },
   ],
 }
 
--- a/media/webrtc/signaling/src/callcontrol/CallControlManagerImpl.cpp
+++ b/media/webrtc/signaling/src/callcontrol/CallControlManagerImpl.cpp
@@ -32,16 +32,19 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include <errno.h>
+#include <string>
+
 #include "CC_SIPCCDevice.h"
 #include "CC_SIPCCDeviceInfo.h"
 #include "CC_SIPCCFeatureInfo.h"
 #include "CC_SIPCCLine.h"
 #include "CC_SIPCCLineInfo.h"
 #include "CC_SIPCCCallInfo.h"
 #include "CallControlManagerImpl.h"
 #include "CSFLogStream.h"
@@ -54,22 +57,23 @@ extern "C"
 
 static const char* logTag = "CallControlManager";
 
 static std::string logDestination = "CallControl.log";
 
 using namespace std;
 using namespace CSFUnified;
 
-
 namespace CSF
 {
 
+
 CallControlManagerImpl::CallControlManagerImpl()
-: multiClusterMode(false),
+: m_lock("CallControlManagerImpl"),
+  multiClusterMode(false),
   sipccLoggingMask(0),
   authenticationStatus(AuthenticationStatusEnum::eNotAuthenticated),
   connectionState(ConnectionStatusEnum::eIdle)
 {
     CSFLogInfoS(logTag, "CallControlManagerImpl()");
 }
 
 CallControlManagerImpl::~CallControlManagerImpl()
@@ -87,47 +91,47 @@ bool CallControlManagerImpl::destroy()
 		return retval;
 	}
 	return retval;
 }
 
 // Observers
 void CallControlManagerImpl::addCCObserver ( CC_Observer * observer )
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     if (observer == NULL)
     {
         CSFLogErrorS(logTag, "NULL value for \"observer\" passed to addCCObserver().");
         return;
     }
 
     ccObservers.insert(observer);
 }
 
 void CallControlManagerImpl::removeCCObserver ( CC_Observer * observer )
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     ccObservers.erase(observer);
 }
 
 void CallControlManagerImpl::addECCObserver ( ECC_Observer * observer )
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     if (observer == NULL)
     {
         CSFLogErrorS(logTag, "NULL value for \"observer\" passed to addECCObserver().");
         return;
     }
 
     eccObservers.insert(observer);
 }
 
 void CallControlManagerImpl::removeECCObserver ( ECC_Observer * observer )
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     eccObservers.erase(observer);
 }
 
 void CallControlManagerImpl::setMultiClusterMode(bool allowMultipleClusters)
 {
     CSFLogInfoS(logTag, "setMultiClusterMode(" << allowMultipleClusters << ")");
     multiClusterMode = allowMultipleClusters;
 }
@@ -145,27 +149,29 @@ void CallControlManagerImpl::setAuthenti
 }
 
 void CallControlManagerImpl::setSecureCachePath(const std::string &secureCachePath)
 {
     CSFLogInfoS(logTag, "setSecureCachePath(" << secureCachePath << ")");
     this->secureCachePath = secureCachePath;
 }
 
-// Local IP Address
-void CallControlManagerImpl::setLocalIpAddressAndGateway(const std::string& localIpAddress, const std::string& defaultGW)
+// Add local codecs
+void CallControlManagerImpl::setAudioCodecs(int codecMask)
 {
-    CSFLogInfoS(logTag, "setLocalIpAddressAndGateway(" << localIpAddress << ", " << defaultGW << ")");
-    this->localIpAddress = localIpAddress;
-    this->defaultGW = defaultGW;
+  CSFLogDebug(logTag, "setAudioCodecs %X", codecMask); 
+
+  VcmSIPCCBinding::setAudioCodecs(codecMask);
+}
 
-    if(softPhone != NULL)
-    {
-        softPhone->setLocalAddressAndGateway(this->localIpAddress, this->defaultGW);
-    }
+void CallControlManagerImpl::setVideoCodecs(int codecMask)
+{
+  CSFLogDebug(logTag, "setVideoCodecs %X", codecMask); 
+
+  VcmSIPCCBinding::setVideoCodecs(codecMask);
 }
 
 AuthenticationStatusEnum::AuthenticationStatus CallControlManagerImpl::getAuthenticationStatus()
 {
     return authenticationStatus;
 }
 
 bool CallControlManagerImpl::registerUser( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain )
@@ -176,29 +182,20 @@ bool CallControlManagerImpl::registerUse
     if(phone != NULL)
     {
     	setConnectionState(ConnectionStatusEnum::eReady);
 
         CSFLogErrorS(logTag, "registerUser() failed - already connected!");
         return false;
     }
 
-    // Check preconditions.
-    if(localIpAddress.empty() || localIpAddress == "127.0.0.1")
-    {
-    	setConnectionState(ConnectionStatusEnum::eFailed);
-    	CSFLogErrorS(logTag, "registerUser() failed - No local IP address set!");
-    	return false;
-    }
-
     softPhone = CC_SIPCCServicePtr(new CC_SIPCCService());
     phone = softPhone;
     phone->init(user, password, domain, deviceName);
     softPhone->setLoggingMask(sipccLoggingMask);
-    softPhone->setLocalAddressAndGateway(localIpAddress, defaultGW);
     phone->addCCObserver(this);
 
     phone->setP2PMode(false);
 
     bool bStarted = phone->startService();
     if (!bStarted) {
         setConnectionState(ConnectionStatusEnum::eFailed);
     } else {
@@ -216,82 +213,51 @@ bool CallControlManagerImpl::startP2PMod
     if(phone != NULL)
     {
     	setConnectionState(ConnectionStatusEnum::eReady);
 
         CSFLogErrorS(logTag, "startP2PMode() failed - already started in p2p mode!");
         return false;
     }
 
-    // Check preconditions.
-    if(localIpAddress.empty() || localIpAddress == "127.0.0.1")
-    {
-    	setConnectionState(ConnectionStatusEnum::eFailed);
-    	CSFLogErrorS(logTag, "startP2PMode() failed - No local IP address set!");
-    	return false;
-    }
-
     softPhone = CC_SIPCCServicePtr(new CC_SIPCCService());
     phone = softPhone;
     phone->init(user, "", "127.0.0.1", "sipdevice");
     softPhone->setLoggingMask(sipccLoggingMask);
-    softPhone->setLocalAddressAndGateway(localIpAddress, defaultGW);
     phone->addCCObserver(this);
 
     phone->setP2PMode(true);
 
     bool bStarted = phone->startService();
     if (!bStarted) {
         setConnectionState(ConnectionStatusEnum::eFailed);
     } else {
         setConnectionState(ConnectionStatusEnum::eReady);
     }
 
     return bStarted;
 }
 
-bool CallControlManagerImpl::startROAPProxy( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain )
+bool CallControlManagerImpl::startSDPMode()
 {
-	setConnectionState(ConnectionStatusEnum::eRegistering);
-
-    CSFLogInfoS(logTag, "startROAPProxy(" << user << ", " << domain << " )");
+    CSFLogInfoS(logTag, "startSDPMode");
     if(phone != NULL)
     {
-    	setConnectionState(ConnectionStatusEnum::eReady);
-
-        CSFLogErrorS(logTag, "startROAPProxy() failed - already connected!");
+        CSFLogError(logTag, "%s failed - already started in SDP mode!",__FUNCTION__);
         return false;
     }
 
-    // Check preconditions.
-    if(localIpAddress.empty() || localIpAddress == "127.0.0.1")
-    {
-    	setConnectionState(ConnectionStatusEnum::eFailed);
-    	CSFLogErrorS(logTag, "startROAPProxy() failed - No local IP address set!");
-    	return false;
-    }
-
     softPhone = CC_SIPCCServicePtr(new CC_SIPCCService());
     phone = softPhone;
-    phone->init(user, password, domain, deviceName);
+    phone->init("JSEP", "", "127.0.0.1", "sipdevice");
     softPhone->setLoggingMask(sipccLoggingMask);
-    softPhone->setLocalAddressAndGateway(localIpAddress, defaultGW);
     phone->addCCObserver(this);
-
-    phone->setP2PMode(false);
-    phone->setROAPProxyMode(true);
-
-    bool bStarted = phone->startService();
-    if (!bStarted) {
-        setConnectionState(ConnectionStatusEnum::eFailed);
-    } else {
-        setConnectionState(ConnectionStatusEnum::eReady);
-    }
-
-    return bStarted;
+    phone->setSDPMode(true);
+ 
+    return phone->startService();
 }
 
 bool CallControlManagerImpl::disconnect()
 {
     CSFLogInfoS(logTag, "disconnect()");
     if(phone == NULL)
         return true;
 
@@ -332,34 +298,34 @@ CC_DevicePtr CallControlManagerImpl::get
         return phone->getActiveDevice();
 
     return CC_DevicePtr();
 }
 
 // All known devices
 PhoneDetailsVtrPtr CallControlManagerImpl::getAvailablePhoneDetails()
 {
-    PhoneDetailsVtrPtr result = PhoneDetailsVtrPtr(new PhoneDetailsVtr());
-    for(PhoneDetailsMap::iterator it = phoneDetailsMap.begin(); it != phoneDetailsMap.end(); it++)
-    {
-        PhoneDetailsPtr details = it->second;
-        result->push_back(details);
-    }
-    return result;
+  PhoneDetailsVtrPtr result = PhoneDetailsVtrPtr(new PhoneDetailsVtr());
+  for(PhoneDetailsMap::iterator it = phoneDetailsMap.begin(); it != phoneDetailsMap.end(); it++)
+  {
+    PhoneDetailsPtr details = it->second;
+    result->push_back(details);
+  }
+  return result;
 }
+
 PhoneDetailsPtr CallControlManagerImpl::getAvailablePhoneDetails(const std::string& deviceName)
 {
     PhoneDetailsMap::iterator it = phoneDetailsMap.find(deviceName);
     if(it != phoneDetailsMap.end())
     {
         return it->second;
     }
     return PhoneDetailsPtr();
 }
-
 // Media setup
 VideoControlPtr CallControlManagerImpl::getVideoControl()
 {
     if(phone != NULL)
         return phone->getVideoControl();
 
     return VideoControlPtr();
 }
@@ -369,53 +335,68 @@ AudioControlPtr CallControlManagerImpl::
     if(phone != NULL)
         return phone->getAudioControl();
 
     return AudioControlPtr();
 }
 
 bool CallControlManagerImpl::setProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key, std::string& value)
 {
-	CSFLogInfoS(logTag, "setProperty(" << value << " )");
+  unsigned long strtoul_result;
+  char *strtoul_end;
+
+  CSFLogInfoS(logTag, "setProperty(" << value << " )");
+
+  if (key == ConfigPropertyKeysEnum::eLocalVoipPort) {
+    errno = 0;
+    strtoul_result = strtoul(value.c_str(), &strtoul_end, 10);
+
+    if (errno || value.c_str() == strtoul_end || strtoul_result > USHRT_MAX) {
+      return false;
+    }
 
-	if (key == ConfigPropertyKeysEnum::eLocalVoipPort) {
-		CCAPI_Config_set_local_voip_port(atoi(value.c_str()));
-	} else if (key == ConfigPropertyKeysEnum::eRemoteVoipPort) {
-		CCAPI_Config_set_remote_voip_port(atoi(value.c_str()));
-	} else if (key == ConfigPropertyKeysEnum::eTransport) {
-		if (value == "tcp")
-			CCAPI_Config_set_transport_udp(false);
-		else
-			CCAPI_Config_set_transport_udp(true);
-	}
+    CCAPI_Config_set_local_voip_port((int) strtoul_result);
+  } else if (key == ConfigPropertyKeysEnum::eRemoteVoipPort) {
+    errno = 0;
+    strtoul_result = strtoul(value.c_str(), &strtoul_end, 10);
+
+    if (errno || value.c_str() == strtoul_end || strtoul_result > USHRT_MAX) {
+      return false;
+    }
 
-	return true;
+    CCAPI_Config_set_remote_voip_port((int) strtoul_result);
+  } else if (key == ConfigPropertyKeysEnum::eTransport) {
+    if (value == "tcp")
+      CCAPI_Config_set_transport_udp(false);
+    else
+      CCAPI_Config_set_transport_udp(true);
+  }
+
+  return true;
 }
 
 std::string CallControlManagerImpl::getProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key)
 {
-	CSFLogInfoS(logTag, "getProperty()");
+  std::string retValue = "NONESET";
+  char tmpString[11];
+
+  CSFLogInfoS(logTag, "getProperty()");
 
-	std::string retValue = "NONESET";
-	if (key == ConfigPropertyKeysEnum::eLocalVoipPort) {
-		int tmpValue = CCAPI_Config_get_local_voip_port();
-		std::stringstream out;
-		out << tmpValue;
-		retValue = out.str();
-	} else if (key == ConfigPropertyKeysEnum::eRemoteVoipPort) {
-		int tmpValue = CCAPI_Config_get_remote_voip_port();
-		std::stringstream out;
-		out << tmpValue;
-		retValue = out.str();
-	} else if (key == ConfigPropertyKeysEnum::eVersion) {
-		const char* version = CCAPI_Config_get_version();
-		retValue = version;
-	}
+  if (key == ConfigPropertyKeysEnum::eLocalVoipPort) {
+    csf_sprintf(tmpString, sizeof(tmpString), "%u", CCAPI_Config_get_local_voip_port());
+    retValue = tmpString;
+  } else if (key == ConfigPropertyKeysEnum::eRemoteVoipPort) {
+    csf_sprintf(tmpString, sizeof(tmpString), "%u", CCAPI_Config_get_remote_voip_port());
+    retValue = tmpString;
+  } else if (key == ConfigPropertyKeysEnum::eVersion) {
+    const char* version = CCAPI_Config_get_version();
+    retValue = version;
+  }
 
-	return retValue;
+  return retValue;
 }
 /*
   There are a number of factors that determine PhoneAvailabilityType::PhoneAvailability. The supported states for this enum are:
   { eUnknown, eAvailable, eUnAvailable, eNotAllowed }. eUnknown is the default value, which is set when there is no information
   available that would otherwise determine the availability value. The factors that can influence PhoneAvailability are:
   phone mode, and for a given device (described by DeviceInfo) the model, and the name of the device. For phone control mode, the
   device registration and whether CUCM says the device is CTI controllable (or not) is a factor.
 
@@ -497,92 +478,91 @@ void CallControlManagerImpl::onDeviceEve
 void CallControlManagerImpl::onFeatureEvent(ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_FeatureInfoPtr info)
 {
     notifyFeatureEventObservers(deviceEvent, devicePtr, info);
 }
 void CallControlManagerImpl::onLineEvent(ccapi_line_event_e lineEvent,     CC_LinePtr linePtr, CC_LineInfoPtr info)
 {
     notifyLineEventObservers(lineEvent, linePtr, info);
 }
-void CallControlManagerImpl::onCallEvent(ccapi_call_event_e callEvent,     CC_CallPtr callPtr, CC_CallInfoPtr info, char* sdp)
+void CallControlManagerImpl::onCallEvent(ccapi_call_event_e callEvent,     CC_CallPtr callPtr, CC_CallInfoPtr info)
 {
-    notifyCallEventObservers(callEvent, callPtr, info, sdp);
+    notifyCallEventObservers(callEvent, callPtr, info);
 }
 
 
 void CallControlManagerImpl::notifyDeviceEventObservers (ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_DeviceInfoPtr info)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<CC_Observer*>::const_iterator it = ccObservers.begin();
     for ( ; it != ccObservers.end(); it++ )
     {
         (*it)->onDeviceEvent(deviceEvent, devicePtr, info);
     }
 }
 
 void CallControlManagerImpl::notifyFeatureEventObservers (ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_FeatureInfoPtr info)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<CC_Observer*>::const_iterator it = ccObservers.begin();
     for ( ; it != ccObservers.end(); it++ )
     {
         (*it)->onFeatureEvent(deviceEvent, devicePtr, info);
     }
 }
 
 void CallControlManagerImpl::notifyLineEventObservers (ccapi_line_event_e lineEvent, CC_LinePtr linePtr, CC_LineInfoPtr info)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<CC_Observer*>::const_iterator it = ccObservers.begin();
     for ( ; it != ccObservers.end(); it++ )
     {
         (*it)->onLineEvent(lineEvent, linePtr, info);
     }
 }
 
-void CallControlManagerImpl::notifyCallEventObservers (ccapi_call_event_e callEvent, CC_CallPtr callPtr, CC_CallInfoPtr info, char* sdp)
+void CallControlManagerImpl::notifyCallEventObservers (ccapi_call_event_e callEvent, CC_CallPtr callPtr, CC_CallInfoPtr info)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<CC_Observer*>::const_iterator it = ccObservers.begin();
     for ( ; it != ccObservers.end(); it++ )
     {
-        (*it)->onCallEvent(callEvent, callPtr, info, sdp);
+        (*it)->onCallEvent(callEvent, callPtr, info);
     }
 }
 
 void CallControlManagerImpl::notifyAvailablePhoneEvent (AvailablePhoneEventType::AvailablePhoneEvent event,
         const PhoneDetailsPtr availablePhoneDetails)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<ECC_Observer*>::const_iterator it = eccObservers.begin();
     for ( ; it != eccObservers.end(); it++ )
     {
         (*it)->onAvailablePhoneEvent(event, availablePhoneDetails);
     }
 }
 
 void CallControlManagerImpl::notifyAuthenticationStatusChange (AuthenticationStatusEnum::AuthenticationStatus status)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<ECC_Observer*>::const_iterator it = eccObservers.begin();
     for ( ; it != eccObservers.end(); it++ )
     {
         (*it)->onAuthenticationStatusChange(status);
     }
 }
 
 void CallControlManagerImpl::notifyConnectionStatusChange(ConnectionStatusEnum::ConnectionStatus status)
 {
-	AutoLock lock(m_lock);
+	mozilla::MutexAutoLock lock(m_lock);
     set<ECC_Observer*>::const_iterator it = eccObservers.begin();
     for ( ; it != eccObservers.end(); it++ )
     {
         (*it)->onConnectionStatusChange(status);
     }
 }
 
 void CallControlManagerImpl::setConnectionState(ConnectionStatusEnum::ConnectionStatus status)
 {
 	connectionState = status;
 	notifyConnectionStatusChange(status);
 }
-
 }
--- a/media/webrtc/signaling/src/callcontrol/CallControlManagerImpl.h
+++ b/media/webrtc/signaling/src/callcontrol/CallControlManagerImpl.h
@@ -37,18 +37,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #pragma once
 
 #include "CallControlManager.h"
 #include "PhoneDetailsImpl.h"
 #include "CC_SIPCCService.h"
-
-#include "base/lock.h"
+#include "mozilla/Mutex.h"
 
 
 #include <set>
 #include <map>
 
 namespace CSF
 {
 	class CallControlManagerImpl: public CallControlManager, public CC_Observer
@@ -66,26 +65,27 @@ namespace CSF
         virtual void removeECCObserver ( ECC_Observer * observer );
 
         // Config and global setup
         virtual void setMultiClusterMode(bool allowMultipleClusters);
         virtual void setSIPCCLoggingMask(const cc_int32_t mask);
         virtual void setAuthenticationString(const std::string &authString);
         virtual void setSecureCachePath(const std::string &secureCachePath);
 
-        // Local IP Address and DefaultGateway
-        virtual void setLocalIpAddressAndGateway(const std::string& localIpAddress, const std::string& defaultGW);
+        // Add local codecs
+        virtual void setAudioCodecs(int codecMask);
+        virtual void setVideoCodecs(int codecMask);
 
         virtual AuthenticationStatusEnum::AuthenticationStatus getAuthenticationStatus();
 
         virtual bool registerUser( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain );
 
         virtual bool startP2PMode(const std::string& user);
 
-        virtual bool startROAPProxy( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain );
+        virtual bool startSDPMode();
 
         virtual bool disconnect();
         virtual std::string getPreferredDeviceName();
         virtual std::string getPreferredLineDN();
         virtual ConnectionStatusEnum::ConnectionStatus getConnectionStatus();
         virtual std::string getCurrentServer();
 
         // Currently controlled device
@@ -100,32 +100,28 @@ namespace CSF
         virtual AudioControlPtr getAudioControl();
 
         virtual bool setProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key, std::string& value);
         virtual std::string getProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key);
 
 	private: // Data Storage
 
         // Observers
-		Lock m_lock;;
+		mozilla::Mutex m_lock;
 		std::set<CC_Observer *> ccObservers;
 		std::set<ECC_Observer *> eccObservers;
 
         // Config and global setup
 		std::string username;
 		std::string password;
 		std::string authString;
 		std::string secureCachePath;
 		bool multiClusterMode;
 		cc_int32_t sipccLoggingMask;
 
-        // Local IP Address
-		std::string localIpAddress;
-		std::string defaultGW;
-
 		AuthenticationStatusEnum::AuthenticationStatus authenticationStatus;
 
 		std::string preferredDevice;
 		std::string preferredLineDN;
 		CC_ServicePtr phone;			// The generic handle, for simple operations.
 		CC_SIPCCServicePtr softPhone;	// For setup operations not available on the generic API.
 
         // All known devices
@@ -135,25 +131,25 @@ namespace CSF
 		// store connection state
 		ConnectionStatusEnum::ConnectionStatus connectionState;
 
 	public: // Listeners for stacks controlled by CallControlManager
 		// CC_Observers
 		void onDeviceEvent  (ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_DeviceInfoPtr info);
 		void onFeatureEvent (ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_FeatureInfoPtr info);
 		void onLineEvent    (ccapi_line_event_e lineEvent,     CC_LinePtr linePtr, CC_LineInfoPtr info);
-		void onCallEvent    (ccapi_call_event_e callEvent,     CC_CallPtr callPtr, CC_CallInfoPtr info, char* sdp);
+		void onCallEvent    (ccapi_call_event_e callEvent,     CC_CallPtr callPtr, CC_CallInfoPtr info);
 
 	private: //member functions
 
 		// CC_Observers
 		void notifyDeviceEventObservers  (ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_DeviceInfoPtr info);
 		void notifyFeatureEventObservers (ccapi_device_event_e deviceEvent, CC_DevicePtr devicePtr, CC_FeatureInfoPtr info);
 		void notifyLineEventObservers    (ccapi_line_event_e lineEvent,     CC_LinePtr linePtr, CC_LineInfoPtr info);
-		void notifyCallEventObservers    (ccapi_call_event_e callEvent,     CC_CallPtr callPtr, CC_CallInfoPtr info, char* sdp);
+		void notifyCallEventObservers    (ccapi_call_event_e callEvent,     CC_CallPtr callPtr, CC_CallInfoPtr info);
 
 		// ECC_Observers
 		void notifyAvailablePhoneEvent (AvailablePhoneEventType::AvailablePhoneEvent event,
 											const PhoneDetailsPtr phoneDetails);
 		void notifyAuthenticationStatusChange (AuthenticationStatusEnum::AuthenticationStatus);
 		void notifyConnectionStatusChange(ConnectionStatusEnum::ConnectionStatus status);
 		void setConnectionState(ConnectionStatusEnum::ConnectionStatus status);
 	};
--- a/media/webrtc/signaling/src/common/Wrapper.h
+++ b/media/webrtc/signaling/src/common/Wrapper.h
@@ -67,78 +67,123 @@
  * Future enhancements:
  * - For now, objects remain in the map forever.  Better would be to add a releaseHandle() function which would
  *   allow the map to be emptied as underlying handles expired.  While we can't force the client to give up its
  *   shared_ptr<Foo> objects, we can remove our own copy, for instance on a call ended event.
  */
 
 #include <map>
 #include "SharedPtr.h"
+#include "prlock.h"
 #include "base/lock.h"
+#include "mozilla/Assertions.h"
 
+/*
+ * Wrapper has its own autolock class because the instances are declared
+ * statically and mozilla::Mutex will not work properly when instantiated
+ * in a static constructor.
+ */
+
+class LockNSPR {
+public:
+  LockNSPR() : lock_(NULL) {
+    lock_ = PR_NewLock();
+    MOZ_ASSERT(lock_);
+  }
+  ~LockNSPR() {
+    PR_DestroyLock(lock_);
+  }
+
+  void Acquire() {
+    PR_Lock(lock_);
+  }
+
+  void Release() {
+    PR_Unlock(lock_);
+  }
+
+private:
+  PRLock *lock_;
+};
+
+class AutoLockNSPR {
+public:
+  AutoLockNSPR(LockNSPR& lock) : lock_(lock) {
+    lock_.Acquire();
+  }
+  ~AutoLockNSPR() {
+    lock_.Release();
+  }
+
+private:
+  LockNSPR& lock_;
+};
+ 
 template <class T>
 class Wrapper
 {
 private:
     typedef std::map<typename T::Handle, typename T::Ptr>      	HandleMapType;
-	HandleMapType 	handleMap;
-	Lock 		handleMapMutex;
+    HandleMapType handleMap;
+    LockNSPR handleMapMutex;
 
 public:
+	Wrapper() {}
+
 	typename T::Ptr wrap(typename T::Handle handle)
 	{
-		AutoLock lock(handleMapMutex);
+		AutoLockNSPR lock(handleMapMutex);
 		typename HandleMapType::iterator it = handleMap.find(handle);
 		if(it != handleMap.end())
 		{
 			return it->second;
 		}
 		else
 		{
 			typename T::Ptr p(new T(handle));
 			handleMap[handle] = p;
 			return p;
 		}
 	}
 
 	bool changeHandle(typename T::Handle oldHandle, typename T::Handle newHandle)
 	{
-		AutoLock lock(handleMapMutex);
+		AutoLockNSPR lock(handleMapMutex);
 		typename HandleMapType::iterator it = handleMap.find(oldHandle);
 		if(it != handleMap.end())
 		{
 			typename T::Ptr p = it->second;
 			handleMap.erase(it);
 			handleMap[newHandle] = p;
 			return true;
 		}
 		else
 		{
 			return false;
 		}
 	}
 
 	bool release(typename T::Handle handle)
 	{
-		AutoLock lock(handleMapMutex);
+		AutoLockNSPR lock(handleMapMutex);
 		typename HandleMapType::iterator it = handleMap.find(handle);
 		if(it != handleMap.end())
 		{
 			handleMap.erase(it);
 			return true;
 		}
 		else
 		{
 			return false;
 		}
 	}
 
 	void reset()
 	{
-		AutoLock lock(handleMapMutex);
+		AutoLockNSPR lock(handleMapMutex);
 		handleMap.clear();
 	}
 };
 
 #define CSF_DECLARE_WRAP(classname, handletype) \
 	public: \
 		static classname ## Ptr wrap(handletype handle); \
 		static void reset(); \
--- a/media/webrtc/signaling/src/common/browser_logging/CSFLogStream.h
+++ b/media/webrtc/signaling/src/common/browser_logging/CSFLogStream.h
@@ -36,20 +36,33 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef CSFLogStream_h
 #define CSFLogStream_h
 
 #include "CSFLog.h"
+
+#ifdef DEBUG
 #include <string>
 #include <sstream>
 #include <iostream>
 
 #define CSFLogCriticalS(tag, message)	{ std::ostringstream _oss; _oss << message << std::endl; CSFLog( CSF_LOG_CRITICAL, __FILE__ , __LINE__ , tag, _oss.str().c_str()); }
 #define CSFLogErrorS(tag, message)		{ std::ostringstream _oss; _oss << message << std::endl; CSFLog( CSF_LOG_ERROR, __FILE__ , __LINE__ , tag, _oss.str().c_str()); }
 #define CSFLogWarnS(tag, message)		{ std::ostringstream _oss; _oss << message << std::endl; CSFLog( CSF_LOG_WARNING, __FILE__ , __LINE__ , tag, _oss.str().c_str()); }
 #define CSFLogNoticeS(tag, message)		{ std::ostringstream _oss; _oss << message << std::endl; CSFLog( CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag, _oss.str().c_str()); }
 #define CSFLogInfoS(tag, message)		{ std::ostringstream _oss; _oss << message << std::endl; CSFLog( CSF_LOG_INFO, __FILE__ , __LINE__ , tag, _oss.str().c_str()); }
 #define CSFLogDebugS(tag, message)		{ std::ostringstream _oss; _oss << message << std::endl; CSFLog( CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag, _oss.str().c_str()); }
 
+#else // DEBUG
+
+#define CSFLogCriticalS(tag, message)   {}
+#define CSFLogErrorS(tag, message)      {}
+#define CSFLogWarnS(tag, message)       {}
+#define CSFLogNoticeS(tag, message)     {}
+#define CSFLogInfoS(tag, message)       {}
+#define CSFLogDebugS(tag, message)      {}
+
+#endif // DEBUG
+
 #endif
--- a/media/webrtc/signaling/src/common/csf_common.h
+++ b/media/webrtc/signaling/src/common/csf_common.h
@@ -45,17 +45,16 @@
 #include <vector>
 #include <stdlib.h>
 
 /*
 
 This header file defines:
 
 csf_countof
-csf_strcpy
 csf_sprintf
 csf_vsprintf
 
 */
 
 /*
   General security tip: Ensure that "format" is never a user-defined string. Format should ALWAYS be something that's built into your code, not
   user supplied. For example: never write:
@@ -83,28 +82,16 @@ csf_vsprintf
     #endif
 #else
     #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
 #endif
 //csf_countof
 
 #define csf_countof(anArray) _countof(anArray)
 
-//csf_strcpy
-
-#ifdef _WIN32
-  #define csf_strcpy(/* char* */ pDestination, /* size_t */ sizeOfBufferInCharsInclNullTerm, /* const char * */ pSource)\
-    strcpy_s(pDestination, sizeOfBufferInCharsInclNullTerm, pSource)
-#else
-  #define csf_strcpy(/* char * */ pDestination, /* size_t */ sizeOfBufferInCharsInclNullTerm, /* const char * */ pSource)\
-    strncpy(pDestination, pSource, sizeOfBufferInCharsInclNullTerm);\
-    pDestination[sizeOfBufferInCharsInclNullTerm-1] = '\0'
-#endif
-
-
 //csf_sprintf
 
 #ifdef _WIN32
   //Unlike snprintf, sprintf_s guarantees that the buffer will be null-terminated (unless the buffer size is zero).
   #define csf_sprintf(/* char* */ buffer, /* size_t */ sizeOfBufferInCharsInclNullTerm, /* const char * */ format, ...)\
     _snprintf_s (buffer, sizeOfBufferInCharsInclNullTerm, _TRUNCATE, format, __VA_ARGS__)
 #else
   #define csf_sprintf(/* char */ buffer, /* size_t */ sizeOfBufferInCharsInclNullTerm, /* const char * */ format, ...)\
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp
@@ -0,0 +1,733 @@
+/* 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 "AudioConduit.h"
+#include "CSFLog.h"
+#include "voice_engine/include/voe_errors.h"
+
+
+namespace mozilla {
+
+static const char* logTag ="WebrtcAudioSessionConduit";
+
+// 32 bytes is what WebRTC CodecInst expects
+const unsigned int WebrtcAudioConduit::CODEC_PLNAME_SIZE = 32;
+
+/**
+ * Factory Method for AudioConduit
+ */
+mozilla::RefPtr<AudioSessionConduit> AudioSessionConduit::Create()
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  WebrtcAudioConduit* obj = new WebrtcAudioConduit();
+  if(obj->Init() != kMediaConduitNoError)
+  {
+    CSFLogError(logTag,  "%s AudioConduit Init Failed ", __FUNCTION__);
+    delete obj;
+    return NULL;
+  }
+  CSFLogDebug(logTag,  "%s Successfully created AudioConduit ", __FUNCTION__);
+  return obj;
+}
+
+/**
+ * Destruction defines for our super-classes
+ */
+WebrtcAudioConduit::~WebrtcAudioConduit()
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  for(std::vector<AudioCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
+  {
+    delete mRecvCodecList[i];
+  }
+
+  delete mCurSendCodecConfig;
+
+  if(mPtrVoEXmedia)
+  {
+    mPtrVoEXmedia->SetExternalRecordingStatus(false);
+    mPtrVoEXmedia->SetExternalPlayoutStatus(false);
+    mPtrVoEXmedia->Release();
+  }
+
+  //Deal with the transport
+  if(mPtrVoENetwork)
+  {
+    mPtrVoENetwork->DeRegisterExternalTransport(mChannel);
+    mPtrVoENetwork->Release();
+  }
+
+  if(mPtrVoECodec)
+  {
+    mPtrVoECodec->Release();
+  }
+
+  if(mPtrVoEBase)
+  {
+    mPtrVoEBase->StopPlayout(mChannel);
+    mPtrVoEBase->StopSend(mChannel);
+    mPtrVoEBase->StopReceive(mChannel);
+    mPtrVoEBase->DeleteChannel(mChannel);
+    mPtrVoEBase->Terminate();
+    mPtrVoEBase->Release();
+  }
+
+  if(mVoiceEngine)
+  {
+    webrtc::VoiceEngine::Delete(mVoiceEngine);
+  }
+}
+
+/*
+ * WebRTCAudioConduit Implementation
+ */
+MediaConduitErrorCode WebrtcAudioConduit::Init()
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  //Per WebRTC APIs below function calls return NULL on failure
+  if(!(mVoiceEngine = webrtc::VoiceEngine::Create()))
+  {
+    CSFLogError(logTag, "%s Unable to create voice engine", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if(!(mPtrVoEBase = VoEBase::GetInterface(mVoiceEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to initialize VoEBase", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if(!(mPtrVoENetwork = VoENetwork::GetInterface(mVoiceEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to initialize VoENetwork", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if(!(mPtrVoECodec = VoECodec::GetInterface(mVoiceEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to initialize VoEBCodec", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if(!(mPtrVoEXmedia = VoEExternalMedia::GetInterface(mVoiceEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to initialize VoEExternalMedia", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  // init the engine with our audio device layer
+  if(mPtrVoEBase->Init() == -1)
+  {
+    CSFLogError(logTag, "%s VoiceEngine Base Not Initialized", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if( (mChannel = mPtrVoEBase->CreateChannel()) == -1)
+  {
+    CSFLogError(logTag, "%s VoiceEngine Channel creation failed",__FUNCTION__);
+    return kMediaConduitChannelError;
+  }
+
+  CSFLogDebug(logTag, "%s Channel Created %d ",__FUNCTION__, mChannel);
+
+  if(mPtrVoENetwork->RegisterExternalTransport(mChannel, *this) == -1)
+  {
+    CSFLogError(logTag, "%s VoiceEngine, External Transport Failed",__FUNCTION__);
+    return kMediaConduitTransportRegistrationFail;
+  }
+
+  if(mPtrVoEXmedia->SetExternalRecordingStatus(true) == -1)
+  {
+    CSFLogError(logTag, "%s SetExternalRecordingStatus Failed %d",__FUNCTION__,
+                                                      mPtrVoEBase->LastError());
+    return kMediaConduitExternalPlayoutError;
+  }
+
+  if(mPtrVoEXmedia->SetExternalPlayoutStatus(true) == -1)
+  {
+    CSFLogError(logTag, "%s SetExternalPlayoutStatus Failed %d ",__FUNCTION__,
+                                                     mPtrVoEBase->LastError());
+    return kMediaConduitExternalRecordingError;
+  }
+  CSFLogDebug(logTag ,  "%s AudioSessionConduit Initialization Done",__FUNCTION__);
+  return kMediaConduitNoError;
+}
+
+
+// AudioSessionConduit Implementation
+MediaConduitErrorCode
+WebrtcAudioConduit::AttachTransport(mozilla::RefPtr<TransportInterface> aTransport)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  if(!aTransport)
+  {
+    CSFLogError(logTag, "%s NULL Transport", __FUNCTION__);
+    return kMediaConduitInvalidTransport;
+  }
+  // set the transport
+  mTransport = aTransport;
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  MediaConduitErrorCode condError = kMediaConduitNoError;
+  int error = 0;//webrtc engine errors
+  webrtc::CodecInst cinst;
+
+  //validate codec param
+  if((condError = ValidateCodecConfig(codecConfig, true)) != kMediaConduitNoError)
+  {
+    return condError;
+  }
+
+  //are we transmitting already, stop and apply the send codec
+  if(mEngineTransmitting)
+  {
+    CSFLogDebug(logTag, "%s Engine Already Sending. Attemping to Stop ", __FUNCTION__);
+    if(mPtrVoEBase->StopSend(mChannel) == -1)
+    {
+      CSFLogError(logTag, "%s StopSend() Failed %d ", __FUNCTION__,
+                                          mPtrVoEBase->LastError());
+      return kMediaConduitUnknownError;
+    }
+  }
+
+  mEngineTransmitting = false;
+
+  if(!CodecConfigToWebRTCCodec(codecConfig,cinst))
+  {
+    CSFLogError(logTag,"%s CodecConfig to WebRTC Codec Failed ",__FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  if(mPtrVoECodec->SetSendCodec(mChannel, cinst) == -1)
+  {
+    error = mPtrVoEBase->LastError();
+    CSFLogError(logTag, "%s SetSendCodec - Invalid Codec %d ",__FUNCTION__,
+                                                                    error);
+
+    if(error ==  VE_CANNOT_SET_SEND_CODEC || error == VE_CODEC_ERROR)
+    {
+      return kMediaConduitInvalidSendCodec;
+    }
+
+    return kMediaConduitUnknownError;
+  }
+
+  //Let's Send Transport State-machine on the Engine
+  if(mPtrVoEBase->StartSend(mChannel) == -1)
+  {
+    error = mPtrVoEBase->LastError();
+    CSFLogError(logTag, "%s StartSend failed %d", __FUNCTION__, error);
+    return kMediaConduitUnknownError;
+  }
+
+  //Copy the applied config for future reference.
+  delete mCurSendCodecConfig;
+
+  mCurSendCodecConfig = new AudioCodecConfig(codecConfig->mType,
+                                              codecConfig->mName,
+                                              codecConfig->mFreq,
+                                              codecConfig->mPacSize,
+                                              codecConfig->mChannels,
+                                              codecConfig->mRate);
+
+
+  mEngineTransmitting = true;
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcAudioConduit::ConfigureRecvMediaCodecs(
+                    const std::vector<AudioCodecConfig*>& codecConfigList)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  MediaConduitErrorCode condError = kMediaConduitNoError;
+  int error = 0; //webrtc engine errors
+  bool success = false;
+
+  // are we receiving already. If so, stop receiving and playout
+  // since we can't apply new recv codec when the engine is playing
+  if(mEngineReceiving)
+  {
+    CSFLogDebug(logTag, "%s Engine Already Receiving. Attemping to Stop ", __FUNCTION__);
+    // AudioEngine doesn't fail fatal on stop reception. Ref:voe_errors.h.
+    // hence we need-not be strict in failing here on error
+    mPtrVoEBase->StopReceive(mChannel);
+    CSFLogDebug(logTag, "%s Attemping to Stop playout ", __FUNCTION__);
+    if(mPtrVoEBase->StopPlayout(mChannel) == -1)
+    {
+      if( mPtrVoEBase->LastError() == VE_CANNOT_STOP_PLAYOUT)
+      {
+        CSFLogDebug(logTag, "%s Stop-Playout Failed %d", mPtrVoEBase->LastError());
+        return kMediaConduitPlayoutError;
+      }
+    }
+  }
+
+  mEngineReceiving = false;
+
+  if(!codecConfigList.size())
+  {
+    CSFLogError(logTag, "%s Zero number of codecs to configure", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //Try Applying the codecs in the list
+  for(std::vector<AudioCodecConfig*>::size_type i=0 ;i<codecConfigList.size();i++)
+  {
+    //if the codec param is invalid or diplicate, return error
+    if((condError = ValidateCodecConfig(codecConfigList[i],false)) != kMediaConduitNoError)
+    {
+      return condError;
+    }
+
+    webrtc::CodecInst cinst;
+    if(!CodecConfigToWebRTCCodec(codecConfigList[i],cinst))
+    {
+      CSFLogError(logTag,"%s CodecConfig to WebRTC Codec Failed ",__FUNCTION__);
+      continue;
+    }
+
+    if(mPtrVoECodec->SetRecPayloadType(mChannel,cinst) == -1)
+    {
+      error = mPtrVoEBase->LastError();
+      CSFLogError(logTag,  "%s SetRecvCodec Failed %d ",__FUNCTION__, error);
+      continue;
+    } else {
+      CSFLogDebug(logTag, "%s Successfully Set RecvCodec %s", __FUNCTION__,
+                                          codecConfigList[i]->mName.c_str());
+      //copy this to local database
+      if(CopyCodecToDB(codecConfigList[i]))
+      {
+        success = true;
+      } else {
+        CSFLogError(logTag,"%s Unable to updated Codec Database", __FUNCTION__);
+        return kMediaConduitUnknownError;
+      }
+
+    }
+
+  } //end for
+
+  //Success == false indicates none of the codec was applied
+  if(!success)
+  {
+    CSFLogError(logTag, "%s Setting Receive Codec Failed ", __FUNCTION__);
+    return kMediaConduitInvalidReceiveCodec;
+  }
+
+  //If we are here, atleast one codec should have been set
+  if(mPtrVoEBase->StartReceive(mChannel) == -1)
+  {
+    error = mPtrVoEBase->LastError();
+    CSFLogError(logTag ,  "StartReceive Failed %d ",error);
+    if(error == VE_RECV_SOCKET_ERROR)
+    {
+      return kMediaConduitSocketError;
+    }
+    return kMediaConduitUnknownError;
+  }
+
+
+  if(mPtrVoEBase->StartPlayout(mChannel) == -1)
+  {
+    CSFLogError(logTag, "Starting playout Failed");
+    return kMediaConduitPlayoutError;
+  }
+
+  //we should be good here for setting this.
+  mEngineReceiving = true;
+  DumpCodecDB();
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcAudioConduit::SendAudioFrame(const int16_t audio_data[],
+                                    int32_t lengthSamples,
+                                    int32_t samplingFreqHz,
+                                    int32_t capture_delay)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  // Following checks need to be performed
+  // 1. Non null audio buffer pointer,
+  // 2. invalid sampling frequency -  less than 0 or unsupported ones
+  // 3. Appropriate Sample Length for 10 ms audio-frame. This represents
+  //    block size the VoiceEngine feeds into encoder for passed in audio-frame
+  //    Ex: for 16000 sampling rate , valid block-length is 160
+  //    Similarly for 32000 sampling rate, valid block length is 320
+  //    We do the check by the verify modular operator below to be zero
+
+  if(!audio_data || (lengthSamples <= 0) ||
+                    (IsSamplingFreqSupported(samplingFreqHz) == false) ||
+                    ((lengthSamples % (samplingFreqHz / 100) != 0)) )
+  {
+    CSFLogError(logTag, "%s Invalid Params ", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //validate capture time
+  if(capture_delay < 0 )
+  {
+    CSFLogError(logTag,"%s Invalid Capture Delay ", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+
+  // if transmission is not started .. conduit cannot insert frames
+  if(!mEngineTransmitting)
+  {
+    CSFLogError(logTag, "%s Engine not transmitting ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+
+  //Insert the samples
+  if(mPtrVoEXmedia->ExternalRecordingInsertData(audio_data,
+                                                lengthSamples,
+                                                samplingFreqHz,
+                                                capture_delay) == -1)
+  {
+    int error = mPtrVoEBase->LastError();
+    CSFLogError(logTag,  "Inserting audio data Failed %d", error);
+    if(error == VE_RUNTIME_REC_ERROR)
+    {
+      return kMediaConduitRecordingError;
+    }
+    return kMediaConduitUnknownError;
+  }
+  // we should be good here
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
+                                   int32_t samplingFreqHz,
+                                   int32_t capture_delay,
+                                   int& lengthSamples)
+{
+
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  unsigned int numSamples = 0;
+
+  //validate params
+  if(!speechData )
+  {
+    CSFLogError(logTag,"%s Null Audio Buffer Pointer", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+
+  // Validate sample length
+  if((numSamples = GetNum10msSamplesForFrequency(samplingFreqHz)) == 0  )
+  {
+    CSFLogError(logTag,"%s Invalid Sampling Frequency ", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //validate capture time
+  if(capture_delay < 0 )
+  {
+    CSFLogError(logTag,"%s Invalid Capture Delay ", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //Conduit should have reception enabled before we ask for decoded
+  // samples
+  if(!mEngineReceiving)
+  {
+    CSFLogError(logTag, "%s Engine not Receiving ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+
+  lengthSamples = 0;  //output paramter
+
+  if(mPtrVoEXmedia->ExternalPlayoutGetData( speechData,
+                                            samplingFreqHz,
+                                            capture_delay,
+                                            lengthSamples) == -1)
+  {
+    int error = mPtrVoEBase->LastError();
+    CSFLogError(logTag,  "Getting audio data Failed %d", error);
+    if(error == VE_RUNTIME_PLAY_ERROR)
+    {
+      return kMediaConduitPlayoutError;
+    }
+    return kMediaConduitUnknownError;
+  }
+
+  CSFLogDebug(logTag,"%s GetAudioFrame:Got samples: length %d ",__FUNCTION__,
+                                                               lengthSamples);
+  return kMediaConduitNoError;
+}
+
+// Transport Layer Callbacks
+MediaConduitErrorCode
+WebrtcAudioConduit::ReceivedRTPPacket(const void *data, int len)
+{
+  CSFLogDebug(logTag,  "%s : channel %d", __FUNCTION__, mChannel);
+
+  if(mEngineReceiving)
+  {
+    if(mPtrVoENetwork->ReceivedRTPPacket(mChannel,data,len) == -1)
+    {
+      int error = mPtrVoEBase->LastError();
+      CSFLogError(logTag, "%s RTP Processing Error %d ", error);
+      if(error == VE_RTP_RTCP_MODULE_ERROR)
+      {
+        return kMediaConduitRTPRTCPModuleError;
+      }
+      return kMediaConduitUnknownError;
+    }
+  } else {
+    //engine not receiving
+    CSFLogError(logTag, "ReceivedRTPPacket: Engine Error");
+    return kMediaConduitSessionNotInited;
+  }
+  //good here
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcAudioConduit::ReceivedRTCPPacket(const void *data, int len)
+{
+  CSFLogDebug(logTag,  "%s : channel %d ",__FUNCTION__, mChannel);
+
+  if(mEngineReceiving)
+  {
+    if(mPtrVoENetwork->ReceivedRTCPPacket(mChannel, data, len) == -1)
+    {
+      int error = mPtrVoEBase->LastError();
+      CSFLogError(logTag, "%s RTCP Processing Error %d ", error);
+      if(error == VE_RTP_RTCP_MODULE_ERROR)
+      {
+        return kMediaConduitRTPRTCPModuleError;
+      }
+      return kMediaConduitUnknownError;
+    }
+  } else {
+    //engine not running
+    CSFLogError(logTag, "ReceivedRTPPacket: Engine Error");
+    return kMediaConduitSessionNotInited;
+  }
+  //good here
+  return kMediaConduitNoError;
+}
+
+//WebRTC::RTP Callback Implementation
+
+int WebrtcAudioConduit::SendPacket(int channel, const void* data, int len)
+{
+  CSFLogDebug(logTag,  "%s : channel %d",__FUNCTION__,channel);
+
+   if(mTransport && (mTransport->SendRtpPacket(data, len) == NS_OK))
+   {
+      CSFLogDebug(logTag, "%s Sent RTP Packet ", __FUNCTION__);
+      return 0;
+   } else {
+     CSFLogError(logTag, "%s RTP Packet Send Failed ", __FUNCTION__);
+     return -1;
+   }
+
+}
+
+int WebrtcAudioConduit::SendRTCPPacket(int channel, const void* data, int len)
+{
+  CSFLogDebug(logTag,  "%s : channel %d", __FUNCTION__, channel);
+  if(mTransport && mTransport->SendRtcpPacket(data, len) == NS_OK)
+  {
+    CSFLogDebug(logTag, "%s Sent RTCP Packet ", __FUNCTION__);
+    return 0;
+  } else {
+    CSFLogError(logTag, "%s RTCP Packet Send Failed ", __FUNCTION__);
+    return -1;
+  }
+
+}
+
+/**
+ * Converts between CodecConfig to WebRTC Codec Structure.
+ */
+
+bool
+WebrtcAudioConduit::CodecConfigToWebRTCCodec(const AudioCodecConfig* codecInfo,
+                                              webrtc::CodecInst& cinst)
+ {
+  const unsigned int plNameLength = codecInfo->mName.length()+1;
+  memset(&cinst, 0, sizeof(webrtc::CodecInst));
+  if(sizeof(cinst.plname) < plNameLength)
+  {
+    CSFLogError(logTag, "%s Payload name buffer capacity mismatch ",
+                                                      __FUNCTION__);
+    return false;
+  }
+  memcpy(cinst.plname, codecInfo->mName.c_str(),codecInfo->mName.length());
+  cinst.plname[plNameLength]='\0';
+  cinst.pltype   =  codecInfo->mType;
+  cinst.rate     =  codecInfo->mRate;
+  cinst.pacsize  =  codecInfo->mPacSize;
+  cinst.plfreq   =  codecInfo->mFreq;
+  cinst.channels =  codecInfo->mChannels;
+  return true;
+ }
+
+/**
+  *  Supported Sampling Frequncies.
+  */
+bool
+WebrtcAudioConduit::IsSamplingFreqSupported(int freq) const
+{
+  if(GetNum10msSamplesForFrequency(freq))
+  {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+/* Return block-length of 10 ms audio frame in number of samples */
+unsigned int
+WebrtcAudioConduit::GetNum10msSamplesForFrequency(int samplingFreqHz) const
+{
+  switch(samplingFreqHz)
+  {
+    case 16000: return 160; //160 samples
+    case 32000: return 320; //320 samples
+    case 44000: return 440; //440 samples
+    case 48000: return 480; //480 samples
+    default:    return 0; // invalid or unsupported
+  }
+}
+
+//Copy the codec passed into Conduit's database
+bool
+WebrtcAudioConduit::CopyCodecToDB(const AudioCodecConfig* codecInfo)
+{
+
+  AudioCodecConfig* cdcConfig = new AudioCodecConfig(codecInfo->mType,
+                                                     codecInfo->mName,
+                                                     codecInfo->mFreq,
+                                                     codecInfo->mPacSize,
+                                                     codecInfo->mChannels,
+                                                     codecInfo->mRate);
+  mRecvCodecList.push_back(cdcConfig);
+  return true;
+}
+
+/**
+ * Checks if 2 codec structs are same
+ */
+bool
+WebrtcAudioConduit::CheckCodecsForMatch(const AudioCodecConfig* curCodecConfig,
+                                         const AudioCodecConfig* codecInfo) const
+{
+  if(!curCodecConfig)
+  {
+    return false;
+  }
+
+  if(curCodecConfig->mType   == codecInfo->mType &&
+      (curCodecConfig->mName.compare(codecInfo->mName) == 0) &&
+      curCodecConfig->mFreq   == codecInfo->mFreq &&
+      curCodecConfig->mPacSize == codecInfo->mPacSize &&
+      curCodecConfig->mChannels == codecInfo->mChannels &&
+      curCodecConfig->mRate == codecInfo->mRate)
+  {
+    return true;
+  }
+
+  return false;
+}
+
+/**
+ * Checks if the codec is already in Conduit's database
+ */
+bool
+WebrtcAudioConduit::CheckCodecForMatch(const AudioCodecConfig* codecInfo) const
+{
+  //the db should have atleast one codec
+  for(std::vector<AudioCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
+  {
+    if(CheckCodecsForMatch(mRecvCodecList[i],codecInfo))
+    {
+      //match
+      return true;
+    }
+  }
+  //no match or empty local db
+  return false;
+}
+
+
+/**
+ * Perform validation on the codecCofig to be applied
+ * Verifies if the codec is already applied.
+ */
+MediaConduitErrorCode
+WebrtcAudioConduit::ValidateCodecConfig(const AudioCodecConfig* codecInfo,
+                                         bool send) const
+{
+  bool codecAppliedAlready = false;
+
+  if(!codecInfo)
+  {
+    CSFLogError(logTag, "%s Null CodecConfig ", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  if((codecInfo->mName.empty()) ||
+     (codecInfo->mName.length() >= CODEC_PLNAME_SIZE))
+  {
+    CSFLogError(logTag, "%s Invalid Payload Name Length ", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //Only mono or stereo channels supported
+  if( (codecInfo->mChannels != 1) && (codecInfo->mChannels != 2))
+  {
+    CSFLogError(logTag, "%s Channel Unsupported ", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //check if we have the same codec already applied
+  if(send)
+  {
+    codecAppliedAlready = CheckCodecsForMatch(mCurSendCodecConfig,codecInfo);
+  } else {
+    codecAppliedAlready = CheckCodecForMatch(codecInfo);
+  }
+
+  if(codecAppliedAlready)
+  {
+    CSFLogDebug(logTag, "%s Codec %s Already Applied  ", __FUNCTION__, codecInfo->mName.c_str());
+    return kMediaConduitCodecInUse;
+  }
+  return kMediaConduitNoError;
+}
+
+void
+WebrtcAudioConduit::DumpCodecDB() const
+ {
+    for(std::vector<AudioCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
+    {
+      CSFLogDebug(logTag,"Payload Name: %s", mRecvCodecList[i]->mName.c_str());
+      CSFLogDebug(logTag,"Payload Type: %d", mRecvCodecList[i]->mType);
+      CSFLogDebug(logTag,"Payload Frequency: %d", mRecvCodecList[i]->mFreq);
+      CSFLogDebug(logTag,"Payload PacketSize: %d", mRecvCodecList[i]->mPacSize);
+      CSFLogDebug(logTag,"Payload Channels: %d", mRecvCodecList[i]->mChannels);
+      CSFLogDebug(logTag,"Payload Sampling Rate: %d", mRecvCodecList[i]->mRate);
+    }
+ }
+}// end namespace
+
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.h
@@ -0,0 +1,207 @@
+/* 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/. */
+
+
+#ifndef AUDIO_SESSION_H_
+#define AUDIO_SESSION_H_
+
+#include "mozilla/Attributes.h"
+
+#include "MediaConduitInterface.h"
+
+// Audio Engine Includes
+#include "common_types.h"
+#include "voice_engine/include/voe_base.h"
+#include "voice_engine/include/voe_volume_control.h"
+#include "voice_engine/include/voe_codec.h"
+#include "voice_engine/include/voe_file.h"
+#include "voice_engine/include/voe_network.h"
+#include "voice_engine/include/voe_external_media.h"
+
+//Some WebRTC types for short notations
+ using webrtc::VoEBase;
+ using webrtc::VoENetwork;
+ using webrtc::VoECodec;
+ using webrtc::VoEExternalMedia;
+
+/** This file hosts several structures identifying different aspects
+ * of a RTP Session.
+ */
+
+namespace mozilla {
+
+/**
+ * Concrete class for Audio session. Hooks up
+ *  - media-source and target to external transport
+ */
+class WebrtcAudioConduit:public AudioSessionConduit
+	      		            ,public webrtc::Transport
+{
+public:
+  //VoiceEngine defined constant for Payload Name Size.
+  static const unsigned int CODEC_PLNAME_SIZE;
+
+  /**
+   * APIs used by the registered external transport to this Conduit to
+   * feed in received RTP Frames to the VoiceEngine for decoding
+   */
+ virtual MediaConduitErrorCode ReceivedRTPPacket(const void *data, int len);
+
+  /**
+   * APIs used by the registered external transport to this Conduit to
+   * feed in received RTCP Frames to the VoiceEngine for decoding
+   */
+ virtual MediaConduitErrorCode ReceivedRTCPPacket(const void *data, int len);
+
+  /**
+   * Function to configure send codec for the audio session
+   * @param sendSessionConfig: CodecConfiguration
+   * @result: On Success, the audio engine is configured with passed in codec for send
+   *          On failure, audio engine transmit functionality is disabled.
+   * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
+   *        transmission sub-system on the engine.
+   */
+ virtual MediaConduitErrorCode ConfigureSendMediaCodec(
+                               const AudioCodecConfig* codecConfig);
+  /**
+   * Function to configure list of receive codecs for the audio session
+   * @param sendSessionConfig: CodecConfiguration
+   * @result: On Success, the audio engine is configured with passed in codec for send
+   *          Also the playout is enabled.
+   *          On failure, audio engine transmit functionality is disabled.
+   * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
+   *        transmission sub-system on the engine.
+   */
+ virtual MediaConduitErrorCode ConfigureRecvMediaCodecs(
+                               const std::vector<AudioCodecConfig* >& codecConfigList);
+
+  /**
+   * Register External Transport to this Conduit. RTP and RTCP frames from the VoiceEnigne
+   * shall be passed to the registered transport for transporting externally.
+   */
+ virtual MediaConduitErrorCode AttachTransport(
+                               mozilla::RefPtr<TransportInterface> aTransport);
+
+  /**
+   * Function to deliver externally captured audio sample for encoding and transport
+   * @param audioData [in]: Pointer to array containing a frame of audio
+   * @param lengthSamples [in]: Length of audio frame in samples in multiple of 10 milliseconds
+   *                             Ex: Frame length is 160, 320, 440 for 16, 32, 44 kHz sampling rates
+                                    respectively.
+                                    audioData[] should be of lengthSamples in size
+                                    say, for 16kz sampling rate, audioData[] should contain 160
+                                    samples of 16-bits each for a 10m audio frame.
+   * @param samplingFreqHz [in]: Frequency/rate of the sampling in Hz ( 16000, 32000 ...)
+   * @param capture_delay [in]:  Approx Delay from recording until it is delivered to VoiceEngine
+                                 in milliseconds.
+   * NOTE: ConfigureSendMediaCodec() SHOULD be called before this function can be invoked
+   *       This ensures the inserted audio-samples can be transmitted by the conduit
+   *
+   */
+ virtual MediaConduitErrorCode SendAudioFrame(const int16_t speechData[],
+                                              int32_t lengthSamples,
+                                              int32_t samplingFreqHz,
+                                              int32_t capture_time);
+
+  /**
+   * Function to grab a decoded audio-sample from the media engine for rendering
+   * / playoutof length 10 milliseconds.
+   *
+   * @param speechData [in]: Pointer to a array to which a 10ms frame of audio will be copied
+   * @param samplingFreqHz [in]: Frequency of the sampling for playback in Hertz (16000, 32000,..)
+   * @param capture_delay [in]: Estimated Time between reading of the samples to rendering/playback
+   * @param lengthSamples [out]: Will contain length of the audio frame in samples at return.
+                                 Ex: A value of 160 implies 160 samples each of 16-bits was copied
+                                     into speechData
+   * NOTE: This function should be invoked every 10 milliseconds for the best
+   *          peformance
+   * NOTE: ConfigureRecvMediaCodec() SHOULD be called before this function can be invoked
+   *       This ensures the decoded samples are ready for reading and playout is enabled.
+   *
+   */
+   virtual MediaConduitErrorCode GetAudioFrame(int16_t speechData[],
+                                              int32_t samplingFreqHz,
+                                              int32_t capture_delay,
+                                              int& lengthSamples);
+
+
+  /**
+   * Webrtc transport implementation to send and receive RTP packet.
+   * AudioConduit registers itself as ExternalTransport to the VoiceEngine
+   */
+  virtual int SendPacket(int channel, const void *data, int len) ;
+
+  /**
+   * Webrtc transport implementation to send and receive RTCP packet.
+   * AudioConduit registers itself as ExternalTransport to the VoiceEngine
+   */
+  virtual int SendRTCPPacket(int channel, const void *data, int len) ;
+
+
+
+  WebrtcAudioConduit():
+                      mVoiceEngine(NULL),
+                      mTransport(NULL),
+                      mEngineTransmitting(false),
+                      mEngineReceiving(false),
+                      mChannel(-1),
+                      mCurSendCodecConfig(NULL)
+  {
+  }
+
+  virtual ~WebrtcAudioConduit();
+
+  MediaConduitErrorCode Init();
+
+private:
+  WebrtcAudioConduit(const WebrtcAudioConduit& other) MOZ_DELETE;
+  void operator=(const WebrtcAudioConduit& other) MOZ_DELETE;
+
+  //Local database of currently applied receive codecs
+  typedef std::vector<AudioCodecConfig* > RecvCodecList;
+
+  //Function to convert between WebRTC and Conduit codec structures
+  bool CodecConfigToWebRTCCodec(const AudioCodecConfig* codecInfo,
+                                webrtc::CodecInst& cinst);
+
+  //Checks if given sampling frequency is supported
+  bool IsSamplingFreqSupported(int freq) const;
+
+  //Generate block size in sample lenght for a given sampling frequency
+  unsigned int GetNum10msSamplesForFrequency(int samplingFreqHz) const;
+
+  // Function to copy a codec structure to Conduit's database
+  bool CopyCodecToDB(const AudioCodecConfig* codecInfo);
+
+  // Functions to verify if the codec passed is already in
+  // conduits database
+  bool CheckCodecForMatch(const AudioCodecConfig* codecInfo) const;
+  bool CheckCodecsForMatch(const AudioCodecConfig* curCodecConfig,
+                           const AudioCodecConfig* codecInfo) const;
+  //Checks the codec to be applied
+  MediaConduitErrorCode ValidateCodecConfig(const AudioCodecConfig* codecInfo, bool send) const;
+
+  //Utility function to dump recv codec database
+  void DumpCodecDB() const;
+
+  webrtc::VoiceEngine* mVoiceEngine;
+  mozilla::RefPtr<TransportInterface> mTransport;
+  webrtc::VoENetwork*  mPtrVoENetwork;
+  webrtc::VoEBase*     mPtrVoEBase;
+  webrtc::VoECodec*    mPtrVoECodec;
+  webrtc::VoEExternalMedia* mPtrVoEXmedia;
+
+  //engine states of our interets
+  bool mEngineTransmitting; // If true => VoiceEngine Send-subsystem is up
+  bool mEngineReceiving;    // If true => VoiceEngine Receive-subsystem is up
+                            // and playout is enabled
+
+  int mChannel;
+  RecvCodecList    mRecvCodecList;
+  AudioCodecConfig* mCurSendCodecConfig;
+};
+
+} // end namespace
+
+#endif
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/CodecConfig.h
@@ -0,0 +1,74 @@
+
+/* 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/. */
+
+#ifndef CODEC_CONFIG_H_
+#define CODEC_CONFIG_H_
+
+#include <string>
+
+
+namespace mozilla {
+
+/**
+ * Minimalistic Audio Codec Config Params
+ */
+struct AudioCodecConfig
+{
+  /*
+   * The data-types for these properties mimic the
+   * corresponding webrtc::CodecInst data-types.
+   */
+  int mType;
+  std::string mName;
+  int mFreq;
+  int mPacSize;
+  int mChannels;
+  int mRate;
+
+  /* Default constructor is not provided since as a consumer, we
+   * can't decide the default configuration for the codec
+   */
+  explicit AudioCodecConfig(int type, std::string name,
+                            int freq,int pacSize,
+                            int channels, int rate): mType(type),
+                                                     mName(name),
+                                                     mFreq(freq),
+                                                     mPacSize(pacSize),
+                                                     mChannels(channels),
+                                                     mRate(rate)
+
+  {
+  }
+};
+
+/*
+ * Minimalisitc video codec configuration
+ * More to be added later depending on the use-case
+ */
+
+struct VideoCodecConfig
+{
+
+  /*
+   * The data-types for these properties mimic the
+   * corresponding webrtc::VideoCodec data-types.
+   */
+  int mType;
+  std::string mName;
+  int mWidth;
+  int mHeight;
+
+  VideoCodecConfig(int type, std::string name,int width,
+                    int height): mType(type),
+                                 mName(name),
+                                 mWidth(width),
+                                 mHeight(height)
+
+  {
+  }
+
+};
+}
+#endif
\ No newline at end of file
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/MediaConduitErrors.h
@@ -0,0 +1,41 @@
+/* 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/. */
+
+
+#ifndef MEDIA_SESSION_ERRORS_H_
+#define MEDIA_SESSION_ERRORS_H_
+
+namespace mozilla
+{
+enum MediaConduitErrorCode
+{
+kMediaConduitNoError = 0,              // 0 for Success,greater than 0 imples error
+kMediaConduitSessionNotInited = 10100, // Session not initialized.10100 serves as
+                                       // base for the conduit errors
+kMediaConduitMalformedArgument,        // Malformed input to Conduit API
+kMediaConduitCaptureError,             // WebRTC capture APIs failed
+kMediaConduitInvalidSendCodec,         // Wrong Send codec
+kMediaConduitInvalidReceiveCodec,      // Wrong Recv Codec
+kMediaConduitCodecInUse,               // Already applied Codec
+kMediaConduitInvalidRenderer,          // NULL or Wrong Renderer object
+kMediaConduitRendererFail,             // Add Render called multiple times
+kMediaConduitSendingAlready,           // Engine already trasmitting
+kMediaConduitReceivingAlready,         // Engine already receiving
+kMediaConduitTransportRegistrationFail,// NULL or wrong transport interface
+kMediaConduitInvalidTransport,         // NULL or wrong transport interface
+kMediaConduitChannelError,             // Configuration Error
+kMediaConduitSocketError,              // Media Engine transport socket error
+kMediaConduitRTPRTCPModuleError,       // Couldn't start RTP/RTCP processing
+kMediaConduitRTPProcessingFailed,      // Processing incoming RTP frame failed
+kMediaConduitUnknownError,             // More information can be found in logs
+kMediaConduitExternalRecordingError,   // Couldn't start external recording
+kMediaConduitRecordingError,           // Runtime recording error
+kMediaConduitExternalPlayoutError,     // Couldn't start external playout
+kMediaConduitPlayoutError              // Runtime playout error
+};
+
+}
+
+#endif
+
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
@@ -0,0 +1,306 @@
+/* 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/. */
+
+#ifndef MEDIA_CONDUIT_ABSTRACTION_
+#define MEDIA_CONDUIT_ABSTRACTION_
+
+#include "nspr.h"
+#include "prerror.h"
+
+#include "nsISupportsImpl.h"
+#include "nsXPCOM.h"
+#include "mozilla/RefPtr.h"
+#include "CodecConfig.h"
+#include "VideoTypes.h"
+#include "MediaConduitErrors.h"
+
+#include <vector>
+
+namespace mozilla {
+/**
+ * Abstract Interface for transporting RTP packets - audio/vidoeo
+ * The consumers of this interface are responsible for passing in
+ * the RTPfied media packets
+ */
+class TransportInterface
+{
+public:
+  virtual ~TransportInterface() {};
+
+  /**
+   * RTP Transport Function to be implemented by concrete transport implementation
+   * @param data : RTP Packet (audio/video) to be transported
+   * @param len  : Length of the media packet
+   * @result     : NS_OK on success, NS_ERROR_FAILURE otherwise
+   */
+  virtual nsresult SendRtpPacket(const void* data, int len) = 0;
+
+  /**
+   * RTCP Transport Function to be implemented by concrete transport implementation
+   * @param data : RTCP Packet to be transported
+   * @param len  : Length of the RTCP packet
+   * @result     : NS_OK on success, NS_ERROR_FAILURE otherwise
+   */
+  virtual nsresult SendRtcpPacket(const void* data, int len) = 0;
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TransportInterface)
+};
+
+
+/**
+ * 1. Abstract renderer for video data
+ * 2. This class acts as abstract interface between the video-engine and
+ *    video-engine agnostic renderer implementation.
+ * 3. Concrete implementation of this interface is responsible for
+ *    processing and/or rendering the obtained raw video frame to appropriate
+ *    output , say, <video>
+ */
+class VideoRenderer
+{
+ public:
+  virtual ~VideoRenderer() {} ;
+
+  /**
+   * Callback Function reportng any change in the video-frame dimensions
+   * @param width:  current width of the video @ decoder
+   * @param height: current height of the video @ decoder
+   * @param number_of_streams: number of participating video streams
+   */
+  virtual void FrameSizeChange(unsigned int width,
+                               unsigned int height,
+                               unsigned int number_of_streams) = 0;
+
+  /**
+   * Callback Function reporting decoded I420 frame for processing.
+   * @param buffer: pointer to decoded video frame
+   * @param buffer_size: size of the decoded frame
+   * @param time_stamp: Decoder timestamp, typically 90KHz as per RTP
+   * @render_time: Wall-clock time at the decoder for synchronization
+   *                purposes in milliseconds
+   * NOTE: It is the responsibility of the concrete implementations of this
+   * class to own copy of the frame if needed for time longer than scope of
+   * this callback.
+   * Such implementations should be quick in processing the frames and return
+   * immediately.
+   */
+  virtual void RenderVideoFrame(const unsigned char* buffer,
+                                unsigned int buffer_size,
+                                uint32_t time_stamp,
+                                int64_t render_time) = 0;
+
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoRenderer)
+};
+
+
+/**
+ * Generic Interface for representing Audio/Video Session
+ * MediaSession conduit is identified by 2 main components
+ * 1. Attached Transport Interface for inbound and outbound RTP transport
+ * 2. Attached Renderer Interface for rendering media data off the network
+ * This class hides specifics of Media-Engine implementation from the consumers
+ * of this interface.
+ * Also provides codec configuration API for the media sent and recevied
+ */
+class MediaSessionConduit
+{
+public:
+  enum Type { AUDIO, VIDEO } ;
+
+  virtual ~MediaSessionConduit() {};
+
+  virtual Type type() const = 0;
+
+  /**
+   * Function triggered on Incoming RTP packet from the remote
+   * endpoint by the transport implementation.
+   * @param data : RTP Packet (audio/video) to be processed
+   * @param len  : Length of the media packet
+   * Obtained packets are passed to the Media-Engine for further
+   * processing , say, decoding
+   */
+  virtual MediaConduitErrorCode ReceivedRTPPacket(const void *data, int len) = 0;
+
+  /**
+   * Function triggered on Incoming RTCP packet from the remote
+   * endpoint by the transport implementation.
+   * @param data : RTCP Packet (audio/video) to be processed
+   * @param len  : Length of the media packet
+   * Obtained packets are passed to the Media-Engine for further
+   * processing , say, decoding
+   */
+  virtual MediaConduitErrorCode ReceivedRTCPPacket(const void *data, int len) = 0;
+
+
+  /**
+   * Function to attach Transport end-point of the Media conduit.
+   * @param aTransport: Reference to the concrete teansport implementation
+   * Note: Multiple invocations of this call , replaces existing transport with
+   * with the new one.
+   */
+  virtual MediaConduitErrorCode AttachTransport(RefPtr<TransportInterface> aTransport) = 0;
+
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaSessionConduit)
+
+};
+
+
+/**
+ * MediaSessionConduit for video
+ * Refer to the comments on MediaSessionConduit above for overall
+ * information
+ */
+class VideoSessionConduit : public MediaSessionConduit
+{
+public:
+  /**
+   * Factory function to create and initialize a Video Conduit Session
+   * return: Concrete VideoSessionConduitObject or NULL in the case
+   *         of failure
+   */
+  static RefPtr<VideoSessionConduit> Create();
+
+  virtual ~VideoSessionConduit() {};
+
+  virtual Type type() const { return VIDEO; }
+
+  /**
+   * Function to attach Renderer end-point of the Media-Video conduit.
+   * @param aRenderer : Reference to the concrete Video renderer implementation
+   * Note: Multiple invocations of this API shall remove an existing renderer
+   * and attaches the new to the Conduit.
+   */
+  virtual MediaConduitErrorCode AttachRenderer(RefPtr<VideoRenderer> aRenderer) = 0;
+
+  /**
+   * Function to deliver a capture video frame for encoding and transport
+   * @param video_frame: pointer to captured video-frame.
+   * @param video_frame_length: size of the frame
+   * @param width, height: dimensions of the frame
+   * @param video_type: Type of the video frame - I420, RAW
+   * @param captured_time: timestamp when the frame was captured.
+   *                       if 0 timestamp is automatcally generated
+   * NOTE: ConfigureSendMediaCodec() MUST be called before this function can be invoked
+   *       This ensures the inserted video-frames can be transmitted by the conduit
+   */
+  virtual MediaConduitErrorCode SendVideoFrame(unsigned char* video_frame,
+                                               unsigned int video_frame_length,
+                                               unsigned short width,
+                                               unsigned short height,
+                                               VideoType video_type,
+                                               uint64_t capture_time) = 0;
+
+  /**
+   * Function to configure send codec for the video session
+   * @param sendSessionConfig: CodecConfiguration
+   * @result: On Success, the video engine is configured with passed in codec for send
+   *          On failure, video engine transmit functionality is disabled.
+   * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
+   *        transmission sub-system on the engine
+   *
+   */
+  virtual MediaConduitErrorCode ConfigureSendMediaCodec(const VideoCodecConfig* sendSessionConfig) = 0;
+
+  /**
+   * Function to configurelist of receive codecs for the video session
+   * @param sendSessionConfig: CodecConfiguration
+   * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
+   *        reception sub-system on the engine
+   *
+   */
+  virtual MediaConduitErrorCode ConfigureRecvMediaCodecs(
+                                const std::vector<VideoCodecConfig* >& recvCodecConfigList) = 0;
+
+
+};
+
+/**
+ * MediaSessionConduit for audio
+ * Refer to the comments on MediaSessionConduit above for overall
+ * information
+ */
+class AudioSessionConduit : public MediaSessionConduit
+{
+public:
+
+   /**
+    * Factory function to create and initialize a Video Conduit Session
+    * return: Concrete VideoSessionConduitObject or NULL in the case
+    *         of failure
+    */
+  static mozilla::RefPtr<AudioSessionConduit> Create();
+
+  virtual ~AudioSessionConduit() {};
+
+  virtual Type type() const { return AUDIO; }
+
+
+  /**
+   * Function to deliver externally captured audio sample for encoding and transport
+   * @param audioData [in]: Pointer to array containing a frame of audio
+   * @param lengthSamples [in]: Length of audio frame in samples in multiple of 10 milliseconds
+  *                             Ex: Frame length is 160, 320, 440 for 16, 32, 44 kHz sampling rates
+                                    respectively.
+                                    audioData[] is lengthSamples in size
+                                    say, for 16kz sampling rate, audioData[] should contain 160
+                                    samples of 16-bits each for a 10m audio frame.
+   * @param samplingFreqHz [in]: Frequency/rate of the sampling in Hz ( 16000, 32000 ...)
+   * @param capture_delay [in]:  Approx Delay from recording until it is delivered to VoiceEngine
+                                 in milliseconds.
+   * NOTE: ConfigureSendMediaCodec() SHOULD be called before this function can be invoked
+   *       This ensures the inserted audio-samples can be transmitted by the conduit
+   *
+   */
+  virtual MediaConduitErrorCode SendAudioFrame(const int16_t audioData[],
+                                                int32_t lengthSamples,
+                                                int32_t samplingFreqHz,
+                                                int32_t capture_delay) = 0;
+
+  /**
+   * Function to grab a decoded audio-sample from the media engine for rendering
+   * / playoutof length 10 milliseconds.
+   *
+   * @param speechData [in]: Pointer to a array to which a 10ms frame of audio will be copied
+   * @param samplingFreqHz [in]: Frequency of the sampling for playback in Hertz (16000, 32000,..)
+   * @param capture_delay [in]: Estimated Time between reading of the samples to rendering/playback
+   * @param lengthSamples [out]: Will contain length of the audio frame in samples at return.
+                                 Ex: A value of 160 implies 160 samples each of 16-bits was copied
+                                     into speechData
+   * NOTE: This function should be invoked every 10 milliseconds for the best
+   *          peformance
+   * NOTE: ConfigureRecvMediaCodec() SHOULD be called before this function can be invoked
+   *       This ensures the decoded samples are ready for reading.
+   *
+   */
+  virtual MediaConduitErrorCode GetAudioFrame(int16_t speechData[],
+                                              int32_t samplingFreqHz,
+                                              int32_t capture_delay,
+                                              int& lengthSamples) = 0;
+
+   /**
+    * Function to configure send codec for the audio session
+    * @param sendSessionConfig: CodecConfiguration
+    * NOTE: See VideoConduit for more information
+    */
+
+  virtual MediaConduitErrorCode ConfigureSendMediaCodec(const AudioCodecConfig* sendCodecConfig) = 0;
+
+   /**
+    * Function to configure list of receive codecs for the audio session
+    * @param sendSessionConfig: CodecConfiguration
+    * NOTE: See VideoConduit for more information
+    */
+  virtual MediaConduitErrorCode ConfigureRecvMediaCodecs(
+                                const std::vector<AudioCodecConfig* >& recvCodecConfigList) = 0;
+
+};
+
+
+}
+
+#endif
+
+
+
+
+
+
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/MediaEngineWrapper.h
@@ -0,0 +1,37 @@
+/* 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/. */
+
+#ifndef  MEDIA_ENGINE_WRAPPER_H_
+#define MEDIA_ENGINE_WRAPPER_H_
+
+#include <mozilla/Scoped.h>
+
+
+
+namespace mozilla
+{
+/**
+ * A Custom scoped template to release a resoure of Type T
+ * with a function of Type F
+ * ScopedCustomReleasePtr<webrtc::VoENetwork> ptr =
+ *               webrtc::VoENetwork->GetInterface(voiceEngine);
+ *         
+ */
+template<typename T>
+struct ScopedCustomReleaseTraits0 : public ScopedFreePtrTraits<T>
+{
+  static void release(T* ptr)
+  {
+    if(ptr)
+    {
+      (ptr)->Release();
+    }
+  }
+};
+
+SCOPED_TEMPLATE(ScopedCustomReleasePtr, ScopedCustomReleaseTraits0)
+}//namespace
+
+
+#endif
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -0,0 +1,719 @@
+/* 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 "VideoConduit.h"
+#include "video_engine/include/vie_errors.h"
+#include "CSFLog.h"
+
+namespace mozilla {
+
+static const char* logTag ="WebrtcVideoSessionConduit";
+
+const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32;
+
+//Factory Implementation
+mozilla::RefPtr<VideoSessionConduit> VideoSessionConduit::Create()
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  WebrtcVideoConduit* obj = new WebrtcVideoConduit();
+  if(obj->Init() != kMediaConduitNoError)
+  {
+    CSFLogError(logTag,  "%s VideoConduit Init Failed ", __FUNCTION__);
+    delete obj;
+    return NULL;
+  }
+  CSFLogDebug(logTag,  "%s Successfully created VideoConduit ", __FUNCTION__);
+  return obj;
+}
+
+WebrtcVideoConduit::~WebrtcVideoConduit()
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  for(std::vector<VideoCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
+  {
+    delete mRecvCodecList[i];
+  }
+
+  delete mCurSendCodecConfig;
+
+  //Deal with External Capturer
+  if(mPtrViECapture)
+  {
+    mPtrViECapture->DisconnectCaptureDevice(mCapId);
+    mPtrViECapture->ReleaseCaptureDevice(mCapId);
+    mPtrExtCapture = NULL;
+    mPtrViECapture->Release();
+  }
+
+  //Deal with External Renderer
+  if(mPtrViERender)
+  {
+    mPtrViERender->StopRender(mChannel);
+    mPtrViERender->RemoveRenderer(mChannel);
+    mPtrViERender->Release();
+  }
+
+  //Deal with the transport
+  if(mPtrViENetwork)
+  {
+    mPtrViENetwork->DeregisterSendTransport(mChannel);
+    mPtrViENetwork->Release();
+  }
+
+  if(mPtrViECodec)
+  {
+    mPtrViECodec->Release();
+  }
+
+  if(mPtrViEBase)
+  {
+    mPtrViEBase->StopSend(mChannel);
+    mPtrViEBase->StopReceive(mChannel);
+    mPtrViEBase->DeleteChannel(mChannel);
+    mPtrViEBase->Release();
+  }
+
+  if(mVideoEngine)
+  {
+    webrtc::VideoEngine::Delete(mVideoEngine);
+  }
+}
+
+/**
+ * Peforms intialization of the MANDATORY components of the Video Engine
+ */
+MediaConduitErrorCode WebrtcVideoConduit::Init()
+{
+
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  if( !(mVideoEngine = webrtc::VideoEngine::Create()) )
+  {
+    CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
+     return kMediaConduitSessionNotInited;
+  }
+
+#if 0
+  // TRACING
+  mVideoEngine->SetTraceFilter(webrtc::kTraceAll);
+  mVideoEngine->SetTraceFile( "Vievideotrace.out" );
+#endif
+
+  if( !(mPtrViEBase = ViEBase::GetInterface(mVideoEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if( !(mPtrViECapture = ViECapture::GetInterface(mVideoEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if( !(mPtrViECodec = ViECodec::GetInterface(mVideoEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if( !(mPtrViENetwork = ViENetwork::GetInterface(mVideoEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  if( !(mPtrViERender = ViERender::GetInterface(mVideoEngine)))
+  {
+    CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+
+  CSFLogDebug(logTag, "%sEngine Created: Init'ng the interfaces ",__FUNCTION__);
+
+  if(mPtrViEBase->Init() == -1)
+  {
+    CSFLogError(logTag, " %s Video Engine Init Failed %d ",__FUNCTION__,
+                                               mPtrViEBase->LastError());
+    return kMediaConduitSessionNotInited;
+  }
+
+
+  if(mPtrViEBase->CreateChannel(mChannel) == -1)
+  {
+    CSFLogError(logTag, " %s Channel creation Failed %d ",__FUNCTION__,
+                                               mPtrViEBase->LastError());
+    return kMediaConduitChannelError;
+  }
+
+  if(mPtrViENetwork->RegisterSendTransport(mChannel, *this) == -1)
+  {
+    CSFLogError(logTag,  "%s ViENetwork Failed %d ", __FUNCTION__,
+                                          mPtrViEBase->LastError());
+    return kMediaConduitTransportRegistrationFail;
+  }
+
+
+  mPtrExtCapture = 0;
+
+  if(mPtrViECapture->AllocateExternalCaptureDevice(mCapId,
+                                                   mPtrExtCapture) == -1)
+  {
+    CSFLogError(logTag, "%s Unable to Allocate capture module: %d ",
+                               __FUNCTION__, mPtrViEBase->LastError());
+    return kMediaConduitCaptureError;
+  }
+
+  if(mPtrViECapture->ConnectCaptureDevice(mCapId,mChannel) == -1)
+  {
+    CSFLogError(logTag, "%s Unable to Connect capture module: %d ",
+                               __FUNCTION__,mPtrViEBase->LastError());
+    return kMediaConduitCaptureError;
+  }
+
+  if(mPtrViERender->AddRenderer(mChannel,
+                                webrtc::kVideoI420,
+                                (webrtc::ExternalRenderer*) this) == -1)
+  {
+    CSFLogError(logTag, "%s Failed to added external renderer ", __FUNCTION__);
+    return kMediaConduitInvalidRenderer;
+  }
+
+
+  CSFLogError(logTag, "Initialization Done");
+  return kMediaConduitNoError;
+}
+
+
+MediaConduitErrorCode
+WebrtcVideoConduit::AttachRenderer(mozilla::RefPtr<VideoRenderer> aVideoRenderer)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  //null renderer
+  if(!aVideoRenderer)
+  {
+    CSFLogError(logTag, "%s NULL Renderer", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitInvalidRenderer;
+  }
+  //Assign the new renderer - overwrites if there is already one
+  mRenderer = aVideoRenderer;
+
+  //Start Rendering if we haven't already
+  if(!mEngineRendererStarted)
+  {
+    if(mPtrViERender->StartRender(mChannel) == -1)
+    {
+      CSFLogError(logTag, "%s Starting the Renderer Failed %d ", __FUNCTION__,
+                                                      mPtrViEBase->LastError());
+      mRenderer = NULL;
+      return kMediaConduitRendererFail;
+    }
+    mEngineRendererStarted = true;
+  }
+
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcVideoConduit::AttachTransport(mozilla::RefPtr<TransportInterface> aTransport)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  if(!aTransport)
+  {
+    CSFLogError(logTag, "%s NULL Transport ", __FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitInvalidTransport;
+  }
+  //Assign the transport
+  mTransport = aTransport;
+  return kMediaConduitNoError;
+}
+
+/**
+ * Note: Setting the send-codec on the Video Engine will restart the encoder,
+ * sets up new SSRC and reset RTP_RTCP module with the new codec setting.
+ */
+MediaConduitErrorCode
+WebrtcVideoConduit::ConfigureSendMediaCodec(const VideoCodecConfig* codecConfig)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  bool codecFound = false;
+  MediaConduitErrorCode condError = kMediaConduitNoError;
+  int error = 0; //webrtc engine errors
+  webrtc::VideoCodec  video_codec;
+  std::string payloadName;
+
+  //validate basic params
+  if((condError = ValidateCodecConfig(codecConfig,true)) != kMediaConduitNoError)
+  {
+    return condError;
+  }
+
+  //Check if we have same codec already applied
+  if(CheckCodecsForMatch(mCurSendCodecConfig, codecConfig))
+  {
+    CSFLogDebug(logTag,  "%s Codec has been applied already ", __FUNCTION__);
+    return kMediaConduitCodecInUse;
+  }
+
+  //transmitting already ?
+  if(mEngineTransmitting)
+  {
+    CSFLogDebug(logTag, "%s Engine Already Sending. Attemping to Stop ", __FUNCTION__);
+    if(mPtrViEBase->StopSend(mChannel) == -1)
+    {
+      CSFLogError(logTag, "%s StopSend() Failed %d ",__FUNCTION__,
+                                                    mPtrViEBase->LastError());
+      return kMediaConduitUnknownError;
+    }
+  }
+
+  //reset the flag
+  mEngineTransmitting = false;
+
+  // we should be good here to set the new codec.
+  for(int idx=0; idx < mPtrViECodec->NumberOfCodecs(); idx++)
+  {
+    if(0 == mPtrViECodec->GetCodec(idx, video_codec))
+    {
+      payloadName = video_codec.plName;
+      if(codecConfig->mName.compare(payloadName) == 0)
+      {
+        CodecConfigToWebRTCCodec(codecConfig, video_codec);
+        codecFound = true;
+        break;
+      }
+    }
+  }//for
+
+  if(codecFound == false)
+  {
+    CSFLogError(logTag, "%s Codec Mismatch ", __FUNCTION__);
+    return kMediaConduitInvalidSendCodec;
+  }
+
+  if(mPtrViECodec->SetSendCodec(mChannel, video_codec) == -1)
+  {
+    error = mPtrViEBase->LastError();
+    if(error == kViECodecInvalidCodec)
+    {
+      CSFLogError(logTag, "%s Invalid Send Codec", __FUNCTION__);
+      return kMediaConduitInvalidSendCodec;
+    }
+    CSFLogError(logTag, "%s SetSendCodec Failed %d ", __FUNCTION__,
+                                         mPtrViEBase->LastError());
+    return kMediaConduitUnknownError;
+  }
+
+  if(mPtrViEBase->StartSend(mChannel) == -1)
+  {
+    CSFLogError(logTag, "%s Start Send Error %d ", __FUNCTION__,
+                                        mPtrViEBase->LastError());
+    return kMediaConduitUnknownError;
+  }
+
+  //Copy the applied codec for future reference
+  delete mCurSendCodecConfig;
+
+  mCurSendCodecConfig = new VideoCodecConfig(codecConfig->mType,
+                                              codecConfig->mName,
+                                              codecConfig->mWidth,
+                                              codecConfig->mHeight);
+
+  // by now we should be successfully started the transmission
+  mEngineTransmitting = true;
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcVideoConduit::ConfigureRecvMediaCodecs(
+                    const std::vector<VideoCodecConfig* >& codecConfigList)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+  MediaConduitErrorCode condError = kMediaConduitNoError;
+  int error = 0; //webrtc engine errors
+  bool success = false;
+  std::string  payloadName;
+
+  if(mEngineReceiving)
+  {
+    CSFLogDebug(logTag, "%s Engine Already Receiving . Attemping to Stop ", __FUNCTION__);
+    if(mPtrViEBase->StopReceive(mChannel) == -1)
+    {
+      error = mPtrViEBase->LastError();
+      if(error == kViEBaseUnknownError)
+      {
+        CSFLogDebug(logTag, "%s StopReceive() Success ", __FUNCTION__);
+        mEngineReceiving = false;
+      } else {
+        CSFLogError(logTag, "%s StopReceive() Failed %d ", __FUNCTION__,
+                                                mPtrViEBase->LastError());
+        return kMediaConduitUnknownError;
+      }
+    }
+  }
+
+  if(codecConfigList.empty())
+  {
+    CSFLogError(logTag, "%s Zero number of codecs to configure", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //Try Applying the codecs in the list
+  // we treat as success if atleast one codec was applied and reception was
+  // started successfully.
+  for(std::vector<VideoCodecConfig*>::size_type i=0;i < codecConfigList.size();i++)
+  {
+    //if the codec param is invalid or diplicate, return error
+    if((condError = ValidateCodecConfig(codecConfigList[i],false)) != kMediaConduitNoError)
+    {
+      return condError;
+    }
+
+    webrtc::VideoCodec  video_codec;
+    mEngineReceiving = false;
+    memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
+    //Retrieve pre-populated codec structure for our codec.
+    for(int idx=0; idx < mPtrViECodec->NumberOfCodecs(); idx++)
+    {
+      if(mPtrViECodec->GetCodec(idx, video_codec) == 0)
+      {
+        payloadName = video_codec.plName;
+        if(codecConfigList[i]->mName.compare(payloadName) == 0)
+        {
+          CodecConfigToWebRTCCodec(codecConfigList[i], video_codec);
+          if(mPtrViECodec->SetReceiveCodec(mChannel,video_codec) == -1)
+          {
+            CSFLogError(logTag, "%s Invalid Receive Codec %d ", __FUNCTION__,
+                                                    mPtrViEBase->LastError());
+          } else {
+            CSFLogError(logTag, "%s Successfully Set the codec %s", __FUNCTION__,
+                                              codecConfigList[i]->mName.c_str());
+            if(CopyCodecToDB(codecConfigList[i]))
+            {
+              success = true;
+            } else {
+              CSFLogError(logTag,"%s Unable to updated Codec Database", __FUNCTION__);
+              return kMediaConduitUnknownError;
+            }
+          }
+          break; //we found a match
+        }
+      }
+    }//end for codeclist
+
+  }//end for
+
+  if(!success)
+  {
+    CSFLogError(logTag, "%s Setting Receive Codec Failed ", __FUNCTION__);
+    return kMediaConduitInvalidReceiveCodec;
+  }
+
+  //Start Receive on the video engine
+  if(mPtrViEBase->StartReceive(mChannel) == -1)
+  {
+    error = mPtrViEBase->LastError();
+    CSFLogError(logTag, "%s Start Receive Error %d ", __FUNCTION__, error);
+
+    return kMediaConduitUnknownError;
+  }
+
+  // by now we should be successfully started the reception
+  mEngineReceiving = true;
+  DumpCodecDB();
+  return kMediaConduitNoError;
+}
+
+
+MediaConduitErrorCode
+WebrtcVideoConduit::SendVideoFrame(unsigned char* video_frame,
+                                   unsigned int video_frame_length,
+                                   unsigned short width,
+                                   unsigned short height,
+                                   VideoType video_type,
+                                   uint64_t capture_time)
+{
+
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  //check for  the parameters sanity
+  if(!video_frame || video_frame_length == 0 ||
+                     width == 0 || height == 0)
+  {
+    CSFLogError(logTag,  "%s Invalid Parameters ",__FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+
+  if(video_type != kVideoI420)
+  {
+    CSFLogError(logTag,  "%s VideoType Invalid. Only 1420 Supported",__FUNCTION__);
+    MOZ_ASSERT(PR_FALSE);
+    return kMediaConduitMalformedArgument;
+  }
+  //Transmission should be enabled before we insert any frames.
+  if(!mEngineTransmitting)
+  {
+    CSFLogError(logTag, "%s Engine not transmitting ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  //insert the frame to video engine in I420 format only
+  if(mPtrExtCapture->IncomingFrame(video_frame,
+                                   video_frame_length,
+                                   width, height,
+                                   webrtc::kVideoI420,
+                                   (unsigned long long)capture_time) == -1)
+  {
+    CSFLogError(logTag,  "%s IncomingFrame Failed %d ", __FUNCTION__,
+                                            mPtrViEBase->LastError());
+    return kMediaConduitCaptureError;
+  }
+
+  CSFLogError(logTag, "%s Inserted A Frame", __FUNCTION__);
+  return kMediaConduitNoError;
+}
+
+// Transport Layer Callbacks
+MediaConduitErrorCode
+WebrtcVideoConduit::ReceivedRTPPacket(const void *data, int len)
+{
+  CSFLogError(logTag, "%s: Channel %d, Len %d ", __FUNCTION__, mChannel, len);
+
+  // Media Engine should be receiving already.
+  if(mEngineReceiving)
+  {
+    // let the engine know of a RTP packet to decode
+    if(mPtrViENetwork->ReceivedRTPPacket(mChannel,data,len) == -1)
+    {
+      int error = mPtrViEBase->LastError();
+      CSFLogError(logTag, "%s RTP Processing Failed %d ", __FUNCTION__, error);
+      if(error >= kViERtpRtcpInvalidChannelId && error <= kViERtpRtcpRtcpDisabled)
+      {
+        return kMediaConduitRTPProcessingFailed;
+      }
+      return kMediaConduitRTPRTCPModuleError;
+    }
+  } else {
+    CSFLogError(logTag, "%s Engine Error: Not Receiving !!! ", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+
+  return kMediaConduitNoError;
+}
+
+MediaConduitErrorCode
+WebrtcVideoConduit::ReceivedRTCPPacket(const void *data, int len)
+{
+  CSFLogError(logTag, " %s Channel %d, Len %d ", __FUNCTION__, mChannel, len);
+
+  //Media Engine should be receiving already
+  if(mEngineReceiving)
+  {
+    //let the engine know of RTCP packet to decode.
+    if(mPtrViENetwork->ReceivedRTCPPacket(mChannel,data,len) == -1)
+    {
+      int error = mPtrViEBase->LastError();
+      CSFLogError(logTag, "%s RTP Processing Failed %d", __FUNCTION__, error);
+      if(error >= kViERtpRtcpInvalidChannelId && error <= kViERtpRtcpRtcpDisabled)
+      {
+        return kMediaConduitRTPProcessingFailed;
+      }
+      return kMediaConduitRTPRTCPModuleError;
+    }
+  } else {
+    CSFLogError(logTag, "%s: Engine Error: Not Receiving", __FUNCTION__);
+    return kMediaConduitSessionNotInited;
+  }
+  return kMediaConduitNoError;
+}
+
+//WebRTC::RTP Callback Implementation
+int WebrtcVideoConduit::SendPacket(int channel, const void* data, int len)
+{
+  CSFLogError(logTag, "%s Channel %d, len %d ", __FUNCTION__, channel, len);
+
+  if(mTransport && (mTransport->SendRtpPacket(data, len) == NS_OK))
+  {
+    CSFLogDebug(logTag, "%s Sent RTP Packet ", __FUNCTION__);
+    return 0;
+  } else {
+    CSFLogError(logTag, "%s  Failed", __FUNCTION__);
+    return -1;
+  }
+}
+
+int WebrtcVideoConduit::SendRTCPPacket(int channel, const void* data, int len)
+{
+  CSFLogError(logTag,  "%s : channel %d , len %d ", __FUNCTION__, channel,len);
+
+  if(mTransport && (mTransport->SendRtcpPacket(data, len) == NS_OK))
+   {
+      CSFLogDebug(logTag, "%s Sent RTCP Packet ", __FUNCTION__);
+      return 0;
+   } else {
+      CSFLogError(logTag, "%s Failed", __FUNCTION__);
+      return -1;
+   }
+}
+
+// WebRTC::ExternalMedia Implementation
+int
+WebrtcVideoConduit::FrameSizeChange(unsigned int width,
+                                    unsigned int height,
+                                    unsigned int numStreams)
+{
+  CSFLogDebug(logTag,  "%s ", __FUNCTION__);
+
+  if(mRenderer)
+  {
+    mRenderer->FrameSizeChange(width, height, numStreams);
+    return 0;
+  }
+
+  CSFLogError(logTag,  "%s Renderer is NULL ", __FUNCTION__);
+  return -1;
+}
+
+int
+WebrtcVideoConduit::DeliverFrame(unsigned char* buffer,
+                                 int buffer_size,
+                                 uint32_t time_stamp,
+                                 int64_t render_time)
+{
+  CSFLogDebug(logTag,  "%s Buffer Size %d", __FUNCTION__, buffer_size);
+
+  if(mRenderer)
+  {
+    mRenderer->RenderVideoFrame(buffer, buffer_size, time_stamp, render_time);
+    return 0;
+  }
+
+  CSFLogError(logTag,  "%s Renderer is NULL  ", __FUNCTION__);
+  return -1;
+}
+
+/**
+ * Copy the codec passed into Conduit's database
+ */
+
+void
+WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
+                                              webrtc::VideoCodec& cinst)
+{
+  cinst.plType  = codecInfo->mType;
+  cinst.width   = codecInfo->mWidth;
+  cinst.height  = codecInfo->mHeight;
+}
+
+bool
+WebrtcVideoConduit::CopyCodecToDB(const VideoCodecConfig* codecInfo)
+{
+  VideoCodecConfig* cdcConfig = new VideoCodecConfig(codecInfo->mType,
+                                                     codecInfo->mName,
+                                                     codecInfo->mWidth,
+                                                     codecInfo->mHeight);
+  mRecvCodecList.push_back(cdcConfig);
+  return true;
+}
+
+/**
+ * Checks if the codec is already in Conduit's database
+ */
+
+bool
+WebrtcVideoConduit::CheckCodecForMatch(const VideoCodecConfig* codecInfo) const
+{
+  //the db should have atleast one codec
+  for(std::vector<VideoCodecConfig*>::size_type i=0;i < mRecvCodecList.size();i++)
+  {
+    if(CheckCodecsForMatch(mRecvCodecList[i],codecInfo))
+    {
+      //match
+      return true;
+    }
+  }
+  //no match
+  return false;
+}
+
+bool
+WebrtcVideoConduit::CheckCodecsForMatch(const VideoCodecConfig* curCodecConfig,
+                                        const VideoCodecConfig* codecInfo) const
+{
+  if(!curCodecConfig)
+  {
+    return false;
+  }
+
+  if(curCodecConfig->mType   == codecInfo->mType &&
+    (curCodecConfig->mName.compare(codecInfo->mName) == 0) &&
+    curCodecConfig->mWidth  == codecInfo->mWidth &&
+    curCodecConfig->mHeight == codecInfo->mHeight)
+  {
+    return true;
+  }
+
+  return false;
+}
+
+/**
+ * Perform validation on the codecConfig to be applied
+ * Verifies if the codec is already applied.
+ */
+
+MediaConduitErrorCode
+WebrtcVideoConduit::ValidateCodecConfig(const VideoCodecConfig* codecInfo,
+                                         bool send) const
+{
+  bool codecAppliedAlready = false;
+  if(!codecInfo)
+  {
+    CSFLogError(logTag, "%s Null CodecConfig ", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  if((codecInfo->mName.empty()) ||
+     (codecInfo->mName.length() >= CODEC_PLNAME_SIZE))
+  {
+    CSFLogError(logTag, "%s Invalid Payload Name Length ", __FUNCTION__);
+    return kMediaConduitMalformedArgument;
+  }
+
+  //check if we have the same codec already applied
+  if(send)
+  {
+    codecAppliedAlready = CheckCodecsForMatch(mCurSendCodecConfig,codecInfo);
+  } else {
+    codecAppliedAlready = CheckCodecForMatch(codecInfo);
+  }
+
+  if(codecAppliedAlready)
+  {
+    CSFLogDebug(logTag, "%s Codec %s Already Applied  ", __FUNCTION__, codecInfo->mName.c_str());
+    return kMediaConduitCodecInUse;
+  }
+  return kMediaConduitNoError;
+}
+
+void
+WebrtcVideoConduit::DumpCodecDB() const
+{
+  for(std::vector<VideoCodecConfig*>::size_type i=0;i<mRecvCodecList.size();i++)
+  {
+    CSFLogDebug(logTag,"Payload Name: %s", mRecvCodecList[i]->mName.c_str());
+    CSFLogDebug(logTag,"Payload Type: %d", mRecvCodecList[i]->mType);
+    CSFLogDebug(logTag,"Payload Width: %d", mRecvCodecList[i]->mWidth);
+    CSFLogDebug(logTag,"Payload Height: %d", mRecvCodecList[i]->mHeight);
+  }
+}
+
+}// end namespace
+
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
@@ -0,0 +1,214 @@
+/* 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/. */
+
+#ifndef VIDEO_SESSION_H_
+#define VIDEO_SESSION_H_
+
+#include "mozilla/Attributes.h"
+
+#include "MediaConduitInterface.h"
+
+// Video Engine Includes
+#include "common_types.h"
+#include "video_engine/include/vie_base.h"
+#include "video_engine/include/vie_capture.h"
+#include "video_engine/include/vie_codec.h"
+#include "video_engine/include/vie_render.h"
+#include "video_engine/include/vie_network.h"
+#include "video_engine/include/vie_file.h"
+
+/** This file hosts several structures identifying different aspects
+ * of a RTP Session.
+ */
+
+ using  webrtc::ViEBase;
+ using  webrtc::ViENetwork;
+ using  webrtc::ViECodec;
+ using  webrtc::ViECapture;
+ using  webrtc::ViERender;
+ using  webrtc::ViEExternalCapture;
+
+
+namespace mozilla {
+
+/**
+ * Concrete class for Video session. Hooks up
+ *  - media-source and target to external transport
+ */
+class WebrtcVideoConduit:public VideoSessionConduit
+                         ,public webrtc::Transport
+                         ,public webrtc::ExternalRenderer
+{
+
+public:
+
+  //VoiceEngine defined constant for Payload Name Size.
+  static const unsigned int CODEC_PLNAME_SIZE;
+
+  /**
+   * Function to attach Renderer end-point for the Media-Video conduit.
+   * @param aRenderer : Reference to the concrete Video renderer implementation
+   * Note: Multiple invocations of this API shall remove an existing renderer
+   * and attaches the new to the Conduit.
+   */
+   MediaConduitErrorCode AttachRenderer(mozilla::RefPtr<VideoRenderer> aVideoRenderer);
+
+  /**
+   * APIs used by the registered external transport to this Conduit to
+   * feed in received RTP Frames to the VideoEngine for decoding
+   */
+  virtual MediaConduitErrorCode ReceivedRTPPacket(const void *data, int len);
+
+  /**
+   * APIs used by the registered external transport to this Conduit to
+   * feed in received RTP Frames to the VideoEngine for decoding
+   */
+  virtual MediaConduitErrorCode ReceivedRTCPPacket(const void *data, int len);
+
+   /**
+   * Function to configure send codec for the video session
+   * @param sendSessionConfig: CodecConfiguration
+   * @result: On Success, the video engine is configured with passed in codec for send
+   *          On failure, video engine transmit functionality is disabled.
+   * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
+   *        transmission sub-system on the engine.
+   */
+  virtual MediaConduitErrorCode ConfigureSendMediaCodec(const VideoCodecConfig* codecInfo);
+
+  /**
+   * Function to configure list of receive codecs for the video session
+   * @param sendSessionConfig: CodecConfiguration
+   * @result: On Success, the video engine is configured with passed in codec for send
+   *          Also the playout is enabled.
+   *          On failure, video engine transmit functionality is disabled.
+   * NOTE: This API can be invoked multiple time. Invoking this API may involve restarting
+   *        transmission sub-system on the engine.
+   */
+   virtual MediaConduitErrorCode ConfigureRecvMediaCodecs(
+                               const std::vector<VideoCodecConfig* >& codecConfigList);
+
+  /**
+   * Register External Transport to this Conduit. RTP and RTCP frames from the VoiceEnigne
+   * shall be passed to the registered transport for transporting externally.
+   */
+  virtual MediaConduitErrorCode AttachTransport(mozilla::RefPtr<TransportInterface> aTransport);
+
+  /**
+   * Function to deliver a capture video frame for encoding and transport
+   * @param video_frame: pointer to captured video-frame.
+   * @param video_frame_length: size of the frame
+   * @param width, height: dimensions of the frame
+   * @param video_type: Type of the video frame - I420, RAW
+   * @param captured_time: timestamp when the frame was captured.
+   *                       if 0 timestamp is automatcally generated by the engine.
+   *NOTE: ConfigureSendMediaCodec() SHOULD be called before this function can be invoked
+   *       This ensures the inserted video-frames can be transmitted by the conduit
+   */
+  virtual MediaConduitErrorCode SendVideoFrame(unsigned char* video_frame,
+                                                unsigned int video_frame_length,
+                                                unsigned short width,
+                                                unsigned short height,
+                                                VideoType video_type,
+                                                uint64_t capture_time);
+
+
+
+  /**
+   * Webrtc transport implementation to send and receive RTP packet.
+   * AudioConduit registers itself as ExternalTransport to the VideoEngine
+   */
+  virtual int SendPacket(int channel, const void *data, int len) ;
+
+  /**
+   * Webrtc transport implementation to send and receive RTCP packet.
+   * AudioConduit registers itself as ExternalTransport to the VideoEngine
+   */
+  virtual int SendRTCPPacket(int channel, const void *data, int len) ;
+
+
+  /**
+   * Webrtc External Renderer Implementation APIs.
+   * Raw I420 Frames are delivred to the VideoConduit by the VideoEngine
+   */
+  virtual int FrameSizeChange(unsigned int, unsigned int, unsigned int);
+
+  virtual int DeliverFrame(unsigned char*,int, uint32_t , int64_t);
+
+
+  WebrtcVideoConduit():
+                      mVideoEngine(NULL),
+                      mTransport(NULL),
+                      mRenderer(NULL),
+                      mEngineTransmitting(false),
+                      mEngineReceiving(false),
+                      mEngineRendererStarted(false),
+                      mChannel(-1),
+                      mCapId(-1),
+                      mCurSendCodecConfig(NULL)
+
+  {
+  }
+
+
+  virtual ~WebrtcVideoConduit() ;
+
+
+
+  MediaConduitErrorCode Init();
+
+private:
+
+  WebrtcVideoConduit(const WebrtcVideoConduit& other) MOZ_DELETE;
+  void operator=(const WebrtcVideoConduit& other) MOZ_DELETE;
+
+  //Local database of currently applied receive codecs
+  typedef std::vector<VideoCodecConfig* > RecvCodecList;
+
+  //Function to convert between WebRTC and Conduit codec structures
+  void CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
+                                webrtc::VideoCodec& cinst);
+
+  // Function to copy a codec structure to Conduit's database
+  bool CopyCodecToDB(const VideoCodecConfig* codecInfo);
+
+  // Functions to verify if the codec passed is already in
+  // conduits database
+  bool CheckCodecForMatch(const VideoCodecConfig* codecInfo) const;
+  bool CheckCodecsForMatch(const VideoCodecConfig* curCodecConfig,
+                           const VideoCodecConfig* codecInfo) const;
+
+  //Checks the codec to be applied
+  MediaConduitErrorCode ValidateCodecConfig(const VideoCodecConfig* codecInfo, bool send) const;
+
+  //Utility function to dump recv codec database
+  void DumpCodecDB() const;
+
+  webrtc::VideoEngine* mVideoEngine;
+
+  mozilla::RefPtr<TransportInterface> mTransport;
+  mozilla::RefPtr<VideoRenderer> mRenderer;
+
+  webrtc::ViEBase* mPtrViEBase;
+  webrtc::ViECapture* mPtrViECapture;
+  webrtc::ViECodec* mPtrViECodec;
+  webrtc::ViENetwork* mPtrViENetwork;
+  webrtc::ViERender* mPtrViERender;
+  webrtc::ViEExternalCapture*  mPtrExtCapture;
+
+  // Engine state we are concerned with.
+  bool mEngineTransmitting; //If true ==> Transmit Sub-system is up and running
+  bool mEngineReceiving;    // if true ==> Receive Sus-sysmtem up and running
+  bool mEngineRendererStarted; // If true ==> Rendering Sub-system is up and running
+
+  int mChannel; // Video Channel for this conduit
+  int mCapId;   // Capturer for this conduit
+  RecvCodecList    mRecvCodecList;
+  VideoCodecConfig* mCurSendCodecConfig;
+};
+
+
+
+} // end namespace
+
+#endif
new file mode 100755
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/VideoTypes.h
@@ -0,0 +1,47 @@
+/* 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/. */
+
+// These constants are picked from WebRTC Implementation. Copyright from the same is
+// given below
+
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef VIDEO_TYPE_
+#define VIDEO_TYPE_
+
+namespace mozilla
+{
+/*
+ * Enumeration for different video types supported by the
+ * video-engine. If more types will be supported in the future
+ * newer one shall be appended to the bottom of the list
+ */
+enum VideoType
+{
+    kVideoI420     = 0,
+    kVideoYV12     = 1,
+    kVideoYUY2     = 2,
+    kVideoUYVY     = 3,
+    kVideoIYUV     = 4,
+    kVideoARGB     = 5,
+    kVideoRGB24    = 6,
+    kVideoRGB565   = 7,
+    kVideoARGB4444 = 8,
+    kVideoARGB1555 = 9,
+    kVideoMJPEG    = 10,
+    kVideoNV12     = 11,
+    kVideoNV21     = 12,
+    kVideoBGRA     = 13,
+    kVideoUnknown  = 99
+};
+}
+#endif
--- a/media/webrtc/signaling/src/media/CSFAudioTermination.h
+++ b/media/webrtc/signaling/src/media/CSFAudioTermination.h
@@ -111,17 +111,18 @@ typedef enum
     AudioPayloadType_G711ULAW64K =  4,
     AudioPayloadType_G711ULAW56K =  5,
     AudioPayloadType_G722_64K = 6,
     AudioPayloadType_G722_56K = 7,
     AudioPayloadType_G722_48K = 8,
     AudioPayloadType_RFC2833 = 38,
     AudioPayloadType_ILBC20 = 39,
     AudioPayloadType_ILBC30 = 40,
-    AudioPayloadType_ISAC = 41
+    AudioPayloadType_ISAC = 41,
+    AudioPayloadType_OPUS = 109
 
 } AudioPayloadType;
 
 #if __cplusplus
 
 namespace CSF
 {
     //AudioTermination adds to the core MediaTermination
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -39,21 +39,35 @@
 
 #include "CC_Common.h"
 
 #include "CSFLogStream.h"
 
 #include "CSFMediaProvider.h"
 #include "CSFAudioTermination.h"
 #include "CSFVideoTermination.h"
+#include "MediaConduitErrors.h"
+#include "MediaConduitInterface.h"
+#include "MediaPipeline.h"
 #include "VcmSIPCCBinding.h"
 #include "csf_common.h"
+#include "PeerConnectionImpl.h"
+#include "nsThreadUtils.h"
+#include "transportflow.h"
+#include "transportlayer.h"
+#include "transportlayerdtls.h"
+#include "transportlayerice.h"
+#include "runnable_utils.h"
+#include "cpr_stdlib.h"
+#include "cpr_string.h"
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <ssl.h>
+#include <sslproto.h>
 
 extern "C" {
 #include "ccsdp.h"
 #include "vcm.h"
 #include "cip_mmgr_mediadefinitions.h"
 #include "cip_Sipcc_CodecMask.h"
 
 extern void lsm_start_multipart_tone_timer (vcm_tones_t tone,
@@ -77,34 +91,48 @@ typedef enum {
 
 #define SIPSDP_ILBC_MODE20 20
 
 /* static */
 
 using namespace CSF;
 
 VcmSIPCCBinding * VcmSIPCCBinding::_pSelf = NULL;
-
+int VcmSIPCCBinding::mAudioCodecMask = 0;
+int VcmSIPCCBinding::mVideoCodecMask = 0;
 
-// The media provider passsed in here will be owned by VcmSIPCCBinding, and so it destroys
-// it later.
-VcmSIPCCBinding::VcmSIPCCBinding (MediaProvider *mp)
-  : pMediaProvider(mp),
-    streamObserver(NULL)
+/**
+ * Convert a combined payload type value to a config value
+ * 
+ * @param [in] payload - the combined payload type integer
+ * @param [out] config - the returned config value
+ *
+ * return int
+ */
+static int vcmPayloadType2AudioCodec(vcm_media_payload_type_t payload,
+                                     mozilla::AudioCodecConfig **config);
+
+static int vcmPayloadType2VideoCodec(vcm_media_payload_type_t payload,
+                                     mozilla::VideoCodecConfig **config);
+static mozilla::RefPtr<TransportFlow> vcmCreateTransportFlow(sipcc::PeerConnectionImpl *pc,
+                                                             int level, bool rtcp,
+                                                             const char *fingerprint_alg,
+                                                             const char *fingerprint
+                                                             );
+
+VcmSIPCCBinding::VcmSIPCCBinding ()
+  : streamObserver(NULL)
 {
     delete _pSelf;//delete is NULL safe, so I don't need to check if it's NULL
     _pSelf = this;
 }
 
 VcmSIPCCBinding::~VcmSIPCCBinding ()
 {
     assert(_pSelf != NULL);
-    pMediaProvider->shutdown();
-    delete pMediaProvider;
-    pMediaProvider = NULL;
     _pSelf = NULL;
 }
 
 void VcmSIPCCBinding::setStreamObserver(StreamObserver* obs)
 {
 	streamObserver = obs;
 }
 
@@ -126,59 +154,65 @@ void VcmSIPCCBinding::setMediaProviderOb
 MediaProviderObserver * VcmSIPCCBinding::getMediaProviderObserver()
 {
     if (_pSelf != NULL)
     	return _pSelf->mediaProviderObserver;
 
     return NULL;
 }
 
+void VcmSIPCCBinding::setAudioCodecs(int codecMask)
+{
+  CSFLogDebugS(logTag, "SETTING AUDIO: " << codecMask);
+  VcmSIPCCBinding::mAudioCodecMask = codecMask;
+}
+
+void VcmSIPCCBinding::setVideoCodecs(int codecMask)
+{
+  CSFLogDebugS(logTag, "SETTING VIDEO: " << codecMask);
+  VcmSIPCCBinding::mVideoCodecMask = codecMask;
+}
+
+int VcmSIPCCBinding::getAudioCodecs()
+{
+  return VcmSIPCCBinding::mAudioCodecMask;
+}
+
+int VcmSIPCCBinding::getVideoCodecs()
+{
+  return VcmSIPCCBinding::mVideoCodecMask;
+}
+
 
 /* static */
 AudioTermination * VcmSIPCCBinding::getAudioTermination()
 {
-    if ((_pSelf == NULL) || (_pSelf->pMediaProvider == NULL))
-    {
-        return NULL;
-    }
-
-    return _pSelf->pMediaProvider->getAudioTermination();
+    // commenting as part of media provider removal
+    return NULL;
 }
 
 /* static */
 VideoTermination * VcmSIPCCBinding::getVideoTermination()
 {
-    if ((_pSelf == NULL) || (_pSelf->pMediaProvider == NULL))
-    {
-        return NULL;
-    }
-
-    return _pSelf->pMediaProvider->getVideoTermination();
+    // commenting as part of media provider removal
+    return NULL;
 }
 
 /* static */
 AudioControl * VcmSIPCCBinding::getAudioControl()
 {
-    if ((_pSelf == NULL) || (_pSelf->pMediaProvider == NULL))
-    {
-        return NULL;
-    }
-
-    return _pSelf->pMediaProvider->getAudioControl();
+    // commenting as part of media provider removal
+    return NULL;
 }
 
 /* static */
 VideoControl * VcmSIPCCBinding::getVideoControl()
 {
-    if ((_pSelf == NULL) || (_pSelf->pMediaProvider == NULL))
-    {
-        return NULL;
-    }
-
-    return _pSelf->pMediaProvider->getVideoControl();
+    // commenting as part of media provider removal
+    return NULL;
 }
 
 /*
  * Used to play busy verfication tone
  */
 #define BUSY_VERIFICATION_DELAY       (10000)
 
 /*
@@ -234,16 +268,17 @@ struct h264_video
     int        max_mbps;
     int        max_fs;
     int        max_cpb;
     int        max_dpb;
     int        max_br;
     int        tias_bw;
 };
 
+#if 0
 static RingMode
 map_ring_mode (vcm_ring_mode_t mode)
 {
     switch ( mode )
     {
     case VCM_INSIDE_RING:
         return RingMode_INSIDE_RING;
     case VCM_OUTSIDE_RING:
@@ -264,16 +299,17 @@ map_ring_mode (vcm_ring_mode_t mode)
         return RingMode_FLASHONLY_RING;
     case VCM_STATION_PRECEDENCE_RING:
         return RingMode_PRECEDENCE_RING;
     default:
         CSFLogDebugS( logTag, "map_ring_mode(): Wrong ringmode passed");
         return RingMode_INSIDE_RING;
     }
 }
+#endif
 
 /**
  *  start/stop ringing
  *
  *  @param[in] ringMode   - VCM ring mode (ON/OFF)
  *  @param[in] once       - type of ring - continuous or one shot.
  *  @param[in] alert_info - header specified ring mode.
  *  @param[in] line       - the line on which to start/stop ringing
@@ -287,28 +323,32 @@ void vcmControlRinger (vcm_ring_mode_t r
                        int line,
                        cc_callid_t call_id)
 {
     const char fname[] = "vcmControlRinger";
 
     CSFLogDebug( logTag, "%s: ringMode=%d once=%d", fname, ringMode, once);
 
     /* we need to pass the line parameter for this */
+
+#if 0
+     // <emannion> part of media provider removal
     if ( ringMode == VCM_RING_OFF )
     {
         //call media_ring_stop
         if ( VcmSIPCCBinding::getAudioTermination()->ringStop( line ) != 0 )
         {
             CSFLogDebug( logTag, "%s: mediaRingStop failed", fname);
         }
     }
     else if ( VcmSIPCCBinding::getAudioTermination()->ringStart( line, map_ring_mode(ringMode), (once != 0) ) != 0 )
     {
         CSFLogDebug( logTag, "%s: mediaRingStart failed", fname);
     }
+#endif
 }
 
 /**
  *  To be Deprecated
  *  This may be needed to be implemented if the DSP doesn't automatically enable the side tone
  *  The stack will make a call to this method based on the call state. Provide a stub if this is not needed.
  *
  *  @param[in] side_tone - cc_boolean to enable/disable side tone
@@ -372,16 +412,18 @@ map_VCM_Media_Payload_type( vcm_media_pa
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_Wide_Band_256k,         cip_mmgr_MediaDefinitions_MEDIA_TYPE_WIDE_BAND_256K);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_Data64,                 cip_mmgr_MediaDefinitions_MEDIA_TYPE_DATA64);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_Data56,                 cip_mmgr_MediaDefinitions_MEDIA_TYPE_DATA56);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_GSM,             cip_mmgr_MediaDefinitions_MEDIA_TYPE_GSM);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_ActiveVoice,             cip_mmgr_MediaDefinitions_MEDIA_TYPE_ACTIVEVOICE);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_G726_32K,             cip_mmgr_MediaDefinitions_MEDIA_TYPE_G726_32K);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_G726_24K,             cip_mmgr_MediaDefinitions_MEDIA_TYPE_G726_24K);
         MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_G726_16K,             cip_mmgr_MediaDefinitions_MEDIA_TYPE_G726_16K);
+        MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_VP8,                  cip_mmgr_MediaDefinitions_MEDIA_TYPE_VP8);
+        MAKE_VCM_MEDIA_PAYLOAD_MAP_ENTRY(VCM_Media_Payload_OPUS,                 cip_mmgr_MediaDefinitions_MEDIA_TYPE_OPUS);
 
         mappingInitialised = true;
     }
 
     int vcmIndex = payload & 0XFFFF;
 
     switch (vcmIndex)
     {
@@ -390,16 +432,18 @@ map_VCM_Media_Payload_type( vcm_media_pa
     case VCM_Media_Payload_ILBC30:
         return ((payload & 0XFFFF0000) | cip_mmgr_MediaDefinitions_MEDIA_TYPE_ILBC30);
     case VCM_Media_Payload_H263:
         return ((payload & 0XFFFF0000) | cip_mmgr_MediaDefinitions_MEDIA_TYPE_H263);
     case VCM_Media_Payload_H264:
         return ((payload & 0XFFFF0000) | RTP_H264_P0);
     case VCM_Media_Payload_ISAC:
         return ((payload & 0XFFFF0000) | cip_mmgr_MediaDefinitions_MEDIA_TYPE_ISAC);
+    case VCM_Media_Payload_VP8:
+        return ((payload & 0XFFFF0000) | cip_mmgr_MediaDefinitions_MEDIA_TYPE_VP8);
     default:
         //use the static array
         if (vcmIndex < VCM_Media_Payload_Max)
         {
             return vcmToCIP_Mappings[vcmIndex];
         }
 
         return cip_mmgr_MediaDefinitions_MEDIA_TYPE_NONSTANDARD;
@@ -471,39 +515,493 @@ void vcmRxAllocPort(cc_mcapid_t mcap_id,
                     cc_streamid_t stream_id,
                     cc_call_handle_t  call_handle,
                     cc_uint16_t port_requested,
                     int *port_allocated)
 {
     CSFLogDebug( logTag, "vcmRxAllocPort(): group_id=%d stream_id=%d call_handle=%d port_requested = %d",
         group_id, stream_id, call_handle, port_requested);
 
+    // Not in SDP/PeerConnection mode
     int port = -1;
     bool isVideo = false;
     if(CC_IS_AUDIO(mcap_id))
     {
-    	isVideo = false;
-        if ( VcmSIPCCBinding::getAudioTermination() != NULL )
-            port = VcmSIPCCBinding::getAudioTermination()->rxAlloc( group_id, stream_id, port_requested );
+      isVideo = false;
+      if ( VcmSIPCCBinding::getAudioTermination() != NULL )
+        port = VcmSIPCCBinding::getAudioTermination()->rxAlloc( group_id, stream_id, port_requested );
     }
-	else if(CC_IS_VIDEO(mcap_id))
-	{
-		isVideo = true;
-        if ( VcmSIPCCBinding::getVideoTermination() != NULL )
-            port = VcmSIPCCBinding::getVideoTermination()->rxAlloc( group_id, stream_id, port_requested );
+    else if(CC_IS_VIDEO(mcap_id))
+    {
+      isVideo = true;
+      if ( VcmSIPCCBinding::getVideoTermination() != NULL )
+        port = VcmSIPCCBinding::getVideoTermination()->rxAlloc( group_id, stream_id, port_requested );
     }
 
     StreamObserver* obs = VcmSIPCCBinding::getStreamObserver();
     if(obs != NULL)
-    	obs->registerStream(call_handle, stream_id, isVideo);
+      obs->registerStream(call_handle, stream_id, isVideo);
 
     CSFLogDebug( logTag, "vcmRxAllocPort(): allocated port %d", port);
     *port_allocated = port;
 }
 
+
+/**
+ *  Gets the ICE parameters for a stream. Called "alloc" for style consistency
+ *
+ *  @param[in]  mcap_id - Media Capability ID
+ *  @param[in]  group_id - group identifier to which stream belongs.
+ *  @param[in]  stream_id - stream identifier
+ *  @param[in]  call_handle  - call identifier
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[out] default_addrp - the ICE default addr
+ *  @param[out] port_allocatedp - the ICE default port
+ *  @param[out] candidatesp - the ICE candidate array
+ *  @param[out] candidate_ctp length of the array 
+ *
+ *  @return    void
+ *
+ */
+void vcmRxAllocICE(cc_mcapid_t mcap_id,
+        cc_groupid_t group_id,
+        cc_streamid_t stream_id,
+        cc_call_handle_t  call_handle,
+        const char *peerconnection,
+        uint16_t level,
+        char **default_addrp, /* Out */
+        int *default_portp, /* Out */
+        char ***candidatesp, /* Out */
+        int *candidate_ctp /* Out */
+)
+{
+  *default_portp = -1;
+
+  CSFLogDebug( logTag, "%s: group_id=%d stream_id=%d call_handle=%d PC = %s",
+    __FUNCTION__, group_id, stream_id, call_handle, peerconnection);
+
+  // Note: we don't acquire any media resources here, and we assume that the
+  // ICE streams already exist, so we're just acquiring them. Any logic
+  // to make them on demand is elsewhere.
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    CSFLogError(logTag, "%s: AcquireInstance returned NULL", __FUNCTION__);
+    return;
+  }
+    
+  CSFLogDebug( logTag, "%s: Getting stream %d", __FUNCTION__, level);      
+  mozilla::RefPtr<NrIceMediaStream> stream = pc->impl()->ice_media_stream(level-1);
+  MOZ_ASSERT(stream);
+  if (!stream) {
+    return;
+  }
+
+  std::vector<std::string> candidates = stream->GetCandidates();
+  CSFLogDebug( logTag, "%s: Got %d candidates", __FUNCTION__, candidates.size());
+
+  std::string default_addr;
+  int default_port;
+
+  nsresult res = stream->GetDefaultCandidate(1, &default_addr, &default_port);
+  MOZ_ASSERT(NS_SUCCEEDED(res));
+  if (!NS_SUCCEEDED(res)) {
+    return;
+  }
+    
+  CSFLogDebug( logTag, "%s: Got default candidates %s:%d", __FUNCTION__,
+    default_addr.c_str(), default_port);
+  
+  // Note: this leaks memory if we are out of memory. Oh well.
+  *candidatesp = (char **) cpr_malloc(candidates.size() * sizeof(char *));
+  if (!(*candidatesp))
+    return;
+  
+  for (size_t i=0; i<candidates.size(); i++) {
+    (*candidatesp)[i] = (char *) cpr_malloc(candidates[i].size() + 1);
+    sstrncpy((*candidatesp)[i], candidates[i].c_str(), candidates[i].size() + 1);
+  }
+  *candidate_ctp = candidates.size();
+
+  // Copy the default address
+  *default_addrp = (char *) cpr_malloc(default_addr.size() + 1);
+  if (!*default_addrp)
+    return;
+  sstrncpy(*default_addrp, default_addr.c_str(), default_addr.size() + 1);
+  *default_portp = default_port; /* This is the signal that things are cool */
+}
+
+
+/* Get ICE global parameters (ufrag and pwd)
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[out] ufragp - where to put the ufrag
+ *  @param[out] pwdp - where to put the pwd
+ *
+ *  @return void
+ */
+void vcmGetIceParams(const char *peerconnection, char **ufragp, char **pwdp)
+{
+  CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
+
+  *ufragp = *pwdp = NULL;
+
+ // Note: we don't acquire any media resources here, and we assume that the
+  // ICE streams already exist, so we're just acquiring them. Any logic
+  // to make them on demand is elsewhere.
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return;
+  }
+
+  std::vector<std::string> attrs = pc->impl()->ice_ctx()->GetGlobalAttributes();
+ 
+  // Now fish through these looking for a ufrag and passwd
+  char *ufrag = NULL;
+  char *pwd = NULL;
+ 
+  for (size_t i=0; i<attrs.size(); i++) {
+    if (attrs[i].compare(0, strlen("ice-ufrag:"), "ice-ufrag:") == 0) {
+      if (!ufrag) {
+        ufrag = (char *) cpr_malloc(attrs[i].size() + 1);
+        if (!ufrag)
+          return;
+        sstrncpy(ufrag, attrs[i].c_str(), attrs[i].size() + 1);
+        ufrag[attrs[i].size()] = 0;
+      }
+    }
+
+    if (attrs[i].compare(0, strlen("ice-pwd:"), "ice-pwd:") == 0) {
+      pwd = (char *) cpr_malloc(attrs[i].size() + 1);
+      if (!pwd)
+        return;
+      sstrncpy(pwd, attrs[i].c_str(), attrs[i].size() + 1);
+      pwd[attrs[i].size()] = 0;
+    }
+
+  }
+  if (!ufrag || !pwd) {
+    MOZ_ASSERT(PR_FALSE);
+    cpr_free(ufrag);
+    cpr_free(pwd);
+    CSFLogDebug( logTag, "%s: no ufrag or password", __FUNCTION__);
+    return;
+  }
+  
+  *ufragp = ufrag;
+  *pwdp = pwd;
+
+  return;
+}
+
+
+
+/* Set remote ICE global parameters.
+ * 
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[in]  ufrag - the ufrag
+ *  @param[in]  pwd - the pwd
+ *
+ *  @return 0 success, error failure
+ */
+short vcmSetIceSessionParams(const char *peerconnection, char *ufrag, char *pwd)
+{
+  CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
+
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+  std::vector<std::string> attributes;
+
+  if (ufrag)
+    attributes.push_back(ufrag);
+  if (pwd)
+    attributes.push_back(pwd);
+  
+  nsresult res = pc->impl()->ice_ctx()->ParseGlobalAttributes(attributes);
+  
+  if (!NS_SUCCEEDED(res)) {
+    CSFLogError( logTag, "%s: couldn't parse global parameters", __FUNCTION__ );
+    return VCM_ERROR;
+  }
+
+  return 0;
+}
+
+/* Set ice candidate for trickle ICE.
+ *
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[in]  icecandidate - the icecandidate
+ *  @param[in]  level - the m line level
+ *
+ *  @return 0 success, error failure
+ */
+short vcmSetIceCandidate(const char *peerconnection, const char *icecandidate, uint16_t level)
+{
+  CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
+
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+  CSFLogDebug( logTag, "%s(): Getting stream %d", __FUNCTION__, level);      
+  mozilla::RefPtr<NrIceMediaStream> stream = pc->impl()->ice_media_stream(level-1);
+  if (!stream)
+    return VCM_ERROR;
+
+  nsresult res;
+  pc->impl()->ice_ctx()->thread()->Dispatch(
+    WrapRunnableRet(stream, &NrIceMediaStream::ParseTrickleCandidate, icecandidate, &res),
+    NS_DISPATCH_SYNC);
+
+  if (!NS_SUCCEEDED(res)) {
+    CSFLogError( logTag, "%s(): Could not parse trickle candidate for stream %d", __FUNCTION__, level);
+    return VCM_ERROR;
+  }
+
+  return 0;
+}
+
+/* Start ICE checks
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @return 0 success, error failure
+ */
+short vcmStartIceChecks(const char *peerconnection)
+{
+  CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
+
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+  nsresult res;
+  pc->impl()->ice_ctx()->thread()->Dispatch(
+      WrapRunnableRet(pc->impl()->ice_ctx(), &NrIceCtx::StartChecks, &res),
+      NS_DISPATCH_SYNC);
+
+  if (!NS_SUCCEEDED(res)) {
+    CSFLogError( logTag, "%s: couldn't start ICE checks", __FUNCTION__ );
+    return VCM_ERROR;
+  }
+
+  return 0;
+}
+
+
+/* Set remote ICE media-level parameters.
+ * 
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[in]  level - the m-line
+ *  @param[in]  ufrag - the ufrag
+ *  @param[in]  pwd - the pwd
+ *  @param[in]  candidates - the candidates
+ *  @param[i]   candidate_ct - the number of candidates
+ *  @return 0 success, error failure
+ */
+short vcmSetIceMediaParams(const char *peerconnection, int level, char *ufrag, char *pwd,
+                      char **candidates, int candidate_ct)
+{
+  CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
+
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+  CSFLogDebug( logTag, "%s(): Getting stream %d", __FUNCTION__, level);      
+  mozilla::RefPtr<NrIceMediaStream> stream = pc->impl()->ice_media_stream(level-1);
+  if (!stream)
+    return VCM_ERROR;
+
+  std::vector<std::string> attributes;
+
+  if (ufrag)
+    attributes.push_back(ufrag);
+  if (pwd)
+    attributes.push_back(pwd);
+  
+  for (int i = 0; i<candidate_ct; i++) {
+    attributes.push_back(candidates[i]);
+  }
+
+  nsresult res = stream->ParseAttributes(attributes);
+
+  if (!NS_SUCCEEDED(res)) {
+    CSFLogError( logTag, "%s: couldn't parse global parameters", __FUNCTION__ );
+    return VCM_ERROR;
+  }
+
+  return 0;
+}
+
+/*
+ * Create a remote stream
+ *
+ *  @param[in] mcap_id - group identifier to which stream belongs.
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[out] pc_stream_id - the id of the allocated stream
+ *
+ *  TODO(ekr@rtfm.com): Revise along with everything else for the
+ *  new stream model.
+ *
+ *  Returns: zero(0) for success; otherwise, ERROR for failure
+ */
+short vcmCreateRemoteStream(
+  cc_mcapid_t mcap_id,
+  const char *peerconnection,
+  int *pc_stream_id,
+  vcm_media_payload_type_t payload) {
+  PRUint32 hints = 0;
+  nsresult res;
+
+  CSFLogDebug( logTag, "%s", __FUNCTION__);
+
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+  if (CC_IS_AUDIO(mcap_id)) {
+    hints |= nsDOMMediaStream::HINT_CONTENTS_AUDIO;
+  }
+  if (CC_IS_VIDEO(mcap_id)) {
+    hints |= nsDOMMediaStream::HINT_CONTENTS_VIDEO;
+  }
+
+  sipcc::RemoteSourceStreamInfo* info;
+  res = pc->impl()->CreateRemoteSourceStreamInfo(hints, &info);
+  if (NS_FAILED(res)) {
+    return VCM_ERROR;
+  }
+
+  res = pc->impl()->AddRemoteStream(info, pc_stream_id);
+  if (NS_FAILED(res)) {
+    return VCM_ERROR;
+  }
+
+  if (CC_IS_AUDIO(mcap_id)) {
+    mozilla::AudioSegment *segment = new mozilla::AudioSegment();
+    segment->Init(1); // 1 Channel
+    // TODO(ekr@rtfm.com): Clean up Track IDs
+    info->GetMediaStream()->GetStream()->AsSourceStream()->AddTrack(1, 16000, 0, segment);
+
+    // We aren't going to add any more tracks
+    info->GetMediaStream()->GetStream()->AsSourceStream()->
+        AdvanceKnownTracksTime(mozilla::STREAM_TIME_MAX);
+  }
+  if (CC_IS_VIDEO(mcap_id)) {
+    // AddTrack takes ownership of segment
+  }
+
+  CSFLogDebug( logTag, "%s: created remote stream with index %d hints=%d",
+    __FUNCTION__, *pc_stream_id, hints);
+
+  return 0;
+}
+
+
+/*
+ * Get DTLS key data
+ *
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[out] digest_algp    - the digest algorithm e.g. 'SHA-1'
+ *  @param[in] max_digest_alg_len - length of string
+ *  @param[out] digestp        - the digest string
+ *  @param[in] max_digest_len - length of string
+ *
+ *  Returns: zero(0) for success; otherwise, ERROR for failure
+ */
+short vcmGetDtlsIdentity(const char *peerconnection,
+                char *digest_algp,
+                size_t max_digest_alg_len,
+                char *digestp,
+                size_t max_digest_len) {
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  MOZ_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+  
+  unsigned char digest[TransportLayerDtls::kMaxDigestLength];
+  size_t digest_len;
+  
+  nsresult res = pc->impl()->GetIdentity()->ComputeFingerprint("sha-256", digest,
+                                                               sizeof(digest),
+                                                               &digest_len);
+  if (!NS_SUCCEEDED(res)) {
+    CSFLogError( logTag, "%s: Could not compute identity fingerprint", __FUNCTION__);
+    return VCM_ERROR;
+  }
+
+  // digest_len should be 32 for SHA-256
+  PR_ASSERT(digest_len == 32);
+  std::string fingerprint_txt = DtlsIdentity::FormatFingerprint(digest, digest_len);
+  if (max_digest_len <= fingerprint_txt.size()) {
+    CSFLogError( logTag, "%s: Formatted digest will not fit in provided buffer",
+                 __FUNCTION__);
+    return VCM_ERROR;
+  }
+  
+  sstrncpy(digest_algp, "sha-256", max_digest_alg_len);
+  sstrncpy(digestp, fingerprint_txt.c_str(), max_digest_len);
+
+  return 0;
+}
+
+/* Set negotiated DataChannel parameters.
+ *
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[in]  streams - the number of streams for this data channel
+ *  @param[in]  sctp_port - the negotiated sctp port
+ *  @param[in]  protocol - the protocol as a string
+ *
+ *  @return 0 success, error failure
+ */
+short vcmSetDataChannelParameters(const char *peerconnection, cc_uint16_t streams, int sctp_port, const char* protocol)
+{
+  CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
+
+  CSFLogDebug( logTag, "%s: acquiring peerconnection %s", __FUNCTION__, peerconnection);
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  PR_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+
+  return 0;
+}
+
+
+
 /**
  *   Should we remove this from external API
  *
  *  @param[in] mcap_id - group identifier to which stream belongs.
  *  @param[in]     group_id         - group identifier
  *  @param[in]     stream_id        - stream identifier
  *  @param[in]     call_handle      - call identifier
  *  @param[in]     port_requested   - requested port.
@@ -661,16 +1159,156 @@ int vcmRxStart(cc_mcapid_t mcap_id,
         break;
 
     default:
         break;
     }
     return VCM_ERROR;
 }
 
+
+/**
+ *  start rx stream
+ *  Same concept as vcmRxStart but for ICE/PeerConnection-based flows
+ *
+ *  @param[in]   mcap_id      - media cap id
+ *  @param[in]   group_id     - group identifier to which the stream belongs
+ *  @param[in]   stream_id    - stream id of the given media type.
+ *  @param[in]   level        - the m-line index
+ *  @param[in]   pc_stream_id - the media stream index (from PC.addStream())
+ *  @param[i]n   pc_track_id  - the track within the media stream
+ *  @param[in]   call_handle  - call handle
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[in]  num_payloads   - number of negotiated payloads
+ *  @param[in]  payloads       - negotiated codec details list 
+ *  @param[in]   fingerprint_alg - the DTLS fingerprint algorithm
+ *  @param[in]   fingerprint  - the DTLS fingerprint
+ *  @param[in]   attrs        - media attributes
+ *
+ *  Returns: zero(0) for success; otherwise, ERROR for failure
+ */
+
+int vcmRxStartICE(cc_mcapid_t mcap_id,
+        cc_groupid_t group_id,
+        cc_streamid_t stream_id,
+        int level,
+        int pc_stream_id,
+        int pc_track_id,
+        cc_call_handle_t  call_handle,
+        const char *peerconnection,
+        int num_payloads,
+        const vcm_media_payload_type_t* payloads,    
+        const char *fingerprint_alg,
+        const char *fingerprint,
+        vcm_mediaAttrs_t *attrs)
+{
+  CSFLogDebug( logTag, "%s(%s)", __FUNCTION__, peerconnection);
+
+  // Find the PC and get the stream
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  PR_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+
+  if(!payloads) {
+      CSFLogError( logTag, "Unitialized payload list");
+      return VCM_ERROR;
+  }
+    
+  // Find the stream we need
+  nsRefPtr<sipcc::RemoteSourceStreamInfo> stream =
+    pc->impl()->GetRemoteStream(pc_stream_id);
+  if (!stream) {
+    // This should never happen
+    PR_ASSERT(PR_FALSE);
+    return VCM_ERROR;
+  }
+  // Create the transport flows
+  mozilla::RefPtr<TransportFlow> rtp_flow =
+      vcmCreateTransportFlow(pc->impl(), level, false,
+                             fingerprint_alg, fingerprint);
+  mozilla::RefPtr<TransportFlow> rtcp_flow =
+      vcmCreateTransportFlow(pc->impl(), level, true,
+                             fingerprint_alg, fingerprint);
+
+  if (CC_IS_AUDIO(mcap_id)) {
+    std::vector<mozilla::AudioCodecConfig *> configs;
+    // Instantiate an appropriate conduit
+    mozilla::RefPtr<mozilla::AudioSessionConduit> conduit =
+                    mozilla::AudioSessionConduit::Create();
+    if(!conduit)
+      return VCM_ERROR;
+
+    mozilla::AudioCodecConfig *config_raw;
+    
+    for(int i=0; i <num_payloads ; i++)
+    {
+      int ret = vcmPayloadType2AudioCodec(payloads[i], &config_raw);
+      if (ret) {
+       PR_ASSERT(PR_FALSE);
+       return VCM_ERROR;
+      }
+      configs.push_back(config_raw);      
+    }
+
+    if (conduit->ConfigureRecvMediaCodecs(configs))
+      return VCM_ERROR;
+
+    // Now we have all the pieces, create the pipeline
+    stream->StorePipeline(pc_track_id,
+      new mozilla::MediaPipelineReceiveAudio(
+        pc->impl()->GetMainThread().get(),
+        pc->impl()->GetSTSThread(),
+        stream->GetMediaStream(),
+        conduit, rtp_flow, rtcp_flow));
+
+  } else if (CC_IS_VIDEO(mcap_id)) {
+
+    std::vector<mozilla::VideoCodecConfig *> configs;
+    // Instantiate an appropriate conduit
+    mozilla::RefPtr<mozilla::VideoSessionConduit> conduit =
+             mozilla::VideoSessionConduit::Create();
+    if(!conduit)
+      return VCM_ERROR;
+
+    mozilla::VideoCodecConfig *config_raw;
+
+    for(int i=0; i <num_payloads; i++)
+    {
+      int ret = vcmPayloadType2VideoCodec(payloads[i], &config_raw);
+      if (ret) {
+       PR_ASSERT(PR_FALSE);
+       return VCM_ERROR;
+      }
+      configs.push_back(config_raw);      
+    }   
+
+    if (conduit->ConfigureRecvMediaCodecs(configs))
+      return VCM_ERROR;
+
+    // Now we have all the pieces, create the pipeline
+    stream->StorePipeline(pc_track_id,
+      new mozilla::MediaPipelineReceiveVideo(
+        pc->impl()->GetMainThread().get(),
+        pc->impl()->GetSTSThread(),
+        stream->GetMediaStream(),
+        conduit, rtp_flow, rtcp_flow));
+
+  } else {
+    CSFLogError(logTag, "%s: mcap_id unrecognized", __FUNCTION__);
+    return VCM_ERROR;
+  }
+
+  CSFLogDebug( logTag, "%s success", __FUNCTION__);
+  return 0;
+}
+
+
 /**
  *  Close the receive stream.
  *
  *  @param[in]    mcap_id - Media Capability ID
  *  @param[in]    group_id - group identifier that belongs to the stream.
  *  @param[in]    stream_id - stream id of the given media type.
  *  @param[in]    call_handle  - call identifier
  *
@@ -1075,16 +1713,145 @@ int vcmTxStart(cc_mcapid_t mcap_id,
         break;
 
     default:
         break;
     }
     return VCM_ERROR;
 }
 
+
+/**
+ *  start tx stream
+ *  Same concept as vcmTxStart but for ICE/PeerConnection-based flows
+ *
+ *  @param[in]   mcap_id      - media cap id
+ *  @param[in]   group_id     - group identifier to which the stream belongs
+ *  @param[in]   stream_id    - stream id of the given media type.
+ *  @param[in]   level        - the m-line index
+ *  @param[in]   pc_stream_id - the media stream index (from PC.addStream())
+ *  @param[i]n   pc_track_id  - the track within the media stream
+ *  @param[in]   call_handle  - call handle
+ *  @param[in]  peerconnection - the peerconnection in use
+ *  @param[in]   payload      - payload type
+ *  @param[in]   tos          - bit marking
+ *  @param[in]   fingerprint_alg - the DTLS fingerprint algorithm
+ *  @param[in]   fingerprint  - the DTLS fingerprint
+ *  @param[in]   attrs        - media attributes
+ *
+ *  Returns: zero(0) for success; otherwise, ERROR for failure
+ *
+ */
+#define EXTRACT_DYNAMIC_PAYLOAD_TYPE(PTYPE) ((PTYPE)>>16)
+
+int vcmTxStartICE(cc_mcapid_t mcap_id,
+        cc_groupid_t group_id,
+        cc_streamid_t stream_id,
+        int level,
+        int pc_stream_id,
+        int pc_track_id,
+        cc_call_handle_t  call_handle,
+        const char *peerconnection,
+        vcm_media_payload_type_t payload,
+        short tos,
+        const char *fingerprint_alg,
+        const char *fingerprint,                  
+        vcm_mediaAttrs_t *attrs)
+{
+  CSFLogDebug( logTag, "%s(%s)", __FUNCTION__, peerconnection);
+
+  // Find the PC and get the stream
+  mozilla::ScopedDeletePtr<sipcc::PeerConnectionWrapper> pc(
+      sipcc::PeerConnectionImpl::AcquireInstance(peerconnection));
+  PR_ASSERT(pc);
+  if (!pc) {
+    return VCM_ERROR;
+  }
+  nsRefPtr<sipcc::LocalSourceStreamInfo> stream = pc->impl()->GetLocalStream(pc_stream_id);
+  
+  // Create the transport flows
+  mozilla::RefPtr<TransportFlow> rtp_flow = 
+      vcmCreateTransportFlow(pc->impl(), level, false,
+                             fingerprint_alg, fingerprint);                             
+  mozilla::RefPtr<TransportFlow> rtcp_flow = 
+      vcmCreateTransportFlow(pc->impl(), level, true,
+                             fingerprint_alg, fingerprint);
+
+  if (CC_IS_AUDIO(mcap_id)) {
+    // Find the appropriate media conduit config
+    mozilla::AudioCodecConfig *config_raw;
+    int ret = vcmPayloadType2AudioCodec(payload, &config_raw);
+    if (ret) {
+      return VCM_ERROR;
+    }
+
+    // Take possession of this pointer
+    mozilla::ScopedDeletePtr<mozilla::AudioCodecConfig> config(config_raw);
+
+    // Instantiate an appropriate conduit
+    mozilla::RefPtr<mozilla::AudioSessionConduit> conduit =
+      mozilla::AudioSessionConduit::Create();
+
+    if (conduit->ConfigureSendMediaCodec(config))
+      return VCM_ERROR;
+
+    mozilla::RefPtr<mozilla::MediaPipelineTransmit> pipeline =
+      new mozilla::MediaPipelineTransmit(
+        pc->impl()->GetMainThread().get(),
+        pc->impl()->GetSTSThread(),
+        stream->GetMediaStream(),
+        conduit, rtp_flow, rtcp_flow);
+
+    CSFLogDebug(logTag, "Created audio pipeline %p, conduit=%p, pc_stream=%d pc_track=%d",
+                pipeline.get(), conduit.get(), pc_stream_id, pc_track_id);
+
+    // Now we have all the pieces, create the pipeline
+    stream->StorePipeline(pc_track_id, pipeline);
+
+  } else if (CC_IS_VIDEO(mcap_id)) {
+    mozilla::VideoCodecConfig *config_raw;
+    int ret = vcmPayloadType2VideoCodec(payload, &config_raw);
+    if (ret) {
+      return VCM_ERROR;
+    }
+
+    // Take possession of this pointer
+    mozilla::ScopedDeletePtr<mozilla::VideoCodecConfig> config(config_raw);
+
+    // Instantiate an appropriate conduit
+    mozilla::RefPtr<mozilla::VideoSessionConduit> conduit =
+      mozilla::VideoSessionConduit::Create();
+
+    // Find the appropriate media conduit config
+    if (conduit->ConfigureSendMediaCodec(config))
+      return VCM_ERROR;
+
+    // Create the pipeline
+    mozilla::RefPtr<mozilla::MediaPipeline> pipeline =
+        new mozilla::MediaPipelineTransmit(
+          pc->impl()->GetMainThread().get(),
+          pc->impl()->GetSTSThread(),
+          stream->GetMediaStream(),
+          conduit, rtp_flow, rtcp_flow);
+
+    CSFLogDebug(logTag, "Created video pipeline %p, conduit=%p, pc_stream=%d pc_track=%d",
+                pipeline.get(), conduit.get(), pc_stream_id, pc_track_id);
+
+    // Now we have all the pieces, create the pipeline
+    stream->StorePipeline(pc_track_id, pipeline);
+  } else {
+    CSFLogError(logTag, "%s: mcap_id unrecognized", __FUNCTION__);
+    return VCM_ERROR;
+  }
+
+  CSFLogDebug( logTag, "%s success", __FUNCTION__);
+  return 0;
+}
+
+
 /**
  *  Close the transmit stream
  *
  *  @param[in] mcap_id - Media Capability ID
  *  @param[in] group_id - identifier of the group to which stream belongs
  *  @param[in] stream_id - stream id of the given media type.
  *  @param[in] call_handle  - call identifier
  *
@@ -1117,59 +1884,70 @@ void vcmTxClose(cc_mcapid_t mcap_id,
            VcmSIPCCBinding::getVideoTermination()->txClose( group_id, stream_id);
         break;
 
     default:
         break;
     }
 }
 
+#if 0
 static CodecRequestType
 map_codec_request_type( int request_type )
 {
     switch ( request_type )
     {
     default:
     case cip_sipcc_CodecMask_DSP_IGNORE:     return CodecRequestType_IGNORE;
     case cip_sipcc_CodecMask_DSP_DECODEONLY: return CodecRequestType_DECODEONLY;
     case cip_sipcc_CodecMask_DSP_ENCODEONLY: return CodecRequestType_ENCODEONLY;
     case cip_sipcc_CodecMask_DSP_FULLDUPLEX: return CodecRequestType_FULLDUPLEX;
     }
 }
+#endif
 
 /**
  * Get current list of audio codec that could be used
  * @param request_type - 
  * The request_type should be VCM_DECODEONLY/ENCODEONLY/FULLDUPLEX/IGNORE
  * 
  * @return A bit mask should be returned that specifies the list of the audio
  * codecs. The bit mask should conform to the defines in this file.
  * #define VCM_RESOURCE_G711     0x00000001
  * #define VCM_RESOURCE_G729A    0x00000002
  * ....
  */
 
 int vcmGetAudioCodecList(int request_type) 
 {
+// Direct access to media layer replaced by locally stored codecMask
+// set in PeerConnectionImpl
+#if 0
     const char fname[] = "vcmGetAudioCodecList";
     int retVal;
     int codecMask = 0;
 
     CSFLogDebug( logTag, "%s(request_type = %d)", fname, request_type);
 
     retVal = VcmSIPCCBinding::getAudioTermination() ? VcmSIPCCBinding::getAudioTermination()->getCodecList( map_codec_request_type(request_type) ) : 0;
 
     if ( retVal & AudioCodecMask_G711 ) {    codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_G711; CSFLogDebug( logTag, "%s", " G711"); }
     if ( retVal & AudioCodecMask_LINEAR ) {  codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_LINEAR; CSFLogDebug( logTag, "%s", " LINEAR" ); }
     if ( retVal & AudioCodecMask_G722 ) {    codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_G722; CSFLogDebug( logTag, "%s", " G722"); }
     if ( retVal & AudioCodecMask_iLBC )  {   codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_iLBC; CSFLogDebug( logTag, "%s", " iLBC"); }
     if ( retVal & AudioCodecMask_iSAC )   {  codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_iSAC; CSFLogDebug( logTag, "%s", " iSAC "); }
 
     CSFLogDebug( logTag, "%s(codec_mask = %X)", fname, codecMask);
     return codecMask;
+#else
+  int codecMask = VcmSIPCCBinding::getAudioCodecs();
+  CSFLogDebug(logTag, "GetAudioCodecList returning %X", codecMask);
+  
+  return codecMask;
+#endif
 }
 
 /**
  * Get current list of video codec that could be used
  * @param request_type - 
  * The request_type should be VCM_DECODEONLY/ENCODEONLY/FULLDUPLEX/IGNORE
  *
  * @return A bit mask should be returned that specifies the list of the audio
@@ -1184,31 +1962,40 @@ int vcmGetAudioCodecList(int request_typ
 #endif
 
 #ifndef DSP_H263
 #define DSP_H263        0x00000002
 #endif
 
 int vcmGetVideoCodecList(int request_type)
 {
+// Direct access to media layer replaced by locally stored codecMask
+// set in PeerConnectionImpl
+#if 0
     const char fname[] = "vcmGetVideoCodecList";
     int retVal = 0;
     int codecMask = 0;
 
     CSFLogDebug( logTag, "%s(request_type = %d)", fname, request_type);
 
     retVal = VcmSIPCCBinding::getVideoTermination() ? VcmSIPCCBinding::getVideoTermination()->getCodecList( map_codec_request_type(request_type) ) : 0;
 
     if ( retVal & VideoCodecMask_H264 )    codecMask |= DSP_H264;
     if ( retVal & VideoCodecMask_H263 )    codecMask |= DSP_H263;
 
     CSFLogDebug( logTag, "%s(codec_mask = %X)", fname, codecMask);
 
     //return codecMask;
 	return VCM_CODEC_RESOURCE_H264;
+#else
+  int codecMask = VcmSIPCCBinding::getVideoCodecs();
+  CSFLogDebug(logTag, "GetVideoCodecList returning %X", codecMask);
+  
+  return codecMask;
+#endif
 }
 
 /**
  * Get max supported H.264 video packetization mode. 
  * @return maximum supported video packetization mode for H.264. Value returned
  * must be 0 or 1. Value 2 is not supported yet.
  */
 int vcmGetVideoMaxSupportedPacketizationMode()
@@ -1359,31 +2146,34 @@ cc_boolean vcmCheckAttribs(cc_uint32_t m
     const char      *ptr;
     uint32_t        t_uint;
     struct h264_video *rcap;
 
     *rcapptr = NULL;
 
     switch (media_type)
     {
+    case RTP_VP8:
+    	return TRUE;
+
     case RTP_H264_P0:
     case RTP_H264_P1:
 
-        rcap = (struct h264_video *) malloc( sizeof(struct h264_video) );
+        rcap = (struct h264_video *) cpr_malloc( sizeof(struct h264_video) );
         if ( rcap == NULL )
         {
             CSFLogDebugS( logTag, "vcmCheckAttribs(): Malloc Failed for rcap");
             return FALSE;
         }
         memset( rcap, 0, sizeof(struct h264_video) );
 
         if ( (ptr = ccsdpAttrGetFmtpParamSets(sdp_p, level, 0, 1)) != NULL )
         {
             memset(rcap->sprop_parameter_set, 0, csf_countof(rcap->sprop_parameter_set));
-            csf_strcpy(rcap->sprop_parameter_set, csf_countof(rcap->sprop_parameter_set), ptr);                     
+            sstrncpy(rcap->sprop_parameter_set, ptr, csf_countof(rcap->sprop_parameter_set));                     
         }
 
         if ( ccsdpAttrGetFmtpPackMode(sdp_p, level, 0, 1, &temp) == SDP_SUCCESS )
         {
             rcap->packetization_mode = temp;
         }
 
         if ( (ptr = ccsdpAttrGetFmtpProfileLevelId(sdp_p, level, 0, 1)) != NULL )
@@ -1534,8 +2324,172 @@ int vcmDtmfBurst(int digit, int duration
  * @return int
  */
 int vcmGetILBCMode()
 {
     return 0;
 }
 
 } // extern "C"
+
+
+#define EXTRACT_DYNAMIC_PAYLOAD_TYPE(PTYPE) ((PTYPE)>>16)
+#define CLEAR_DYNAMIC_PAYLOAD_TYPE(PTYPE)   (PTYPE & 0x0000FFFF)
+#define CHECK_DYNAMIC_PAYLOAD_TYPE(PTYPE)   (PTYPE & 0xFFFF0000)
+
+static int vcmPayloadType2AudioCodec(vcm_media_payload_type_t payload_in,
+                                     mozilla::AudioCodecConfig **config) {
+  int wire_payload = -1;
+  // payload_in has the following bit setup
+  // upper 16 bits : Dynamic payload type
+  // lower 16 bits : VCM payload type
+  // Ex: For ISAC Codec: 103:41
+  //     For VP8  Codec: 120:120
+
+  int payload = -1;
+  *config = NULL;
+  if (CHECK_DYNAMIC_PAYLOAD_TYPE(payload_in)) {
+    wire_payload = EXTRACT_DYNAMIC_PAYLOAD_TYPE(payload_in);
+    payload = CLEAR_DYNAMIC_PAYLOAD_TYPE(payload_in);
+  }
+  else {
+    //static payload type
+    wire_payload = payload_in;
+    payload = payload_in;
+  }
+
+  switch(payload) {
+    case VCM_Media_Payload_G711Alaw64k:
+      *config = new mozilla::AudioCodecConfig(wire_payload, "PCMA", 8000, 80, 1, 64000);
+      break;
+    case VCM_Media_Payload_G711Ulaw64k:
+      *config = new mozilla::AudioCodecConfig(wire_payload, "PCMU", 8000, 80, 1, 64000);
+      break;
+    case VCM_Media_Payload_OPUS:
+      *config = new mozilla::AudioCodecConfig(wire_payload, "OPUS", 48000, 480, 1, 64000);
+      break;
+    case VCM_Media_Payload_ISAC:
+      //adaptive rate ISAC,30ms sample
+      *config = new mozilla::AudioCodecConfig(wire_payload, "ISAC", 16000, 480, 1, -1);
+      break;
+    case VCM_Media_Payload_ILBC20:
+      //ilBC 20ms sample
+      *config = new mozilla::AudioCodecConfig(wire_payload, "iLBC", 8000, 160, 1, 15200);
+      break;
+    case VCM_Media_Payload_ILBC30:
+      //ilBC 30ms sample
+      *config = new mozilla::AudioCodecConfig(wire_payload, "iLBC", 8000, 240, 1, 13300);
+      break;
+    case VCM_Media_Payload_G722_64k:
+    case VCM_Media_Payload_G722_56k:
+      //TODO: Check with Ekr, Derf if 64k and 56K are valid frequency rates for G722.1
+      // or G722.2
+      CSFLogError(logTag, "vcmPayloadType2AudioCodec Codec Not Implemented !");
+      PR_ASSERT(PR_FALSE);
+      return VCM_ERROR;
+    default:
+      CSFLogError(logTag, "vcmPayloadType2AudioCodec unknown codec. Apparent internal error");
+      PR_ASSERT(PR_FALSE);
+      return VCM_ERROR;
+  }
+
+  return 0;
+}
+
+static int vcmPayloadType2VideoCodec(vcm_media_payload_type_t payload_in,
+                              mozilla::VideoCodecConfig **config) {
+  int wire_payload = -1;
+  int payload = -1; 
+  *config = NULL;
+
+  if (CHECK_DYNAMIC_PAYLOAD_TYPE(payload_in)) {
+    wire_payload = EXTRACT_DYNAMIC_PAYLOAD_TYPE(payload_in);
+    payload = CLEAR_DYNAMIC_PAYLOAD_TYPE(payload_in);
+  }
+  else {
+    //static payload type
+    wire_payload = payload_in;
+    payload = payload_in;
+  }
+
+  switch(payload)
+  {
+    case VCM_Media_Payload_I420:
+      *config = new mozilla::VideoCodecConfig(wire_payload, "I420", 176, 144);
+      break;
+    case VCM_Media_Payload_VP8:
+      *config = new mozilla::VideoCodecConfig(wire_payload, "VP8", 640, 480);
+      break;
+    default:
+      CSFLogError(logTag, "vcmPayloadType2VideoCodec unknown codec. Apparent internal error");
+      PR_ASSERT(PR_FALSE);
+      return VCM_ERROR;
+  }
+  return 0;
+}
+
+
+
+static mozilla::RefPtr<TransportFlow>
+vcmCreateTransportFlow(sipcc::PeerConnectionImpl *pc, int level, bool rtcp,
+                       const char *fingerprint_alg,
+                       const char *fingerprint) {
+
+  // TODO(ekr@rtfm.com): Check that if the flow already exists the digest
+  // is the same. The only way that can happen is if
+  //
+  // (a) We have an error or
+  // (b) The other side bundled but had mismatched digests for each line
+  //
+  // Not clear that either of these cases matters.
+  mozilla::RefPtr<TransportFlow> flow;
+  flow = pc->GetTransportFlow(level, rtcp);
+  
+  if (!flow) {
+    CSFLogDebug(logTag, "Making new transport flow for level=%d rtcp=%s", level, rtcp ? "true" : "false");
+
+    char id[32];
+    PR_snprintf(id, sizeof(id), "%s:%d,%s",
+                pc->GetHandle().c_str(), level, rtcp ? "rtcp" : "rtp");
+    flow = new TransportFlow(id);
+
+    flow->PushLayer(new TransportLayerIce("flow", pc->ice_ctx(),
+                                          pc->ice_media_stream(level-1),
+                                          rtcp ? 2 : 1));
+    TransportLayerDtls *dtls = new TransportLayerDtls();
+    dtls->SetRole(pc->GetRole() == sipcc::PeerConnectionImpl::kRoleOfferer ?
+                  TransportLayerDtls::CLIENT : TransportLayerDtls::SERVER);
+    dtls->SetIdentity(pc->GetIdentity());
+
+    unsigned char remote_digest[TransportLayerDtls::kMaxDigestLength];
+    size_t digest_len;
+  
+    nsresult res = DtlsIdentity::ParseFingerprint(fingerprint,
+                                                  remote_digest,
+                                                  sizeof(remote_digest),
+                                                  &digest_len);
+    if (!NS_SUCCEEDED(res)) {
+      CSFLogError(logTag, "Could not convert fingerprint");
+      return NULL;
+    }
+    res = dtls->SetVerificationDigest(fingerprint_alg, remote_digest, digest_len);
+    if (!NS_SUCCEEDED(res)) {
+      CSFLogError(logTag, "Could not set remote DTLS digest");
+      return NULL;
+    }
+
+    std::vector<PRUint16> srtp_ciphers;
+    srtp_ciphers.push_back(SRTP_AES128_CM_HMAC_SHA1_80);
+    srtp_ciphers.push_back(SRTP_AES128_CM_HMAC_SHA1_32);
+
+    res = dtls->SetSrtpCiphers(srtp_ciphers);
+    if (!NS_SUCCEEDED(res)) {
+      CSFLogError(logTag, "Couldn't set SRTP ciphers");
+      return NULL;
+    }
+
+    flow->PushLayer(dtls);
+
+    pc->AddTransportFlow(level, rtcp, flow);
+  }
+
+  return flow;
+}
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.h
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.h
@@ -60,35 +60,43 @@ namespace CSF
     	virtual void registerStream(cc_call_handle_t call, int streamId, bool isVideo) = 0;
     	virtual void deregisterStream(cc_call_handle_t call, int streamId) = 0;
     	virtual void dtmfBurst(int digit, int direction, int duration) = 0;
     	virtual void sendIFrame(cc_call_handle_t call) = 0;
     };
     class VcmSIPCCBinding
     {
     public:
-        VcmSIPCCBinding (MediaProvider *mp);
+        VcmSIPCCBinding ();
         virtual ~VcmSIPCCBinding();
 
 
         // The getter is only for use by the vcm_* impl functions.
         void setStreamObserver(StreamObserver*);
         static StreamObserver* getStreamObserver();
 
         static AudioTermination * getAudioTermination();
         static VideoTermination * getVideoTermination();
 
         static AudioControl * getAudioControl();
         static VideoControl * getVideoControl();
 
         void setMediaProviderObserver(MediaProviderObserver* obs);
         static MediaProviderObserver * getMediaProviderObserver();
+
+        static void setAudioCodecs(int codecMask);
+        static void setVideoCodecs(int codecMask);
+
+        static int getAudioCodecs();
+        static int getVideoCodecs();
+
     private:
         static VcmSIPCCBinding * _pSelf;
-        MediaProvider * pMediaProvider;
         StreamObserver* streamObserver;
         MediaProviderObserver *mediaProviderObserver;
+        static int mAudioCodecMask;
+        static int mVideoCodecMask;
     };
 }
 
 #endif
 
 
--- a/media/webrtc/signaling/src/media/cip_mmgr_mediadefinitions.h
+++ b/media/webrtc/signaling/src/media/cip_mmgr_mediadefinitions.h
@@ -119,16 +119,20 @@ extern "C" {
 #undef cip_mmgr_MediaDefinitions_MEDIA_TYPE_RFC2833
 #define cip_mmgr_MediaDefinitions_MEDIA_TYPE_RFC2833 38L
 #undef cip_mmgr_MediaDefinitions_MEDIA_TYPE_ILBC20
 #define cip_mmgr_MediaDefinitions_MEDIA_TYPE_ILBC20 39L
 #undef cip_mmgr_MediaDefinitions_MEDIA_TYPE_ILBC30
 #define cip_mmgr_MediaDefinitions_MEDIA_TYPE_ILBC30 40L
 #undef cip_mmgr_MediaDefinitions_MEDIA_TYPE_ISAC
 #define cip_mmgr_MediaDefinitions_MEDIA_TYPE_ISAC 41L
+#undef cip_mmgr_MediaDefinitions_MEDIA_TYPE_VP8
+#define cip_mmgr_MediaDefinitions_MEDIA_TYPE_VP8 42L
+#undef cip_mmgr_MediaDefinitions_MEDIA_TYPE_OPUS
+#define cip_mmgr_MediaDefinitions_MEDIA_TYPE_OPUS 109L
 
 
 #undef cip_mmgr_MediaDefinitions_BANDWIDTH_NARROWBAND
 #define cip_mmgr_MediaDefinitions_BANDWIDTH_NARROWBAND 200L
 #undef cip_mmgr_MediaDefinitions_BANDWIDTH_WIDEBAND
 #define cip_mmgr_MediaDefinitions_BANDWIDTH_WIDEBAND 201L
 
 #undef cip_mmgr_MediaDefinitions_MEDIA_RESOURCE_G711_BIT_POSITION
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcAudioCodecSelector.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _USE_CPVE
-
-#include "CC_Common.h"
-#include "WebrtcLogging.h"
-
-#include "WebrtcAudioCodecSelector.h"
-#include "voe_codec.h"
-#include "csf_common.h"
-
-static const char* logTag = "AudioCodecSelector";
-
-using namespace std;
-using namespace CSF;
-
-typedef struct _CSFCodecMapping
-{
-    AudioPayloadType csfAudioPayloadType;
-    WebrtcAudioPayloadType webrtcAudioPayloadType;
-} CSFCodecMapping;
-
-static CSFCodecMapping WebrtcMappingInfo[] =
-{
-    { AudioPayloadType_G711ALAW64K,       WebrtcAudioPayloadType_PCMA },
-    { AudioPayloadType_G711ALAW56K,       WebrtcAudioPayloadType_PCMA },
-    { AudioPayloadType_G711ULAW64K,       WebrtcAudioPayloadType_PCMU },
-    { AudioPayloadType_G711ULAW56K,       WebrtcAudioPayloadType_PCMU },
-    { AudioPayloadType_G722_56K,          WebrtcAudioPayloadType_G722 },
-    { AudioPayloadType_G722_64K,          WebrtcAudioPayloadType_G722 },
-    { AudioPayloadType_G722_48K,          WebrtcAudioPayloadType_G722 },
-    { AudioPayloadType_RFC2833,           WebrtcAudioPayloadType_TELEPHONE_EVENT }
-};
-
-WebrtcAudioCodecSelector::WebrtcAudioCodecSelector()
-    : voeCodec(NULL)
-{
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::constructor" );
-}
-
-WebrtcAudioCodecSelector::~WebrtcAudioCodecSelector()
-{
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::destructor" );
-    release();
-}
-
-void WebrtcAudioCodecSelector::release()
-{
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::release" );
-
-    // release the VoE Codec sub-interface
-    if (voeCodec != NULL)
-    {
-        if (voeCodec->Release() != 0)
-        {
-            LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::release voeCodec->Release() failed" );
-        }
-        else
-        {
-            LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::release voeCodec released" );
-        }
-
-        voeCodec = NULL;
-
-        std::map<int, webrtc::CodecInst*>::iterator iterVoeCodecs;
-        for( iterVoeCodecs = codecMap.begin(); iterVoeCodecs != codecMap.end(); ++iterVoeCodecs ) {
-            delete iterVoeCodecs->second;
-        }
-
-        codecMap.clear();
-    }
-}
-
-int WebrtcAudioCodecSelector::init( webrtc::VoiceEngine* voeVoice, bool useLowBandwidthCodecOnly, bool advertiseG722Codec )
-{
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init useLowBandwidthCodecOnly=%d, advertiseG722Codec=%d", useLowBandwidthCodecOnly, advertiseG722Codec );
-
-    voeCodec = webrtc::VoECodec::GetInterface( voeVoice );
-
-    if (voeCodec == NULL)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init cannot get reference to VOE codec interface" );
-        return -1;
-    }
-
-    // clear the existing codec map
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init clearing map" );
-    codecMap.clear();
-
-    // get the number of codecs supported by VOE
-    int numOfSupportedCodecs = voeCodec->NumOfCodecs();
-
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init found %d supported codec(s)", numOfSupportedCodecs );
-
-    // iterate over supported codecs
-    for (int codecIndex = 0; codecIndex < numOfSupportedCodecs; codecIndex++)
-    {
-        webrtc::CodecInst supportedCodec;
-
-        if (voeCodec->GetCodec(codecIndex, supportedCodec) == -1)
-        {
-            LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init codecIndex=%d: cannot get supported codec information", codecIndex );
-            continue;
-        }
-
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init codecIndex=%d: channels=%d, pacsize=%d, plfreq=%d, plname=%s, pltype=%d, rate=%d",
-                codecIndex, supportedCodec.channels, supportedCodec.pacsize, supportedCodec.plfreq,
-                supportedCodec.plname, supportedCodec.pltype, supportedCodec.rate );
-
-        // iterate over the payload conversion table
-        for (int i=0; i< (int) csf_countof(WebrtcMappingInfo); i++)
-        {
-            WebrtcAudioPayloadType webrtcPayload = WebrtcMappingInfo[i].webrtcAudioPayloadType;
-
-            if (supportedCodec.pltype == webrtcPayload)
-            {
-                bool addCodec = false;
-
-                AudioPayloadType csfPayload = WebrtcMappingInfo[i].csfAudioPayloadType;
-
-                switch (csfPayload)
-                {
-                case AudioPayloadType_G711ALAW64K:
-                case AudioPayloadType_G711ULAW64K:
-                    if (!useLowBandwidthCodecOnly)
-                    {
-                        addCodec = true;
-                    }
-                    break;
-
-                case AudioPayloadType_G722_56K:
-                case AudioPayloadType_G722_64K:
-                    if (!useLowBandwidthCodecOnly &&
-                        advertiseG722Codec)
-                    {
-                        addCodec =  true;
-                    }
-                    break;
-
-                // iLBC and iSAC support is postponed
-                //case AudioPayloadType_ILBC20:
-                //case AudioPayloadType_ILBC30:
-                //    addCodec =  true;
-                //    break;
-                //
-                //case AudioPayloadType_ISAC:
-                //    addCodec = true;
-                //    break;
-
-                case AudioPayloadType_RFC2833:
-                    addCodec =  true;
-                    break;
-
-                case AudioPayloadType_G711ALAW56K:
-                case AudioPayloadType_G711ULAW56K:
-                case AudioPayloadType_G722_48K:
-                case AudioPayloadType_ILBC20:
-                case AudioPayloadType_ILBC30:
-                case AudioPayloadType_ISAC:
-                  break;
-                    
-                } // end of switch(csfPayload)
-
-                if (addCodec)
-                {
-                    // add to codec map
-                    webrtc::CodecInst* mappedCodec = new webrtc::CodecInst; // not sure when it should be deleted
-                    memcpy(mappedCodec, &supportedCodec, sizeof(webrtc::CodecInst));
-
-                    codecMap[csfPayload] = mappedCodec;
-
-                    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init added mapping payload %d to VoE codec %s", csfPayload, mappedCodec->plname);
-                }
-                else
-                {
-                    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init no mapping found for VoE codec %s (payload %d)", supportedCodec.plname, webrtcPayload );
-                }
-            }
-        } // end of iteration over the payload conversion table
-
-    } // end of iteration over supported codecs
-
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::init %d codec(s) added to map", (int)codecMap.size() );
-
-    // return success
-    return 0;
-}
-
-int  WebrtcAudioCodecSelector::advertiseCodecs( CodecRequestType requestType )
-{
-    return AudioCodecMask_G711  |AudioCodecMask_G722;
-}
-
-int WebrtcAudioCodecSelector::select( int payloadType, int dynamicPayloadType, int packPeriod, webrtc::CodecInst& selectedCodec )
-{
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::select payloadType=%d, dynamicPayloadType=%d, packPeriod=%d", payloadType, dynamicPayloadType, packPeriod );
-
-    // TO DO: calculate packet size ?
-    // packPeriod "represents the number of milliseconds of audio encoded in a single packet" ?
-    int packetSize = packPeriod;
-
-    webrtc::CodecInst* supportedCodec = codecMap[payloadType];
-
-    if (supportedCodec == NULL)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::select no VoE codec found for payload %d", payloadType);
-        return -1; // return failure
-    }
-
-    memcpy(&selectedCodec, supportedCodec, sizeof(webrtc::CodecInst));
-
-    // adapt dynamic payload type if required
-    if (dynamicPayloadType != -1)
-    {
-        selectedCodec.pltype = dynamicPayloadType;
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::select pltype = %d", selectedCodec.pltype);
-    }
-
-    // adapt packet size
-    int pacsize;    // packet size in samples = sample rate * packet size
-
-    switch ( payloadType )
-    {
-    case AudioPayloadType_G711ALAW64K:
-    case AudioPayloadType_G711ULAW64K:
-        // VoE allowed packet sizes for G.711 u/a law: 10, 20, 30, 40, 50, 60 ms
-        // (or 80, 160, 240, 320, 400, 480 samples)
-        pacsize = ( 8 * packetSize );
-        if (( pacsize == 80 ) || ( pacsize == 160 ) ||
-            ( pacsize == 240) || ( pacsize == 320 ) ||
-            ( pacsize == 400) || ( pacsize == 480 ))
-        {
-            selectedCodec.pacsize = pacsize;
-        }
-        break;
-
-    case AudioPayloadType_ILBC20:
-        // VoE allowed packet sizes for iLBC: 20 30, 40, 60 ms
-        pacsize = ( 8 * packetSize );
-        if ( pacsize == 160 )
-        {
-            selectedCodec.pacsize = pacsize;
-        }
-        break;
-
-    case AudioPayloadType_ILBC30:
-        // VoE allowed packet sizes for iLBC: 20 30, 40, 60 ms
-        pacsize = ( 8 * packetSize );
-        if ( pacsize == 240 )
-        {
-            selectedCodec.pacsize = pacsize;
-        }
-        break;
-
-    case AudioPayloadType_G722_56K:
-    case AudioPayloadType_G722_64K:
-        // VoE allowed packet size for G.722: 20ms (or 320 samples).
-        pacsize = ( 16 * packetSize );
-        if ( pacsize == 320 )
-        {
-            selectedCodec.pacsize = pacsize;
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::select found codec %s (payload=%d, packetSize=%d)",
-            selectedCodec.plname, selectedCodec.pltype, selectedCodec.pacsize);
-
-    // return success
-    return 0;
-}
-
-int WebrtcAudioCodecSelector::setSend(int channel, const webrtc::CodecInst& codec,int payloadType,bool vad)
-{
-    webrtc::PayloadFrequencies freq;
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setSend channel=%d codec %s (payload=%d, packetSize=%d)",
-            channel, codec.plname, codec.pltype, codec.pacsize);
-
-    if (voeCodec == NULL)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setSend voeCodec is null" );
-        return -1;
-    }
-    bool vadEnable=vad;
-
-    if (voeCodec->SetVADStatus( channel,  vadEnable,  webrtc::kVadConventional,false) != 0)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::SetVADStatus cannot set VAD  to channel %d", channel );
-        return -1;
-    }
-    
-    // Check the codec's sampling  frequency and use appropriate enum 
-    switch (codec.plfreq)
-    {
-        case SamplingFreq8000Hz:
-            freq=webrtc::kFreq8000Hz;
-        break;
-        case SamplingFreq16000Hz:
-            freq=webrtc::kFreq16000Hz;
-            break;
-       case SamplingFreq32000Hz:
-            freq=webrtc::kFreq32000Hz;
-            break;            
-       default:
-            freq=webrtc::kFreq8000Hz;
-
-    }
-    
-    if (voeCodec->SetSendCNPayloadType(channel, ComfortNoisePayloadType,  freq) != 0)
-    {
-        LOG_WEBRTC_INFO( logTag, "SetSendCNPayloadType cannot set CN payload type  to channel %d", channel );
-        //return -1;
-    }
-    // apply the codec to the channel
-    if (voeCodec->SetSendCodec(channel, codec) != 0)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setSend cannot set send codec to channel %d", channel );
-        return -1;
-    }
-
-    
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setSend applied codec %s (payload=%d, packetSize=%d) to channel %d",
-            codec.plname, codec.pltype, codec.pacsize, channel);
-
-    // return success
-    return 0;
-}
-
-int WebrtcAudioCodecSelector::setReceive(int channel, const webrtc::CodecInst& codec)
-{
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setReceive channel=%d codec %s (payload=%d, packetSize=%d)",
-            channel, codec.plname, codec.pltype, codec.pacsize);
-
-    if (voeCodec == NULL)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setSend voeCodec is null" );
-        return -1;
-    }
-
-    if (voeCodec->SetRecPayloadType(channel, codec) != 0)
-    {
-        LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setReceive cannot set receive codec to channel %d", channel );
-        return -1;
-    }
-
-    LOG_WEBRTC_INFO( logTag, "WebrtcAudioCodecSelector::setReceive applied codec %s (payload=%d, packetSize=%d) to channel %d",
-            codec.plname, codec.pltype, codec.pacsize, channel);
-
-    // return success
-    return 0;
-}
-
-#endif
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcAudioCodecSelector.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *Webrtc
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef WEBRTCAUDIOCODECSELECTOR_H_
-#define WEBRTCAUDIOCODECSELECTOR_H_
-
-#ifndef _USE_CPVE
-
-#include <CSFAudioTermination.h>
-#include "voe_base.h"
-#include "voe_codec.h"
-#include <map>
-
-
-typedef enum {
-  WebrtcAudioPayloadType_PCMU = 0,
-  WebrtcAudioPayloadType_PCMA = 8,
-  WebrtcAudioPayloadType_G722 = 9,
-  WebrtcAudioPayloadType_iLBC = 102,
-  WebrtcAudioPayloadType_ISAC = 103,
-  WebrtcAudioPayloadType_TELEPHONE_EVENT = 106,
-  WebrtcAudioPayloadType_ISACLC = 119,
-  WebrtcAudioPayloadType_DIM = -1
-
-} WebrtcAudioPayloadType;
-
-const int ComfortNoisePayloadType = 13;
-const int SamplingFreq8000Hz =8000;
-const int SamplingFreq16000Hz =16000;
-const int SamplingFreq32000Hz =32000;
-
-namespace CSF
-{
-
-// A class to select a VOE audio codec
-class WebrtcAudioCodecSelector
-{
-public:
-	// the constructor
-	WebrtcAudioCodecSelector();
-
-	// the destructor
-	~WebrtcAudioCodecSelector();
-
-	int init( webrtc::VoiceEngine* voeVoice, bool useLowBandwidthCodecOnly, bool advertiseG722Codec );
-
-	void release();
-
-	// return a bit mask of the available codecs
-	int  advertiseCodecs( CodecRequestType requestType );
-
-	// select the VOE codec according to payload type and packet size
-	// return 0 if a codec was selected
-	int select( int payloadType, int dynamicPayloadType, int packetSize, webrtc::CodecInst& selectedCoded );
-
-	// apply a sending codec to the channel
-	// return 0 if codec could be applied
-	int setSend(int channel, const webrtc::CodecInst& codec,int payloadType,bool vad);
-
-	// apply a receiving codec to the channel
-	// return 0 if codec could be applied
-	int setReceive(int channel, const webrtc::CodecInst& codec);
-
-private:
-	// the reference to the GIPS Codec sub-interface
-	webrtc::VoECodec* voeCodec;
-
-	std::map<int, webrtc::CodecInst*> codecMap;
-};
-
-} // namespace CSF
-
-#endif
-#endif /* WEBRTCAUDIOCODECSELECTOR_H_ */
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcAudioProvider.cpp
+++ /dev/null
@@ -1,961 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _USE_CPVE
-
-#include "CC_Common.h"
-
-#include "string.h"
-#include <stdio.h>
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include "WebrtcMediaProvider.h"
-#include "WebrtcAudioProvider.h"
-#include "WebrtcToneGenerator.h"
-#include "WebrtcRingGenerator.h"
-#include "voe_file.h"
-#include "voe_hardware.h"
-#include "voe_errors.h"
-#include "voe_network.h"
-#include "voe_audio_processing.h"
-#include "WebrtcLogging.h"
-
-#include "CSFLog.h"
-static const char* logTag = "WebrtcAudioProvider";
-using namespace std;
-
-extern "C" void config_get_value (int id, void *buffer, int length);
-
-
-namespace CSF {
-
-#define EXTRACT_DYNAMIC_PAYLOAD_TYPE(PTYPE) ((PTYPE)>>16)
-#define CLEAR_DYNAMIC_PAYLOAD_TYPE(PTYPE)   (PTYPE & 0x0000FFFF)
-#define CHECK_DYNAMIC_PAYLOAD_TYPE(PTYPE)   (PTYPE & 0xFFFF0000)
-
-
-#ifdef WIN32
-bool IsUserAdmin();
-bool IsVistaOrNewer();
-#endif
-
-class WebrtcAudioStream {
-public:
-	WebrtcAudioStream(int _streamId, int _channelId):
-		streamId(_streamId), channelId(_channelId),
-		isRxStarted(false), isTxStarted(false), isAlive(false)
-		{}
-	int streamId;
-	int channelId;
-	bool isRxStarted;
-	bool isTxStarted;
-	bool isAlive;
-};
-
-WebrtcAudioProvider::WebrtcAudioProvider( WebrtcMediaProvider* provider )
-: provider(provider), 
-  voeVoice(NULL),
-  voeBase(NULL), 
-  voeFile(NULL),
-  voeHw(NULL), 
-  voeDTMF(NULL), 
-  voeNetwork(NULL), 
-  voeVolumeControl(NULL), 
-  voeVoiceQuality(NULL), 
-  voeEncryption(NULL),
-  toneGen(NULL), 
-  ringGen(NULL), 
-  startPort(1024), 
-  endPort(65535), 
-  defaultVolume(100), 
-  ringerVolume(100), 
-  DSCPValue(0), 
-  VADEnabled(false),
-  stopping(false)
-{
-	LOG_WEBRTC_INFO( logTag, "WebrtcAudioProvider::WebrtcAudioProvider");
-}
-
-int WebrtcAudioProvider::init()
-{
-	LOG_WEBRTC_INFO( logTag, "WebrtcAudioProvider::init");
-
-	if (voeVoice != NULL) {
-		LOG_WEBRTC_ERROR( logTag, "WebrtcAudioProvider::init : already initialized");
-		return -1;
-	}
-
-    voeVoice = webrtc::VoiceEngine::Create();
-	if (voeVoice == NULL) {
-		LOG_WEBRTC_ERROR( logTag, "WebrtcAudioProvider():VoiceEngine::Create failed");
-		return -1;
-	}
-
-	voeBase = webrtc::VoEBase::GetInterface( voeVoice );
-	if (voeBase == NULL) {
-		LOG_WEBRTC_ERROR( logTag, "WebrtcAudioProvider(): VoEBase::GetInterface failed");
-		return -1;
-	}
-
-	const int VERSIONBUFLEN=1024;
-	char versionbuf[VERSIONBUFLEN];
-	voeBase->GetVersion(versionbuf);
-	LOG_WEBRTC_INFO( logTag, "%s", versionbuf );
-	//voeBase->voeVE_SetObserver( *this );
-
-//#ifdef ENABLE_WEBRTC_AUDIO_TRACE
-	//LOG_WEBRTC_ERROR( logTag, "VoEAudioProvider(): Enabling Trace ");
-	//voeVoice->SetTraceFilter(webrtc::kTraceAll);
-	//voeVoice->SetTraceFile( "voeaudiotrace.out" );
-	//voeVoice->SetTraceCallback(this);
-//#endif
-
-	voeDTMF = webrtc::VoEDtmf::GetInterface( voeVoice );
-	voeFile = webrtc::VoEFile::GetInterface( voeVoice );
-	voeHw =   webrtc::VoEHardware::GetInterface( voeVoice );
-	voeNetwork = webrtc::VoENetwork::GetInterface( voeVoice );
-	voeVolumeControl = webrtc::VoEVolumeControl::GetInterface( voeVoice );
-	voeVoiceQuality = webrtc::VoEAudioProcessing::GetInterface( voeVoice );
-    voeEncryption = webrtc::VoEEncryption::GetInterface(voeVoice);
-
-	if ((!voeDTMF) || (!voeFile) || (!voeHw) ||(!voeNetwork) || (!voeVolumeControl) || (!voeVoiceQuality) || (!voeEncryption)) {
-		LOG_WEBRTC_ERROR( logTag, "WebrtcAudioProvider(): voeVE_GetInterface failed voeDTMF=%p voeFile=%p voeHw=%p voeNetwork=%p voeVolumeControl=%p voeVoiceQuality=%p voeEncryption=%p",
-		voeDTMF,voeFile,voeHw,voeNetwork,voeVolumeControl,voeVoiceQuality,voeEncryption);
-		return -1;
-	}
-
-	codecSelector.init(voeVoice, false, true);
-	voeBase->Init();
-
-	localRingChannel = voeBase->CreateChannel();
-	localToneChannel = voeBase->CreateChannel();
-
-    /*
-	Set up Voice Quality Enhancement Parameters
-    */
-	webrtc::AgcConfig webphone_agc_config = {3,9,1};
-	voeVoiceQuality->SetAgcConfig(webphone_agc_config); 
-	voeVoiceQuality->SetAgcStatus(true, webrtc::kAgcFixedDigital);
-	voeVoiceQuality->SetNsStatus(true, webrtc::kNsModerateSuppression);
-
-	// get default device names
-	int nDevices, error = 0;
-	//returning the first found recording and playout device name
-	error = voeHw->GetNumOfRecordingDevices(nDevices);	
-	for(int i = 0; i < nDevices; i++) {
-		char name[128];
-		char guid[128];
-		memset(name,0,128);
-		memset(guid,0,128);
-		error = voeHw->GetRecordingDeviceName(i, name, guid);
-		if(error == 0) {
-			recordingDevice = name;
-		} else {
-			LOG_WEBRTC_ERROR( logTag, "WebrtcAudioProvider: GetRecordingDeviceNamefailed: Error: %d", voeBase->LastError() );
-		}	
-	}
-	
-	//playout
-	nDevices = 0;
-	error = voeHw->GetNumOfPlayoutDevices(nDevices);
-	for(int i=0; i < nDevices; i++) {
-		char pname[128], pguid[128];
-		memset(pname,0,128);
-		memset(pguid,0,128);
-		if ( voeHw->GetPlayoutDeviceName( i, pname, pguid ) == 0 ) {
-			playoutDevice = pname;
-		} else {
-				LOG_WEBRTC_ERROR( logTag, "WebrtcAudioProvider: GetlayoutDeviceNamefailed: Error: %d", voeBase->LastError() );
-		}
-	}
-
-    LOG_WEBRTC_DEBUG( logTag, "local IP: \"%s\"", localIP.c_str());
-    LOG_WEBRTC_DEBUG( logTag, "RecordingDeviceName: \"%s\"", recordingDevice.c_str());
-    LOG_WEBRTC_DEBUG( logTag, "PlayoutDeviceName: \"%s\"", playoutDevice.c_str());
-	// success
-	return 0;
-}
-
-WebrtcAudioProvider::~WebrtcAudioProvider() {
-	LOG_WEBRTC_INFO( logTag, "WebrtcAudioProvider::~WebrtcAudioProvider");
-
-	int num_ifs=0;
-	stopping = true;
-	// tear down in reverse order, for symmetry
-	codecSelector.release();
-
-	voeBase->DeleteChannel( localToneChannel );
-	voeBase->DeleteChannel( localRingChannel );
-	voeBase->Terminate();
-
-	if(voeBase->Release() !=0) {
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeBase->Release failed");
-	}
-	
-	if ((num_ifs=voeDTMF->Release())!=0)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeDTMF->Release failed, num_ifs left= %d",num_ifs);
-	if ((num_ifs=voeFile->Release())!=0)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeFile->Release failed, num_ifs left= %d ",num_ifs);
-	if((num_ifs=voeHw->Release())!=0)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeHw->Release failed, num_ifs left= %d " ,num_ifs);
-	if((num_ifs=voeNetwork->Release())!=0)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeNetwork->Release() failed, num_ifs left= %d" ,num_ifs);
-	if((num_ifs=voeVolumeControl->Release())!=0)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeVolumeControl->Release() failed, num_ifs left= %d" ,num_ifs);
-	if((num_ifs=voeVoiceQuality->Release())!=0)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeVoiceQuality->Release() failed, num_ifs left= %d ",num_ifs );
-    if((num_ifs=voeEncryption->Release())!=0)
-        LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeEncryption->Release() failed, num_ifs left= %d ",num_ifs );
-	if(webrtc::VoiceEngine::Delete( voeVoice, true ) == false)
-		LOG_WEBRTC_ERROR( logTag, "~WebrtcAudioProvider(): voeVoiceEngine::Delete failed" );
-
-	delete toneGen;
-	toneGen = NULL;
-
-	delete ringGen;
-	ringGen = NULL;
-
-	// Clear all our pointers
-	voeFile = NULL;
-	voeHw = NULL;
-	voeDTMF = NULL;
-	voeNetwork = NULL;
-	voeVolumeControl = NULL;
-	voeVoiceQuality = NULL;
-	voeVoice = NULL;
-	voeBase = NULL;
-    voeEncryption = NULL;
-
-	LOG_WEBRTC_INFO( logTag, "WebrtcAudioProvider::shutdown done");
-}
-
-std::vector<std::string> WebrtcAudioProvider::getRecordingDevices() {
-	AutoLock lock(m_lock);
-	char name[128];
-	char guid[128];
-	int  nRec = 0;
-	memset(name,0,128);
-	memset(guid,0,128);
-	std::vector<std::string> deviceList;
-    voeHw->GetNumOfRecordingDevices(nRec);
-
-	for ( int i = 0; i < nRec; i++ ) {
-		if ( voeHw->GetRecordingDeviceName( i, name, guid ) == 0 )
-			deviceList.push_back( name );
-	}
-	return deviceList;
-}
-
-std::vector<std::string> WebrtcAudioProvider::getPlayoutDevices() {
-	AutoLock lock(m_lock);
-	char name[128];
-	char guid[128];
-	int nPlay = 0;
-	std::vector<std::string> deviceList;
-	memset(name,0,128);
-	memset(guid,0,128);
-	voeHw->GetNumOfPlayoutDevices( nPlay);
-	for ( int i = 0; i < nPlay; i++ ) {
-		if ( voeHw->GetPlayoutDeviceName( i, name, guid ) == 0 )
-			deviceList.push_back( name );
-	}
-	return deviceList;
-}
-
-bool WebrtcAudioProvider::setRecordingDevice( const std::string& device ) {
-	AutoLock lock(m_lock);
-	char name[128];
-	char guid[128];
-	int nRec = 0, nPlay = 0;
-	int playoutIndex, recordingIndex;
-	memset(name,0,128);
-	memset(guid,0,128);
-	voeHw->GetNumOfRecordingDevices(  nRec );
-	voeHw->GetNumOfPlayoutDevices(  nPlay );
-
-	// find requested recording device
-	for ( recordingIndex = 0; recordingIndex < nRec; recordingIndex++ ) {
-		if ( voeHw->GetRecordingDeviceName( recordingIndex, name, guid ) == 0 ) {
-			if ( device.compare( name ) == 0 ) break;
-		}
-	}
-	if ( recordingIndex == nRec ) {
-		return false;  // we didn't find the requested device, fail
-	}
-
-	// find existing playout device, to preserve its index
-	// search downward until we reach the default device
-	name[0] = '\0';
-	for ( playoutIndex = nPlay - 1; playoutIndex >= -1; playoutIndex-- ) {
-		if ( voeHw->GetPlayoutDeviceName( playoutIndex, name, guid ) == 0 ) {
-			if ( playoutDevice.compare( name ) == 0 ) break;
-		}
-		else name[0] = '\0';
-	}
-	if ( playoutIndex < -1 ) {
-		playoutIndex = -1; // we didn't find the current device, use default
-	}
-
-	if ( voeHw->SetRecordingDevice( recordingIndex ) == 0 
-			&& voeHw->SetPlayoutDevice( playoutIndex) == 0 ) {
-		recordingDevice = device;
-		playoutDevice = name;	// the current name
-		return true;
-	}
-	return false;
-}
-
-bool WebrtcAudioProvider::setPlayoutDevice( const std::string& device ) {
-	AutoLock lock(m_lock);
-	char name[128];
-	char guid[128];
-	int nPlay = 0, nRec = 0;
-	int playoutIndex, recordingIndex;
-
-	voeHw->GetNumOfRecordingDevices(  nRec );
-	voeHw->GetNumOfPlayoutDevices(  nPlay );
-
-	// find requested playout device
-	for ( playoutIndex = 0; playoutIndex < nPlay; playoutIndex++ ) {
-		if ( voeHw->GetPlayoutDeviceName( playoutIndex, name, guid ) == 0 ) {
-			if ( device.compare( name ) == 0 ) break;
-		}
-	}
-	if ( playoutIndex == nPlay ) {
-		return false; // we didn't find the requested device, fail
-	}
-
-	// find existing recording device, to preserve its index
-	// search downward until we reach the default device
-	name[0] = '\0';
-	guid[0] = '\0';
-	for ( recordingIndex = nRec - 1; recordingIndex >= -1; recordingIndex-- ) {
-		if ( voeHw->GetRecordingDeviceName( recordingIndex, name, guid ) == 0 ) {
-			if ( recordingDevice.compare( name ) == 0 ) break;
-		}
-		else name[0] = '\0';
-	}
-	if ( recordingIndex < -1 ) {
-		recordingIndex = -1; // we didn't find the current device, use default
-	}
-
-	if ( voeHw->SetRecordingDevice( recordingIndex ) == 0 &&
-			voeHw->SetPlayoutDevice( playoutIndex) == 0 ) {
-		playoutDevice = device;
-		recordingDevice = name;	// the current name
-		return true;
-	}
-	return false;
-}
-
-WebrtcAudioStreamPtr WebrtcAudioProvider::getStreamByChannel( int channel ) {
-	AutoLock lock(streamMapMutex);
-	for( std::map<int, WebrtcAudioStreamPtr>::const_iterator it = streamMap.begin(); it != streamMap.end(); it++ ) {
-		WebrtcAudioStreamPtr stream = it->second;
-		if(stream->channelId == channel)
-			return stream;
-	}
-	return WebrtcAudioStreamPtr();
-}
-
-WebrtcAudioStreamPtr WebrtcAudioProvider::getStream( int streamId ) {
-	AutoLock lock(streamMapMutex);
-	std::map<int, WebrtcAudioStreamPtr>::const_iterator it = streamMap.find( streamId );
-	return ( it != streamMap.end() ) ? it->second : WebrtcAudioStreamPtr();
-}
-
-int WebrtcAudioProvider::getChannelForStreamId( int streamId ) {
-	WebrtcAudioStreamPtr stream = getStream(streamId);
-	return ( stream != NULL ) ? stream->channelId : -1;
-}
-
-int WebrtcAudioProvider::getCodecList( CodecRequestType requestType ) {
-	AutoLock lock(m_lock);
-	return codecSelector.advertiseCodecs(requestType);
-}
-
-int WebrtcAudioProvider::rxAlloc( int groupId, int streamId, int requestedPort ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "rxAllocAudio: groupId=%d, streamId=%d, requestedPort=%d", groupId, streamId, requestedPort  );
-	int channel = voeBase->CreateChannel();
-	if ( channel == -1 ) {
-		LOG_WEBRTC_ERROR( logTag, "rxAllocAudio: CreateChannel failed, error %d", voeBase->LastError() );
-		return 0;
-	}
-	LOG_WEBRTC_DEBUG( logTag, "rxAllocAudio: Created channel %d", channel );
-	voeNetwork->SetPeriodicDeadOrAliveStatus(channel, true);
-
-	int beginPort;		// where we started
-	int tryPort;		// where we are now
-
-	if ( requestedPort == 0  || requestedPort < startPort || requestedPort >= endPort )
-		tryPort = startPort;
-	else
-		tryPort = requestedPort;
-
-	beginPort = tryPort;
-
-	const char * pLocalAddr = NULL;
-
-	if (localIP.size() > 0) {
-		pLocalAddr = localIP.c_str();
-	}
-
-	do {
-		if ( voeBase->SetLocalReceiver( channel, tryPort, webrtc::kVoEDefault, pLocalAddr ) == 0 ) {
-			int port, RTCPport;
-			char ipaddr[64];
-			ipaddr[0]='\0';
-			// retrieve local receiver settings for channel
-			voeBase->GetLocalReceiver(channel, port,RTCPport, ipaddr);
-			localIP = ipaddr;
-			LOG_WEBRTC_DEBUG( logTag, "rxAllocAudio: IPAddr: %d", ipaddr );
-			LOG_WEBRTC_DEBUG( logTag, "rxAllocAudio: Allocated port %d", tryPort );
-			WebrtcAudioStreamPtr stream(new WebrtcAudioStream(streamId, channel)); {
-				AutoLock lock(streamMapMutex);
-				streamMap[streamId] = stream;
-			}
-			setVolume(streamId, defaultVolume);
-			return tryPort;
-		}
-
-		int errCode = voeBase->LastError();
-		if ( errCode == VE_SOCKET_ERROR ||			
-			 errCode == VE_BINDING_SOCKET_TO_LOCAL_ADDRESS_FAILED ||
-			errCode == VE_RTCP_SOCKET_ERROR ) {
-	        tryPort += 2;
-	        if ( tryPort >= endPort )
-	        	tryPort = startPort;
-        }
-		else {
-			LOG_WEBRTC_ERROR( logTag, "rxAllocAudio: SetLocalReceiver returned error %d", errCode );
-			voeBase->DeleteChannel( channel );
-			return 0;
-		}
-	}
-	while ( tryPort != beginPort );
-
-	LOG_WEBRTC_WARN( logTag, "rxAllocAudio: No ports available?" );
-	voeBase->DeleteChannel( channel );
-	return 0;
-}
-
-int WebrtcAudioProvider::rxOpen( int groupId, int streamId, int requestedPort, int listenIp, bool isMulticast ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "rxOpenAudio: groupId=%d, streamId=%d", groupId, streamId );
-	int channel = getChannelForStreamId( streamId );
-	if ( channel >= 0 ) {
-		LOG_WEBRTC_DEBUG( logTag, "rxOpenAudio: return requestedPort=%d", requestedPort );
-		return requestedPort;
-	}
-	return 0;
-}
-
-int WebrtcAudioProvider::rxStart( int groupId, int streamId, int payloadType, int packPeriod, int localPort,
-		int rfc2833PayloadType, EncryptionAlgorithm algorithm, unsigned char* key, int keyLen, unsigned char* salt, int saltLen, int mode, int party ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "rxStartAudio: groupId=%d, streamId=%d", groupId, streamId );
-	int channel = getChannelForStreamId( streamId );
-	if ( channel >= 0 ) {
-		int dynamicPayloadType = -1;
-
-	    if (CHECK_DYNAMIC_PAYLOAD_TYPE(payloadType)) {
-	        dynamicPayloadType = EXTRACT_DYNAMIC_PAYLOAD_TYPE(payloadType);
-	        payloadType = CLEAR_DYNAMIC_PAYLOAD_TYPE(payloadType);
-	    }
-
-	    if (dynamicPayloadType != -1) {
-			webrtc::CodecInst codec;
-
-			if (codecSelector.select(payloadType, dynamicPayloadType, packPeriod, codec) != 0) {
-				LOG_WEBRTC_ERROR( logTag, "rxStartAudio cannot select codec (payloadType=%d, packPeriod=%d)",
-						payloadType, packPeriod );
-				return -1;
-			}
-
-			if (codecSelector.setReceive(channel, codec) != 0) {
-				LOG_WEBRTC_ERROR( logTag, "rxStartAudio cannot set receive codec to channel=%d", channel );
-				return -1;
-			}
-	    }
-
-        switch(algorithm) {
-            case EncryptionAlgorithm_NONE:
-                LOG_WEBRTC_DEBUG( logTag, "rxStartAudio: using non-secure RTP for channel %d", channel);
-                break;
-
-            case EncryptionAlgorithm_AES_128_COUNTER: {
-                unsigned char key[WEBRTC_KEY_LENGTH];
-
-                LOG_WEBRTC_DEBUG( logTag, "rxStartAudio: using secure RTP for channel %d", channel);
-
-                if(!provider->getKey(key, keyLen, salt, saltLen, key, sizeof(key))) {
-                    LOG_WEBRTC_ERROR( logTag, "rxStartAudio: failed to generate key on channel %d", channel );
-                    return -1;
-                }
-
-                /*  EnableSRTPReceive removed from webrtc
-                if(voeEncryption->EnableSRTPReceive(channel,
-                    webrtc::kCipherAes128CounterMode,
-                    WEBRTC_CIPHER_LENGTH,
-                    webrtc::kAuthNull, 0, 0, webrtc::kEncryption, key) != 0) {
-                    LOG_WEBRTC_ERROR( logTag, "rxStartAudio: voeVE_EnableSRTPReceive on channel %d failed", channel );
-                    memset(key, 0x00, sizeof(key));
-                    return -1;
-                }
-                */
-
-                memset(key, 0x00, sizeof(key));
-                break;
-            }  
-        }
-
-	    if (voeBase->StartReceive( channel ) == -1) {
-	    	LOG_WEBRTC_ERROR( logTag, "rxStartAudio: cannot start listen on channel %d", channel );
-	    	return -1;
-	    }
-
-	    LOG_WEBRTC_DEBUG( logTag, "rxStartAudio: Listening on channel %d", channel );
-
-		if (voeBase->StartPlayout( channel ) == -1) {
-			LOG_WEBRTC_ERROR( logTag, "rxStartAudio: cannot start playout on channel %d, stop listen", channel );
-			//voeBase->voeVE_StopListen( channel );
-		}
-
-		WebrtcAudioStreamPtr stream = getStream(streamId);
-		if(stream != NULL)
-			stream->isRxStarted = true;
-		LOG_WEBRTC_DEBUG( logTag, "rxStartAudio: Playing on channel %d", channel );
-		return 0;
-	}
-	else {
-		LOG_WEBRTC_ERROR( logTag, "rxStartAudio: getChannelForStreamId failed streamId %d",streamId );
-	}
-	return -1;
-}
-
-void WebrtcAudioProvider::rxClose( int groupId, int streamId ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "rxCloseAudio: groupId=%d, streamId=%d", groupId, streamId );
-	int channel = getChannelForStreamId( streamId );
-	if ( channel >= 0 ) {
-		WebrtcAudioStreamPtr stream = getStream(streamId);
-		if(stream != NULL)
-			stream->isRxStarted = false;
-		voeBase->StopPlayout( channel );
-		LOG_WEBRTC_DEBUG( logTag, "rxCloseAudio: Stop playout on channel %d", channel );
-	}
-}
-
-void WebrtcAudioProvider::rxRelease( int groupId, int streamId, int port )
-{
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "rxReleaseAudio: groupId=%d, streamId=%d", groupId, streamId );
-	int channel = getChannelForStreamId( streamId );
-	if ( channel >= 0 ) {
-		voeBase->StopReceive( channel );
-		voeBase->DeleteChannel( channel ); {
-			AutoLock lock(streamMapMutex);
-			streamMap.erase(streamId);
-		}
-		LOG_WEBRTC_DEBUG( logTag, "rxReleaseAudio: Delete channel %d, release port %d", channel, port);
-	}
-	else {
-		LOG_WEBRTC_ERROR( logTag, "rxReleaseAudio: getChannelForStreamId failed streamId %d",streamId );
-	}
-}
-
-const unsigned char m_iGQOSServiceType =0x00000003;
-
-int WebrtcAudioProvider::txStart( int groupId, int streamId, int payloadType, int packPeriod, bool vad, short tos,
-		char* remoteIpAddr, int remotePort, int rfc2833PayloadType, EncryptionAlgorithm algorithm, unsigned char* key, int keyLen,
-		unsigned char* salt, int saltLen, int mode, int party ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "txStartAudio: groupId=%d, streamId=%d", groupId, streamId);
-	int channel = getChannelForStreamId( streamId );
-	if ( channel >= 0 ) {
-		int dynamicPayloadType = -1;
-
-	    if (CHECK_DYNAMIC_PAYLOAD_TYPE(payloadType)) {
-	        dynamicPayloadType = EXTRACT_DYNAMIC_PAYLOAD_TYPE(payloadType);
-	        payloadType = CLEAR_DYNAMIC_PAYLOAD_TYPE(payloadType);
-	    }
-
-	    webrtc::CodecInst codec;
-
-		// select codec from payload type
-		if (codecSelector.select(payloadType, dynamicPayloadType, packPeriod, codec) != 0) {
-			LOG_WEBRTC_ERROR( logTag, "txStartAudio cannot select codec (payloadType=%d, packPeriod=%d)",
-					payloadType, packPeriod );
-			return -1;
-		}
-
-		// apply codec to channel
-		if (codecSelector.setSend(channel, codec,payloadType,vad) != 0) {
-			LOG_WEBRTC_ERROR( logTag, "txStartAudio cannot set send codec on channel=%d", channel );
-			 LOG_WEBRTC_ERROR( logTag, "VoEAudioProvider: Error: %d", voeBase->LastError() );
-			
-			return -1;
-		}
-
-        switch(algorithm) {
-            case EncryptionAlgorithm_NONE:
-                LOG_WEBRTC_DEBUG( logTag, "txStartAudio: using non-secure RTP for channel %d", channel);
-                break;
-
-            case EncryptionAlgorithm_AES_128_COUNTER: {
-                unsigned char key[WEBRTC_KEY_LENGTH];
-
-                LOG_WEBRTC_DEBUG( logTag, "txStartAudio: using secure RTP for channel %d", channel);
-
-                if(!provider->getKey(key, keyLen, salt, saltLen, key, sizeof(key))) {
-                    LOG_WEBRTC_ERROR( logTag, "txStartAudio: failed to generate key on channel %d", channel );
-                    return -1;
-                }
-
-                /*
-                if(voeEncryption->EnableSRTPSend(channel,
-                    webrtc::kCipherAes128CounterMode,
-                    WEBRTC_CIPHER_LENGTH,
-                    webrtc::kAuthNull, 0, 0, webrtc::kEncryption, key) != 0) {
-                    LOG_WEBRTC_ERROR( logTag, "txStartAudio:EnableSRTPSend on channel %d failed", channel );
-                    memset(key, 0x00, sizeof(key));
-                    return -1;
-                }
-				*/
-
-                memset(key, 0x00, sizeof(key));
-
-                break;
-            }  
-        }
-
-        unsigned char dscpSixBit = DSCPValue>>2;
-		voeBase->SetSendDestination( channel, remotePort, remoteIpAddr );
-#ifdef WIN32
-		if (IsVistaOrNewer()) {
-			LOG_WEBRTC_DEBUG( logTag, "Vista or later");
-			if(voeNetwork->SetSendTOS(channel, dscpSixBit, false ) == -1) {
-				LOG_WEBRTC_DEBUG( logTag, "openIngressChannel():voeVE_SetSendTOS() returned error");
-			}
-			LOG_WEBRTC_DEBUG( logTag, " Wrapper::openIngressChannel:- voeVE_SetSendTOS(), useSetSockOpt = false");
-		}
-		else {
-			if(voeNetwork->SetSendTOS(channel, dscpSixBit, true ) == -1) {
-				LOG_WEBRTC_DEBUG( logTag, "openIngressChannel():voeVE_SetSendTOS() returned error");
-			}
-			LOG_WEBRTC_DEBUG( logTag, "Wrapper::openIngressChannel:- voeVE_SetSendTOS(), useSetSockOpt = true");
-		}
-#else
-		voeNetwork->SetSendTOS(channel, dscpSixBit, -1, true );
-#endif
-		voeBase->StartSend( channel );
-		WebrtcAudioStreamPtr stream = getStream(streamId);
-		if(stream != NULL)
-			stream->isTxStarted = true;
-		LOG_WEBRTC_DEBUG( logTag, "txStartAudio: Sending to %s:%d on channel %d", remoteIpAddr, remotePort, channel );
-		return 0;
-	}
-	else {
-			LOG_WEBRTC_ERROR( logTag, "txStartAudio: getChannelForStreamId failed streamId %d",streamId );
-			return -1;
-	}
-}
-
-void WebrtcAudioProvider::txClose( int groupId, int streamId ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "txCloseAudio: groupId=%d, streamId=%d", groupId, streamId);
-	int channel = getChannelForStreamId( streamId );
-	if ( channel >= 0 ) {
-		WebrtcAudioStreamPtr stream = getStream(streamId);
-		if(stream != NULL)
-			stream->isTxStarted = false;
-		voeBase->StopSend( channel );
-		LOG_WEBRTC_DEBUG( logTag, "txCloseAudio: Stop transmit on channel %d", channel );
-	}
-	else {
-		LOG_WEBRTC_ERROR( logTag, "txClose: getChannelForStreamId failed streanId %d",streamId );
-
-	}
-}
-
-int WebrtcAudioProvider::toneStart( ToneType type, ToneDirection direction, int alertInfo, int groupId, int streamId, bool useBackup ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "mediaToneStart: tone=%d, direction=%d, groupId=%d, streamId=%d", type, direction, groupId, streamId );
-	if(toneGen != NULL) {
-		LOG_WEBRTC_INFO( logTag, "mediaToneStart: tone already in progress - stop current tone [using dodgy parameters] and replace it." );
-		toneStop(type, groupId, streamId);
-	}
-	toneGen = new WebrtcToneGenerator( type );
-	voeBase->StartPlayout( localToneChannel );
-	voeFile->StartPlayingFileLocally( localToneChannel, toneGen, webrtc::kFileFormatPcm8kHzFile);
-	return 0;
-}
-
-int WebrtcAudioProvider::toneStop( ToneType type, int groupId, int streamId ) {
-	//AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "mediaToneStop: tone=%d, groupId=%d, streamId=%d", type, groupId, streamId );
-	if ( voeFile->IsPlayingFileLocally( localToneChannel ) == 1 ) {
-		voeBase->StopPlayout( localToneChannel );
-		voeFile->StopPlayingFileLocally( localToneChannel );
-	}
-	delete toneGen;
-	toneGen = NULL;
-	return 0;
-}
-
-int WebrtcAudioProvider::ringStart( int lineId, RingMode mode, bool once )
-{
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "mediaRingStart: line=%d, mode=%d, once=%d", lineId, mode, once );
-	if(ringGen != NULL) {
-		LOG_WEBRTC_INFO( logTag, "mediaRingStart: ringing already in progress - do nothing." );
-		return 0;
-	}
-	ringGen = new WebrtcRingGenerator( mode, once );
-	ringGen->SetScaleFactor(ringerVolume);
-	voeBase->StartPlayout( localRingChannel );
-	voeFile->StartPlayingFileLocally( localRingChannel, ringGen, webrtc::kFileFormatPcm8kHzFile);
-	return 0;
-}
-
-int WebrtcAudioProvider::ringStop( int lineId ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "mediaRingStop: line=%d", lineId );
-	if ( voeFile->IsPlayingFileLocally( localRingChannel ) == 1 ) {
-		voeBase->StopPlayout( localRingChannel );
-		voeFile->StopPlayingFileLocally( localRingChannel );
-	}
-	delete ringGen;
-	ringGen = NULL;
-	return 0;
-}
-
-int WebrtcAudioProvider::sendDtmf( int streamId, int digit) {
-	AutoLock lock(m_lock);
-
-	int rfc2833Payload=101;
-    int channel = getChannelForStreamId( streamId );
-	
-	if(channel >= 0) {
-		voeDTMF->SetDtmfFeedbackStatus(true);
-		voeDTMF->SetSendTelephoneEventPayloadType(channel, rfc2833Payload); // Need to get rfc2833Payload
-		voeDTMF->SendTelephoneEvent(channel, digit);
-		return 0;
-	}
-    else {
-    	LOG_WEBRTC_INFO( logTag, "sendDtmf() failed to map stream to channel");
-    }
-
-	return -1;
-}
-
-// returns -1 on failure
-bool WebrtcAudioProvider::mute( int streamId, bool mute )
-{
-	AutoLock lock(m_lock);
-    LOG_WEBRTC_INFO( logTag, "audio mute: streamId=%d, mute=%d", streamId, mute );
-    int channel = getChannelForStreamId( streamId );
-    bool returnVal = false;
-
-    if ( channel >= 0 ) {
-		if (voeVolumeControl->SetInputMute(channel, mute) != -1) {
-			returnVal= true;
-		}
-		else {
-			LOG_WEBRTC_INFO( logTag, "mute returned failure from SetInputMute");
-		}
-    }
-    else {
-    	LOG_WEBRTC_INFO( logTag, "failed to map stream to channel");
-    }
-    return returnVal;
-}
-
-bool WebrtcAudioProvider::isMuted( int streamId ) {
-	AutoLock lock(m_lock);
-	bool mute=false;
-
-	voeVolumeControl->GetInputMute(getChannelForStreamId(streamId), mute);
-	return mute;
-}
-
-bool WebrtcAudioProvider::setDefaultVolume( int volume ) {
-	AutoLock lock(m_lock);
-	defaultVolume = volume;
-    return true;
-}
-
-int WebrtcAudioProvider::getDefaultVolume() {
-	AutoLock lock(m_lock);
-    return defaultVolume;
-}
-
-bool WebrtcAudioProvider::setRingerVolume( int volume ) {
-	AutoLock lock(m_lock);
-	LOG_WEBRTC_INFO( logTag, "setRingerVolume: volume=%d", volume );
-	if (voeVolumeControl->SetChannelOutputVolumeScaling(localRingChannel, volume * 0.01f) != -1) {
-		ringerVolume = volume;
-		if(ringGen != NULL) {
-			ringGen->SetScaleFactor(ringerVolume);
-		}
-		return true;
-	}
-	else {
-		LOG_WEBRTC_INFO( logTag, "setRingerVolume() returned failure from SetChannelOutputVolumeScaling");
-		return false;
-	}
-}
-
-int WebrtcAudioProvider::getRingerVolume() {
-	AutoLock lock(m_lock);
-    return ringerVolume;
-}
-
-bool WebrtcAudioProvider::setVolume( int streamId, int volume ) {
-	LOG_WEBRTC_INFO( logTag, "setVolume: streamId=%d, volume=%d", streamId, volume );
-	int channel = getChannelForStreamId( streamId );
-	bool returnVal = false;
-
-	if ( channel >= 0 ) {
-		// Input is scaled 0-100.  voe scale is 0.0f - 1.0f.  (Larger values are allowable but liable to distortion)
-		if (voeVolumeControl->SetChannelOutputVolumeScaling(channel, volume * 0.01f) != -1) {
-			returnVal = true;
-		}
-		else {
-			LOG_WEBRTC_INFO( logTag, "setVolume() retuned failure from SetChannelOutputVolumeScaling");
-		}
-	}
-	else {
-		LOG_WEBRTC_INFO( logTag, "failed to map stream to channel");
-	}
-	return returnVal;
-}
-
-int  WebrtcAudioProvider::getVolume( int streamId ) {
-	AutoLock lock(m_lock);
-	float voeVolume = 0;
-
-	if(voeVolumeControl->GetChannelOutputVolumeScaling(getChannelForStreamId(streamId), voeVolume) != -1) {
-		// Output is scaled 0-100.  voe scale is 0.0f - 1.0f.
-		float volume = voeVolume * 100.0f; // Scale to 0-100 for presentation.
-		return (int)(volume + 0.5f);		// And round neatly.
-	}
-	else {
-		LOG_WEBRTC_INFO( logTag, "getVolume retuned failure from GetChannelOutputVolumeScaling");
-		return -1;
-	}
-}
-
-// voeVoiceEngineObserver
-void WebrtcAudioProvider::Print(const webrtc::TraceLevel level, const char* message, const int length) {
-	if (strstr(message, "eventNumber=") != NULL || strstr(message, "DTMF event ") != NULL)
-		return;
-}
-
-void WebrtcAudioProvider::CallbackOnError(const int errCode, const int channel) {
-	LOG_WEBRTC_ERROR( logTag, "CallbackOnError() ERROR %d on channel %d", errCode, channel );
-}
-
-void WebrtcAudioProvider::OnPeriodicDeadOrAlive(int channel, bool isAlive) {
-	WebrtcAudioStreamPtr stream = getStreamByChannel(channel);
-	if(stream != NULL && (stream->isRxStarted || stream->isTxStarted)) {
-		if(stream->isAlive != isAlive) {
-			LOG_WEBRTC_INFO( logTag, "voe channel %d is %s", channel, (isAlive ? "alive" : "dead") );
-			stream->isAlive = isAlive;
-			// TODO should use postEvent and rely on Engine to drive dispatch.
-/*			Component::Event event;
-			event.component = provider;
-			event.context = (void*)stream->callId;
-			stream->isAlive = isAlive;
-			if(isAlive)
-				event.id = eMediaRestored;
-			else
-				event.id = eMediaLost;
-			provider->dispatchEvent( event );
-*/
-		}
-	}
-}
-#ifdef WIN32 
-bool IsUserAdmin() {
-	BOOL bAdm = TRUE;
-	SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
-	PSID AdministratorsGroup; 
-	bAdm = AllocateAndInitializeSid(
-									&NtAuthority,
-									2,
-									SECURITY_BUILTIN_DOMAIN_RID,
-									DOMAIN_ALIAS_RID_ADMINS,
-									0, 0, 0, 0, 0, 0,
-									&AdministratorsGroup);
-	if(bAdm)  {
-		if (!CheckTokenMembership( NULL, AdministratorsGroup, &bAdm)) {
-			bAdm = FALSE;
-		} 
-		//Free the memory for PSID structure;
-		FreeSid(AdministratorsGroup); 
-	}
-	return (bAdm == TRUE);
-}
-
-bool IsVistaOrNewer()
-{
-    OSVERSIONINFOEX osVersion;
-	ZeroMemory(&osVersion, sizeof(OSVERSIONINFOEX));
-    osVersion.dwOSVersionInfoSize   = sizeof(osVersion);
-
-    if (GetVersionEx((LPOSVERSIONINFO)&osVersion)) {
-
-        // Determine if this is Windows Vista or newer
-        if (osVersion.dwMajorVersion >= 6) {
-            // Vista
-            return TRUE;
-        }
-    } 
-
-	//Lets proceed with XP as OS.
-    return FALSE;
-}
-#endif
-} // namespace CSF
-
-#endif
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcAudioProvider.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef WebrtcAUDIOMEDIAPROVIDER_H_
-#define WebrtcAUDIOMEDIAPROVIDER_H_
-
-#ifndef _USE_CPVE
-
-#include "csf_common.h"
-#include "CSFAudioControl.h"
-#include "CSFAudioTermination.h"
-#include "WebrtcAudioCodecSelector.h"
-
-#include "voe_base.h"
-#include "voe_file.h"
-#include "voe_hardware.h"
-#include "voe_dtmf.h"
-#include "voe_network.h"
-#include "voe_audio_processing.h"
-#include "voe_volume_control.h"
-#include "voe_encryption.h"
-#include <string>
-#include <map>
-#include "base/lock.h"
-
-
-namespace CSF
-{
-    class WebrtcMediaProvider;
-    class WebrtcToneGenerator;
-    class WebrtcRingGenerator;
-    class WebrtcAudioStream;
-    class WebrtcVideoProvider;
-    DECLARE_PTR(WebrtcAudioStream);
-
-    class WebrtcAudioProvider : public AudioControl, AudioTermination, webrtc::VoiceEngineObserver,
-            webrtc::VoEConnectionObserver
-            ,webrtc::TraceCallback {
-    friend class WebrtcVideoProvider;
-
-    public:
-
-        WebrtcAudioProvider( WebrtcMediaProvider* provider );
-
-        // destructor
-        ~WebrtcAudioProvider();
-
-        // initialize members and Webrtc API
-        // return 0 if initialzation succeeded
-        int init();
-
-        // AudioControl
-        AudioControl* getAudioControl() { return this; }
-
-        std::vector<std::string> getRecordingDevices();
-        std::vector<std::string> getPlayoutDevices();
-
-        std::string getRecordingDevice() { return recordingDevice; }
-        std::string getPlayoutDevice() { return playoutDevice; }
-
-        bool setRecordingDevice( const std::string& name );
-        bool setPlayoutDevice( const std::string& name );
-
-        bool setDefaultVolume( int volume );
-        int getDefaultVolume();
-
-        bool setRingerVolume( int volume );
-        int getRingerVolume();
-
-        bool setVolume( int streamId, int volume );
-        int  getVolume( int streamId );
-
-        AudioTermination * getAudioTermination() { return this; }
-
-        int  getCodecList( CodecRequestType requestType );
-
-        int  rxAlloc    ( int groupId, int streamId, int requestedPort );
-        void setLocalIP    ( const char* addr ) { localIP = addr; }
-        int  rxOpen        ( int groupId, int streamId, int requestedPort, int listenIp, bool isMulticast );
-        int  rxStart    ( int groupId, int streamId, int payloadType, int packPeriod, int localPort, int rfc2833PayloadType,
-                                EncryptionAlgorithm algorithm, unsigned char* key, int keyLen, unsigned char* salt, int saltLen, int mode, int party );
-        void rxClose    ( int groupId, int streamId);
-        void rxRelease    ( int groupId, int streamId, int port );
-        int  txStart    ( int groupId, int streamId, int payloadType, int packPeriod, bool vad, short tos,
-                                char* remoteIpAddr, int remotePort, int rfc2833PayloadType, EncryptionAlgorithm algorithm,
-                                unsigned char* key, int keyLen, unsigned char* salt, int saltLen, int mode, int party );
-        void txClose    ( int groupId, int streamId);
-
-        int  toneStart    ( ToneType type, ToneDirection direction, int alertInfo, int groupId, int streamId, bool useBackup );
-        int  toneStop    ( ToneType type, int groupId, int streamId);
-        int  ringStart    ( int lineId, RingMode mode, bool once );
-        int  ringStop    ( int lineId );
-        int  sendDtmf    ( int streamId, int digit);
-        bool  mute        ( int streamId, bool mute );
-        bool isMuted    ( int streamId );
-        void setMediaPorts( int startPort, int endPort ) { this->startPort = startPort; this->endPort = endPort; }
-        void setDSCPValue (int value){this->DSCPValue = value;}
-        void setVADEnabled(bool VADEnabled){this->VADEnabled = VADEnabled;}
-
-        // used by video, for lip sync
-        webrtc::VoiceEngine* getVoiceEngine() { return voeVoice; }
-
-    protected:
-        // WebrtcVoiceEngineObserver
-        void CallbackOnError(const int errCode, const int channel);
-        void Print(const webrtc::TraceLevel level, const char* message, const int length);
-        // WebrtcVEConnectionObserver
-        void OnPeriodicDeadOrAlive(int channel, bool alive);
-
-        int getChannelForStreamId( int streamId );
-        WebrtcAudioStreamPtr getStream( int streamId );
-        WebrtcAudioStreamPtr getStreamByChannel( int channelId );
-
-    private:
-        WebrtcMediaProvider* provider;
-        webrtc::VoiceEngine* voeVoice;
-        webrtc::VoEBase* voeBase;
-        webrtc::VoEFile* voeFile;
-        webrtc::VoEHardware* voeHw;
-        webrtc::VoEDtmf* voeDTMF;
-        webrtc::VoENetwork* voeNetwork;
-        webrtc::VoEVolumeControl* voeVolumeControl;
-        webrtc::VoEAudioProcessing* voeVoiceQuality; 
-        webrtc::VoEEncryption* voeEncryption;
-        int localToneChannel;
-        int localRingChannel;
-        std::string recordingDevice;
-        std::string playoutDevice;
-        std::map<int, int> streamToChannel;
-        std::map<int, WebrtcAudioStreamPtr> streamMap;
-        WebrtcToneGenerator* toneGen;    // temporary, need to manage multiple tones
-        WebrtcRingGenerator* ringGen;    // temporary, need to use audio device directly
-        std::string localIP;
-        int startPort;
-        int endPort;
-        int defaultVolume;  // Range 0-100
-        int ringerVolume;   // Range 0-100
-        int DSCPValue;
-        bool VADEnabled;
-
-        WebrtcAudioCodecSelector codecSelector;
-
-        // Synchronisation (to avoid data corruption and worse given that so many threads call the media provider)
-        // Never use this mutex in a callback from Webrtc - high probability of deadlock.
-
-        Lock m_lock;
-        // This mutex is to be held only for the narrowest possible scope while accessing the stream map
-        // (but not while inspecting or changing a stream object).
-        // Might be used in northbound and southbound calls.
-        Lock streamMapMutex;
-        bool stopping;
-    };
-    const unsigned short targetLeveldBOvdefault =3 ;
-    const unsigned short digitalCompressionGaindBdefault =9;
-    const bool limiterEnableon = true;
-} // namespace
-
-#endif
-#endif /* WebrtcAUDIOMEDIAPROVIDER_H_ */
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcLogging.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _CSF_WEBRTC_LOGGING_H
-#define _CSF_WEBRTC_LOGGING_H
-
-#include "CSFLog.h"
-#include <stdarg.h>
-
-
-#ifndef _USE_CPVE
-
-extern bool g_IncludeWebrtcLogging;
-
-enum log_level {GERROR, GWARNING, GINFO, GDEBUG};
-
-#define LOG_WEBRTC_ERROR CSFLogError
-#define LOG_WEBRTC_WARN  CSFLogWarn
-#define LOG_WEBRTC_INFO  CSFLogInfo
-#define LOG_WEBRTC_DEBUG CSFLogDebug
-
-#endif
-#endif
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcMediaProvider.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _USE_CPVE
-
-#include "CC_Common.h"
-
-#ifdef LINUX
-#include "X11/Xlib.h"
-#endif
-
-#include "WebrtcMediaProvider.h"
-#include "WebrtcAudioProvider.h"
-#ifndef NO_WEBRTC_VIDEO
-#include "WebrtcVideoProvider.h"
-#endif
-#include "WebrtcLogging.h"
-
-using namespace std;
-
-#if (defined (_MSC_VER) && defined (_DEBUG))
-/**
- * Workaround to allow the use of mixed debug & release code
- * since the Webrtc library is release only, but we still want debug projects
- * to test our own stuff. This symbol is missing from the debug crt library.
- */
-extern "C" __declspec(dllexport) void __cdecl _invalid_parameter_noinfo(void) {  }
-#endif /* (defined (_MSC_VER) && defined (_DEBUG)) */
-
-bool g_IncludeWebrtcLogging=false;
-
-static const char* logTag = "WebrtcMediaProvider";
-
-namespace CSF {
-
-// Public interface class
-
-MediaProvider::~MediaProvider()
-{
-}
-
-// static
-MediaProvider * MediaProvider::create( )
-{
-    LOG_WEBRTC_DEBUG( logTag, "MediaProvider::create");
-
-    WebrtcMediaProvider* mediaProvider = new WebrtcMediaProvider();
-    LOG_WEBRTC_DEBUG( logTag, "MediaProvider::create new instance");
-
-    if ( mediaProvider->init() != 0)
-    {
-        LOG_WEBRTC_ERROR( logTag, "cannot initialize WebrtcMediaProvider");
-        delete mediaProvider;
-        return NULL;
-    }
-
-    return mediaProvider;
-}
-
-// Implementation classes
-
-WebrtcMediaProvider::WebrtcMediaProvider( )
-{
-    pAudio = new WebrtcAudioProvider( this );
-    if (pAudio->init() != 0)
-    {
-        LOG_WEBRTC_ERROR( logTag, "Error calling pAudio->Init in WebrtcMediaProvider");
-    }
-
-    // for the moment, we only have video lib for windows
-#ifndef NO_WEBRTC_VIDEO
-    pVideo = new WebrtcVideoProvider( this );
-#else
-    pVideo = NULL;
-#endif
-}
-
-WebrtcMediaProvider::~WebrtcMediaProvider()
-{
-#ifndef NO_WEBRTC_VIDEO
-    delete pVideo;
-#endif
-    delete pAudio;
-}
-
-int WebrtcMediaProvider::init()
-{
-#ifndef NO_WEBRTC_VIDEO
-    if (pVideo->init() != 0)
-    {
-        return -1;
-    }
-#endif
-
-    return 0;
-}
-
-void WebrtcMediaProvider::shutdown()
-{
-}
-
-void WebrtcMediaProvider::addMediaProviderObserver( MediaProviderObserver* observer )
-{
-    // just add all the events at once
-    /*
-    componentImpl->addObserver( eVideoModeChanged, observer);
-    componentImpl->addObserver( eKeyFrameRequest, observer);
-    componentImpl->addObserver( eMediaLost, observer);
-    componentImpl->addObserver( eMediaRestored, observer);
-    */
-}
-
-/*
-void WebrtcMediaProvider::dispatchEvent(Event event)
-{
-    ComponentImpl::ObserverMapRange range = componentImpl->observerMapRangeForEventID(event.id);
-
-    for (ComponentImpl::ObserverMapIterator it = range.first; it != range.second; it++)
-    {
-        switch (event.id)
-        {
-        case eVideoModeChanged:
-            LOG_Webrtc_DEBUG( logTag, "Dispatching eVideoMode");
-            ((MediaProviderObserver*)(*it).second)->onVideoModeChanged( event.context != 0 );
-            break;
-
-        case eKeyFrameRequest:
-            LOG_Webrtc_DEBUG( logTag, "Dispatching eKeyFrameRequest");
-            ((MediaProviderObserver*)(*it).second)->onKeyFrameRequested( (long)event.context );
-            break;
-
-        case eMediaLost:
-            LOG_Webrtc_DEBUG( logTag, "Dispatching eMediaLost");
-            ((MediaProviderObserver*)(*it).second)->onMediaLost( (long)event.context );
-            break;
-
-        case eMediaRestored:
-            LOG_Webrtc_DEBUG( logTag, "Dispatching eMediaRestored");
-            ((MediaProviderObserver*)(*it).second)->onMediaRestored( (long)event.context );
-            break;
-
-        default:
-            CSFAssert(false, "Bad event id passed to WebrtcMediaProvider: %d", event.id);
-            break;
-        }
-    }
-}
-
-CSFComponentRole WebrtcMediaProvider::getRole() const
-{
-    return kCSFMediaProvider_ComponentRole;
-}
-
-*/
-
-AudioControl* WebrtcMediaProvider::getAudioControl()
-{
-    return pAudio ? pAudio->getAudioControl() : NULL;
-}
-
-VideoControl* WebrtcMediaProvider::getVideoControl()
-{
-#ifndef NO_WEBRTC_VIDEO
-    return pVideo ? pVideo->getMediaControl() : NULL;
-#else
-    return NULL;
-#endif
-}
-
-webrtc::VoiceEngine* WebrtcMediaProvider::getWebrtcVoiceEngine () {
-    return ((pAudio != NULL) ? pAudio->getVoiceEngine() : NULL);
-}
-
-AudioTermination* WebrtcMediaProvider::getAudioTermination()
-{
-    return pAudio ? pAudio->getAudioTermination() : NULL;
-}
-
-VideoTermination* WebrtcMediaProvider::getVideoTermination()
-{
-#ifndef NO_WEBRTC_VIDEO
-    return pVideo ? pVideo->getMediaTermination() : NULL;
-#else
-    return NULL;
-#endif
-}
-
-bool WebrtcMediaProvider::getKey(
-    const unsigned char* masterKey, 
-    int masterKeyLen, 
-    const unsigned char* masterSalt, 
-    int masterSaltLen,
-    unsigned char* key,
-    unsigned int keyLen
-    )
-{
-    LOG_WEBRTC_DEBUG( logTag, "getKey() masterKeyLen = %d, masterSaltLen = %d", masterKeyLen, masterSaltLen);
-
-    if(masterKey == NULL || masterSalt == NULL)
-    {
-        LOG_WEBRTC_ERROR( logTag, "getKey() masterKey or masterSalt is NULL");
-        return false;
-    }
-
-    if((masterKeyLen != WEBRTC_MASTER_KEY_LENGTH) || (masterSaltLen != WEBRTC_MASTER_SALT_LENGTH))
-    {
-        LOG_WEBRTC_ERROR( logTag, "getKey() invalid masterKeyLen or masterSaltLen length");
-        return false;
-    }
-
-    if((key == NULL) || (keyLen != WEBRTC_KEY_LENGTH))
-    {
-        LOG_WEBRTC_ERROR( logTag, "getKey() invalid key or keyLen");
-        return false;
-    }
-
-    memcpy(key, masterKey, WEBRTC_MASTER_KEY_LENGTH);
-    memcpy(key + WEBRTC_MASTER_KEY_LENGTH, masterSalt, WEBRTC_MASTER_SALT_LENGTH);
-
-    return true;
-}
-
-} // namespace CSF
-
-#endif
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcMediaProvider.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef WebrtcMEDIAPROVIDER_H_
-#define WebrtcMEDIAPROVIDER_H_
-
-#ifndef _USE_CPVE
-
-#include <CSFMediaProvider.h>
-#include "voe_base.h"
-#include <string>
-
-
-namespace CSF
-{
-	enum	// Event ids
-	{
-		eVideoModeChanged,
-		eKeyFrameRequest,
-		eMediaLost,
-		eMediaRestored
-	};
-
-// Master key is 128 bits, master salt 112 bits.
-#define WEBRTC_MASTER_KEY_LENGTH      16
-#define WEBRTC_MASTER_SALT_LENGTH     14
-#define WEBRTC_KEY_LENGTH             (WEBRTC_MASTER_KEY_LENGTH + WEBRTC_MASTER_SALT_LENGTH)
-#define WEBRTC_CIPHER_LENGTH          WEBRTC_KEY_LENGTH
-
-	class WebrtcAudioProvider;
-	class WebrtcVideoProvider;
-
-	class WebrtcMediaProvider : public MediaProvider
-	{
-		friend class MediaProvider;
-        friend class WebrtcVideoProvider;
-        friend class WebrtcAudioProvider;
-
-	protected:
-		WebrtcMediaProvider( );
-		~WebrtcMediaProvider();
-
-		int init();
-		virtual void shutdown();
-
-		AudioControl* getAudioControl();
-		VideoControl* getVideoControl();
-		AudioTermination* getAudioTermination();
-		VideoTermination* getVideoTermination();
-		void addMediaProviderObserver( MediaProviderObserver* observer );
-
-        bool getKey(
-            const unsigned char* masterKey, 
-            int masterKeyLen, 
-            const unsigned char* masterSalt, 
-            int masterSaltLen,
-            unsigned char* key,
-            unsigned int keyLen
-            );
-
-	private:
-		WebrtcAudioProvider* pAudio;
-		WebrtcVideoProvider* pVideo;
-
-        webrtc::VoiceEngine * getWebrtcVoiceEngine ();
-	};
-
-} // namespace
-
-#endif
-#endif /* WebrtcMEDIAPROVIDER_H_ */
deleted file mode 100644
--- a/media/webrtc/signaling/src/media/webrtc/WebrtcRingGenerator.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Cisco Systems SIP Stack.
- *
- * The Initial Developer of the Original Code is
- * Cisco Systems (CSCO).
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Enda Mannion <emannion@cisco.com>
- *  Suhas Nandakumar <snandaku@cisco.com>
- *  Ethan Hugg <ehugg@cisco.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _USE_CPVE
-
-#include <string.h>
-#include "WebrtcRingGenerator.h"
-
-namespace CSF {
-
-/*
- * 480 samples of 16-bit, 8kHz linear PCM ring tone,
- * for a total duration of 60 milliseconds.
- * Repeat as directed.
- */
-static short Ring1[480] =
-{
-     0,      0,      0,   -112,    988,   1564,  -1564,  -3260,
-  -180,   -104,  -4860,  -3004,   5628,   5628,   -876,   2236,
-  9340,   1308, -10876,  -5884,   1980,  -6652, -12412,   3644,
- 14972,   3772,  -1564,  12924,  12924, -10876, -17788,   -372,
- -1372, -19836,  -9340,  18812,  15484,  -2620,   6652,  21884,
-  1436, -21884,  -9852,   3260, -12412, -19836,   6908,  21884,
-  4348,  -1564,  17788,  14972, -13948, -18812,    180,  -2364,
--20860,  -8316,  19836,  14460,  -2876,   7676,  20860,      8,
--21884,  -8828,   3132, -13436, -18812,   8316,  21884,   3516,
- -1052,  17788,  13948, -15484, -18812,    780,  -3132, -20860,
- -6908,  19836,  13436,  -3132,   8316,  20860,  -1436, -21884,
- -7932,   3004, -13948, -18812,   9340,  20860,   2620,   -460,
- 18812,  12924, -15996, -17788,   1308,  -4092, -20860,  -5372,
- 20860,  12924,  -3260,   9340,  20860,  -2876, -21884,  -7164,
-  2748, -14972, -17788,  10876,  20860,   1884,    164,  18812,
- 11900, -16764, -16764,   1820,  -4860, -20860,  -4092,  20860,
- 11900,  -3388,  10364,  20860,  -4348, -21884,  -6140,   2364,
--15996, -16764,  11900,  19836,   1116,    844,  19836,  10364,
--17788, -16764,   2236,  -5884, -20860,  -2748,  21884,  10876,
- -3388,  11388,  19836,  -5628, -21884,  -5116,   1980, -16764,
--15996,  13436,  19836,    428,   1564,  19836,   9340, -18812,
--15484,   2620,  -6652, -20860,  -1244,  19836,   8828,  -2748,
-  9852,  15484,  -5116, -15484,  -3004,    924, -10876,  -8828,
-  7932,  10364,    -56,   1180,   8828,   3260,  -7164,  -4860,
-   812,  -2236,  -5372,      0,   4092,   1372,   -308,   1244,
-  1180,   -212,     72,     -8,      0,      0,      0,      0,
-				/* remainder is all zeroes */
-};
-
-typedef struct
-{
-	short*	samples;
-	int		sampleCnt;
-	int		stepDuration;	// milliseconds, replay samples as needed
-
-} RingCadence;
-
-#ifndef min
-#define min(a, b)  (((a) < (b)) ? (a) : (b))
-#endif
-
-#define MILLIS_TO_SAMPLES(millis)	((millis) * (8000/1000))
-#define SAMPLES_TO_MILLIS(samples)	((samples) / (8000/1000))
-
-#define SILENCE NULL
-
-static RingCadence INSIDE_RING[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 1020 },
-	{ SILENCE, 0, 3000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence OUTSIDE_RING[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 420 },
-	{ SILENCE, 0, 200 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 420 },
-	{ SILENCE, 0, 3000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence FEATURE_RING[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 240 },
-	{ SILENCE, 0, 150 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 120 },
-	{ SILENCE, 0, 150 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 360 },
-	{ SILENCE, 0, 3000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence BELLCORE_DR1[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 1980 },
-	{ SILENCE, 0, 4000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence BELLCORE_DR2[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 780 },
-	{ SILENCE, 0, 400 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 780 },
-	{ SILENCE, 0, 4000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence BELLCORE_DR3[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 420 },
-	{ SILENCE, 0, 200 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 300 },
-	{ SILENCE, 0, 200 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 780 },
-	{ SILENCE, 0, 4000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence BELLCORE_DR4[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 300 },
-	{ SILENCE, 0, 200 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 1020 },
-	{ SILENCE, 0, 200 },
-	{ Ring1, sizeof(Ring1)/sizeof(short), 300 },
-	{ SILENCE, 0, 4000 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence BELLCORE_DR5[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 480 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence FLASHONLY_RING[] =
-{
-	{ NULL, 0, 0 }
-};
-
-static RingCadence PRECEDENCE_RING[] =
-{
-	{ Ring1, sizeof(Ring1)/sizeof(short), 1680 },
-	{ SILENCE, 0, 360 },
-	{ NULL, 0, 0 }
-};
-
-static RingCadence* CadenceTable[] =
-{
-	// Must remain in sync with RingMode in CSFMediaTermination.h
-
-	&INSIDE_RING[0],
-    &OUTSIDE_RING[0],
-    &FEATURE_RING[0],
-    &BELLCORE_DR1[0],
-    &BELLCORE_DR2[0],
-    &BELLCORE_DR3[0],
-    &BELLCORE_DR4[0],
-    &BELLCORE_DR5[0],
-    &FLASHONLY_RING[0],
-    &PRECEDENCE_RING[0]
-};
-
-// ----------------------------------------------------------------------------
-WebrtcRingGenerator::WebrtcRingGenerator( RingMode mode, bool once )
-: mode(mode), once(once), currentStep(0), done(false), scaleFactor(100)
-{
-	timeRemaining = CadenceTable[mode]->stepDuration;
-	// if sole entry is empty (FLASHONLY_RING case), generate no samples
-	if ( timeRemaining == 0 ) done = true;
-}
-
-void WebrtcRingGenerator::SetScaleFactor(int scaleFactor)
-{
-	this->scaleFactor = scaleFactor;
-}
-
-// Webrtc InStream implementation
-int WebrtcRingGenerator::Read( void *buf, int len /* bytes */ )
-{
-	int result = generateTone( (short *)buf, len/sizeof(short) );
-	applyScaleFactor( (short *)buf, len/sizeof(short) );
-	return result;
-}
-
-int WebrtcRingGenerator::generateTone( short *buf, int numSamples )
-{
-	RingCadence* cadence = CadenceTable[mode];
-	int samplesGenerated = 0;
-
-	while ( !done && samplesGenerated < numSamples )
-	{