diff --git a/cmake/FindWebRTC.cmake b/cmake/FindWebRTC.cmake index 579f71efe..f3fa1f24f 100644 --- a/cmake/FindWebRTC.cmake +++ b/cmake/FindWebRTC.cmake @@ -153,6 +153,10 @@ if(WEBRTC_INCLUDE_DIR) set(WEBRTC_DEPENDENCIES Secur32.lib Winmm.lib msdmo.lib dmoguids.lib wmcodecdspuuid.lib) # strmbase.lib elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") add_definitions(-DWEBRTC_POSIX) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + add_compile_definitions(WEBRTC_POSIX) + add_compile_definitions(WEBRTC_MAC) + # For ABI compatability between precompiled WebRTC libraries using clang and new GCC versions add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) diff --git a/src/av/src/apple/avfoundation.mm b/src/av/src/apple/avfoundation_mm similarity index 100% rename from src/av/src/apple/avfoundation.mm rename to src/av/src/apple/avfoundation_mm diff --git a/src/webrtc/include/scy/webrtc/audiopacketmodule.h b/src/webrtc/include/scy/webrtc/audiopacketmodule.h index 50c41577d..bf3de646f 100644 --- a/src/webrtc/include/scy/webrtc/audiopacketmodule.h +++ b/src/webrtc/include/scy/webrtc/audiopacketmodule.h @@ -22,10 +22,11 @@ #include "scy/av/packet.h" #include "scy/packetsignal.h" -#include "rtc_base/basictypes.h" -#include "rtc_base/criticalsection.h" -#include "rtc_base/messagehandler.h" -#include "rtc_base/scoped_ref_ptr.h" +// #include "rtc_base/basictypes.h" +#include "rtc_base/critical_section.h" +#include "rtc_base/message_handler.h" +// #include "rtc_base/scoped_ref_ptr.h" +#include "base/memory/scoped_refptr.h" #include "rtc_base/thread.h" #include "common_types.h" #include "modules/audio_device/include/audio_device.h" diff --git a/src/webrtc/include/scy/webrtc/fakeaudiodevicemodule.h b/src/webrtc/include/scy/webrtc/fakeaudiodevicemodule.h index 579b10c2c..9d99971c7 100644 --- a/src/webrtc/include/scy/webrtc/fakeaudiodevicemodule.h +++ b/src/webrtc/include/scy/webrtc/fakeaudiodevicemodule.h @@ -13,10 +13,11 @@ #include "scy/base.h" -#include "rtc_base/basictypes.h" -#include "rtc_base/criticalsection.h" -#include "rtc_base/messagehandler.h" -#include "rtc_base/scoped_ref_ptr.h" +// #include "rtc_base/basictypes.h" +#include "rtc_base/critical_section.h" +#include "rtc_base/message_handler.h" +// #include "rtc_base/scoped_ref_ptr.h" +#include "base/memory/scoped_refptr.h" #include "rtc_base/thread.h" #include "common_types.h" #include "modules/audio_device/include/audio_device.h" diff --git a/src/webrtc/include/scy/webrtc/multiplexmediacapturer.h b/src/webrtc/include/scy/webrtc/multiplexmediacapturer_h similarity index 100% rename from src/webrtc/include/scy/webrtc/multiplexmediacapturer.h rename to src/webrtc/include/scy/webrtc/multiplexmediacapturer_h diff --git a/src/webrtc/include/scy/webrtc/peer.h b/src/webrtc/include/scy/webrtc/peer.h index 7add12f08..0f714060a 100644 --- a/src/webrtc/include/scy/webrtc/peer.h +++ b/src/webrtc/include/scy/webrtc/peer.h @@ -16,9 +16,9 @@ #include "scy/webrtc/peerfactorycontext.h" #include "api/jsep.h" -#include "api/peerconnectioninterface.h" -#include "api/test/fakeconstraints.h" -#include "p2p/client/basicportallocator.h" +#include "api/peer_connection_interface.h" +#include "sdk/media_constraints.h" +#include "p2p/client/basic_port_allocator.h" namespace scy { @@ -77,7 +77,7 @@ class Peer : public webrtc::PeerConnectionObserver, std::string peerid() const; std::string token() const; - webrtc::FakeConstraints& constraints(); + webrtc::MediaConstraints& constraints(); webrtc::PeerConnectionFactoryInterface* factory() const; rtc::scoped_refptr peerConnection() const; rtc::scoped_refptr stream() const; @@ -97,7 +97,7 @@ class Peer : public webrtc::PeerConnectionObserver, /// inherited from CreateSessionDescriptionObserver virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc) override; - virtual void OnFailure(const std::string& error) override; + virtual void OnFailure(webrtc::RTCError error) override; virtual void AddRef() const override { return; } virtual rtc::RefCountReleaseStatus Release() const override { return rtc::RefCountReleaseStatus::kDroppedLastRef; } @@ -109,7 +109,7 @@ class Peer : public webrtc::PeerConnectionObserver, std::string _token; Mode _mode; webrtc::PeerConnectionInterface::RTCConfiguration _config; - webrtc::FakeConstraints _constraints; + webrtc::MediaConstraints _constraints; rtc::scoped_refptr _peerConnection; rtc::scoped_refptr _stream; std::unique_ptr _portAllocator; @@ -126,7 +126,7 @@ class DummySetSessionDescriptionObserver } virtual void OnSuccess() override; - virtual void OnFailure(const std::string& error) override; + virtual void OnFailure(webrtc::RTCError error) override; protected: DummySetSessionDescriptionObserver() = default; diff --git a/src/webrtc/include/scy/webrtc/peerfactorycontext.h b/src/webrtc/include/scy/webrtc/peerfactorycontext.h index 967ffa824..f6739631e 100644 --- a/src/webrtc/include/scy/webrtc/peerfactorycontext.h +++ b/src/webrtc/include/scy/webrtc/peerfactorycontext.h @@ -15,7 +15,7 @@ #include "scy/webrtc/webrtc.h" -#include "pc/peerconnectionfactory.h" +#include "pc/peer_connection_factory.h" namespace scy { @@ -27,10 +27,12 @@ class PeerFactoryContext public: PeerFactoryContext( webrtc::AudioDeviceModule* default_adm = nullptr, - cricket::WebRtcVideoEncoderFactory* video_encoder_factory = nullptr, - cricket::WebRtcVideoDecoderFactory* video_decoder_factory = nullptr, + webrtc::VideoEncoderFactory* video_encoder_factory = nullptr, + webrtc::VideoDecoderFactory* video_decoder_factory = nullptr, rtc::scoped_refptr audio_encoder_factory = nullptr, - rtc::scoped_refptr audio_decoder_factory = nullptr); + rtc::scoped_refptr audio_decoder_factory = nullptr, + rtc::scoped_refptr audio_mixer = nullptr, + rtc::scoped_refptr audio_processing = nullptr); void initCustomNetworkManager(); diff --git a/src/webrtc/include/scy/webrtc/peermanager.h b/src/webrtc/include/scy/webrtc/peermanager.h index b5f73785a..a1dd02235 100644 --- a/src/webrtc/include/scy/webrtc/peermanager.h +++ b/src/webrtc/include/scy/webrtc/peermanager.h @@ -18,7 +18,7 @@ #include "scy/webrtc/webrtc.h" #include "scy/webrtc/peer.h" -#include "api/peerconnectioninterface.h" +#include "api/peer_connection_interface.h" #include #include @@ -48,7 +48,7 @@ class PeerManager : public PointerCollection virtual void onStable(Peer* conn); virtual void onClosed(Peer* conn); - virtual void onFailure(Peer* conn, const std::string& error); + virtual void onFailure(Peer* conn, webrtc::RTCError error); }; diff --git a/src/webrtc/include/scy/webrtc/recordingpeer.h b/src/webrtc/include/scy/webrtc/recordingpeer_h similarity index 100% rename from src/webrtc/include/scy/webrtc/recordingpeer.h rename to src/webrtc/include/scy/webrtc/recordingpeer_h diff --git a/src/webrtc/include/scy/webrtc/streamrecorder.h b/src/webrtc/include/scy/webrtc/streamrecorder.h index 437a059ff..8431a4193 100644 --- a/src/webrtc/include/scy/webrtc/streamrecorder.h +++ b/src/webrtc/include/scy/webrtc/streamrecorder.h @@ -20,7 +20,7 @@ #include "scy/av/av.h" #include "scy/av/multiplexencoder.h" -#include "api/peerconnectioninterface.h" +#include "api/peer_connection_interface.h" namespace scy { diff --git a/src/webrtc/include/scy/webrtc/util.h b/src/webrtc/include/scy/webrtc/util.h index 7554f3cc9..791ad40f6 100644 --- a/src/webrtc/include/scy/webrtc/util.h +++ b/src/webrtc/include/scy/webrtc/util.h @@ -15,8 +15,8 @@ #include "scy/webrtc/webrtc.h" -#include "media/base/videocapturer.h" -#include "media/engine/webrtcvideocapturerfactory.h" +// #include "media/base/videocapturer.h" +// #include "media/engine/webrtcvideocapturerfactory.h" #include "modules/video_capture/video_capture_factory.h" @@ -26,7 +26,7 @@ namespace wrtc { std::vector getVideoCaptureDevices(); -std::unique_ptr openWebRtcVideoCaptureDevice(const std::string& deviceName = ""); +// std::unique_ptr openWebRtcVideoCaptureDevice(const std::string& deviceName = ""); } } // namespace scy::wrtc diff --git a/src/webrtc/include/scy/webrtc/videopacketsource.h b/src/webrtc/include/scy/webrtc/videopacketsource_h similarity index 100% rename from src/webrtc/include/scy/webrtc/videopacketsource.h rename to src/webrtc/include/scy/webrtc/videopacketsource_h diff --git a/src/webrtc/include/scy/webrtc/yuvframegenerator.h b/src/webrtc/include/scy/webrtc/yuvframegenerator.h index 3efa00c3a..cf4beaa08 100644 --- a/src/webrtc/include/scy/webrtc/yuvframegenerator.h +++ b/src/webrtc/include/scy/webrtc/yuvframegenerator.h @@ -16,8 +16,8 @@ #include "scy/base.h" #include "scy/logger.h" -#include "rtc_base/basictypes.h" -#include "rtc_base/constructormagic.h" +// #include "rtc_base/basictypes.h" +#include "rtc_base/constructor_magic.h" namespace scy { diff --git a/src/webrtc/src/audiopacketmodule.cpp b/src/webrtc/src/audiopacketmodule.cpp index fe8cc9854..3e0c1574c 100644 --- a/src/webrtc/src/audiopacketmodule.cpp +++ b/src/webrtc/src/audiopacketmodule.cpp @@ -13,9 +13,9 @@ #ifdef HAVE_FFMPEG -#include "rtc_base/refcountedobject.h" +#include "rtc_base/ref_counted_object.h" #include "rtc_base/thread.h" -#include "rtc_base/timeutils.h" +#include "rtc_base/time_utils.h" #include "scy/logger.h" @@ -133,7 +133,7 @@ void AudioPacketModule::updateProcessing(bool start) { if (start) { if (!_processThread) { - _processThread.reset(new rtc::Thread()); + _processThread = rtc::Thread::Create(); _processThread->Start(); } _processThread->Post(RTC_FROM_HERE, this, MSG_START_PROCESS); diff --git a/src/webrtc/src/fakeaudiodevicemodule.cpp b/src/webrtc/src/fakeaudiodevicemodule.cpp index 8d98114f9..4ad536210 100644 --- a/src/webrtc/src/fakeaudiodevicemodule.cpp +++ b/src/webrtc/src/fakeaudiodevicemodule.cpp @@ -11,9 +11,9 @@ #include "scy/webrtc/fakeaudiodevicemodule.h" -#include "rtc_base/refcountedobject.h" +#include "rtc_base/ref_counted_object.h" #include "rtc_base/thread.h" -#include "rtc_base/timeutils.h" +#include "rtc_base/time_utils.h" #include "scy/logger.h" diff --git a/src/webrtc/src/multiplexmediacapturer.cpp b/src/webrtc/src/multiplexmediacapturer_cpp similarity index 100% rename from src/webrtc/src/multiplexmediacapturer.cpp rename to src/webrtc/src/multiplexmediacapturer_cpp diff --git a/src/webrtc/src/peer.cpp b/src/webrtc/src/peer.cpp index 03af44781..5d3885d7b 100644 --- a/src/webrtc/src/peer.cpp +++ b/src/webrtc/src/peer.cpp @@ -90,7 +90,7 @@ void Peer::setPortRange(int minPort, int maxPort) void Peer::createConnection() { assert(_context->factory); - _peerConnection = _context->factory->CreatePeerConnection(_config, &_constraints, + _peerConnection = _context->factory->CreatePeerConnection(_config, std::move(_portAllocator), nullptr, this); if (_stream) { @@ -121,7 +121,8 @@ void Peer::createOffer() assert(_mode == Offer); assert(_peerConnection); - _peerConnection->CreateOffer(this, &_constraints); + webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options; + _peerConnection->CreateOffer(this, options); } @@ -140,7 +141,8 @@ void Peer::recvSDP(const std::string& type, const std::string& sdp) if (type == "offer") { assert(_mode == Answer); - _peerConnection->CreateAnswer(this, &_constraints); + webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options; + _peerConnection->CreateAnswer(this, options); } else { assert(_mode == Offer); } @@ -268,9 +270,9 @@ void Peer::OnSuccess(webrtc::SessionDescriptionInterface* desc) } -void Peer::OnFailure(const std::string& error) +void Peer::OnFailure(webrtc::RTCError error) { - LError(_peerid, ": On failure: ", error) + LError(_peerid, ": On failure: ", error.message()) _manager->onFailure(this, error); } @@ -295,7 +297,7 @@ std::string Peer::token() const } -webrtc::FakeConstraints& Peer::constraints() +webrtc::MediaConstraints& Peer::constraints() { return _constraints; } @@ -330,9 +332,9 @@ void DummySetSessionDescriptionObserver::OnSuccess() } -void DummySetSessionDescriptionObserver::OnFailure(const std::string& error) +void DummySetSessionDescriptionObserver::OnFailure(webrtc::RTCError error) { - LError("On SDP parse error: ", error) + LError("On SDP parse error: ", error.message()) assert(0); } diff --git a/src/webrtc/src/peerfactorycontext.cpp b/src/webrtc/src/peerfactorycontext.cpp index c9bccac85..a97937f45 100644 --- a/src/webrtc/src/peerfactorycontext.cpp +++ b/src/webrtc/src/peerfactorycontext.cpp @@ -14,13 +14,14 @@ //#include "pc/test/fakeaudiocapturemodule.h" #include "scy/logger.h" -#include "api/peerconnectionfactoryproxy.h" -#include "api/peerconnectionproxy.h" +#include "api/create_peerconnection_factory.h" +#include "api/peer_connection_factory_proxy.h" +#include "api/peer_connection_proxy.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "p2p/base/basicpacketsocketfactory.h" -#include "p2p/client/basicportallocator.h" -#include "pc/peerconnection.h" +#include "p2p/base/basic_packet_socket_factory.h" +#include "p2p/client/basic_port_allocator.h" +#include "pc/peer_connection.h" using std::endl; @@ -32,10 +33,12 @@ namespace wrtc { PeerFactoryContext::PeerFactoryContext( webrtc::AudioDeviceModule* default_adm, - cricket::WebRtcVideoEncoderFactory* video_encoder_factory, - cricket::WebRtcVideoDecoderFactory* video_decoder_factory, + webrtc::VideoEncoderFactory* video_encoder_factory, + webrtc::VideoDecoderFactory* video_decoder_factory, rtc::scoped_refptr audio_encoder_factory, - rtc::scoped_refptr audio_decoder_factory) + rtc::scoped_refptr audio_decoder_factory, + rtc::scoped_refptr audio_mixer, + rtc::scoped_refptr audio_processing) { // Setup threads networkThread = rtc::Thread::CreateWithSocketServer(); @@ -53,7 +56,8 @@ PeerFactoryContext::PeerFactoryContext( factory = webrtc::CreatePeerConnectionFactory( networkThread.get(), workerThread.get(), rtc::Thread::Current(), default_adm, audio_encoder_factory, audio_decoder_factory, - video_encoder_factory, video_decoder_factory); + std::unique_ptr(video_encoder_factory), std::unique_ptr(video_decoder_factory), + audio_mixer, audio_processing); // if (audio_encoder_factory || audio_decoder_factory) { // factory = webrtc::CreatePeerConnectionFactory( diff --git a/src/webrtc/src/peermanager.cpp b/src/webrtc/src/peermanager.cpp index f53b39f04..394dae57d 100644 --- a/src/webrtc/src/peermanager.cpp +++ b/src/webrtc/src/peermanager.cpp @@ -114,7 +114,7 @@ void PeerManager::onClosed(Peer* conn) } -void PeerManager::onFailure(Peer* conn, const std::string& error) +void PeerManager::onFailure(Peer* conn, webrtc::RTCError error) { LDebug("Deleting peer connection: ", conn->peerid()) diff --git a/src/webrtc/src/recordingpeer.cpp b/src/webrtc/src/recordingpeer_cpp similarity index 100% rename from src/webrtc/src/recordingpeer.cpp rename to src/webrtc/src/recordingpeer_cpp diff --git a/src/webrtc/src/streamrecorder.cpp b/src/webrtc/src/streamrecorder.cpp index 721968522..0899cf116 100644 --- a/src/webrtc/src/streamrecorder.cpp +++ b/src/webrtc/src/streamrecorder.cpp @@ -18,7 +18,7 @@ #include "scy/logger.h" #include "common_video/libyuv/include/webrtc_libyuv.h" -#include "media/engine/webrtcvideocapturerfactory.h" +// #include "media/engine/webrtcvideocapturerfactory.h" #include "modules/video_capture/video_capture_factory.h" diff --git a/src/webrtc/src/util.cpp b/src/webrtc/src/util.cpp index 342f31883..978a1e391 100644 --- a/src/webrtc/src/util.cpp +++ b/src/webrtc/src/util.cpp @@ -37,7 +37,7 @@ std::vector getVideoCaptureDevices() return deviceNames; } - +/* // cricket::VideoCapturer* openWebRtcVideoCaptureDevice(const std::string& deviceName) std::unique_ptr openWebRtcVideoCaptureDevice(const std::string& deviceName) { @@ -56,7 +56,7 @@ std::unique_ptr openWebRtcVideoCaptureDevice(const std:: assert(0 && "no video devices"); return nullptr; -} +}/**/ diff --git a/src/webrtc/src/videopacketsource.cpp b/src/webrtc/src/videopacketsource_cpp similarity index 100% rename from src/webrtc/src/videopacketsource.cpp rename to src/webrtc/src/videopacketsource_cpp diff --git a/src/webrtc/src/yuvframegenerator.cpp b/src/webrtc/src/yuvframegenerator.cpp index 3633fd7ee..52702ec70 100644 --- a/src/webrtc/src/yuvframegenerator.cpp +++ b/src/webrtc/src/yuvframegenerator.cpp @@ -13,7 +13,7 @@ #include "rtc_base/thread.h" #include "rtc_base/bind.h" -#include "rtc_base/asyncinvoker.h" +#include "rtc_base/async_invoker.h" #include #include