Skip to content

New webrtc #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmake/FindWebRTC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions src/webrtc/include/scy/webrtc/audiopacketmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions src/webrtc/include/scy/webrtc/fakeaudiodevicemodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions src/webrtc/include/scy/webrtc/peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<webrtc::PeerConnectionInterface> peerConnection() const;
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream() const;
Expand All @@ -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; }
Expand All @@ -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<webrtc::PeerConnectionInterface> _peerConnection;
rtc::scoped_refptr<webrtc::MediaStreamInterface> _stream;
std::unique_ptr<cricket::BasicPortAllocator> _portAllocator;
Expand All @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions src/webrtc/include/scy/webrtc/peerfactorycontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "scy/webrtc/webrtc.h"

#include "pc/peerconnectionfactory.h"
#include "pc/peer_connection_factory.h"


namespace scy {
Expand All @@ -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<webrtc::AudioEncoderFactory> audio_encoder_factory = nullptr,
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory = nullptr);
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory = nullptr,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer = nullptr,
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing = nullptr);

void initCustomNetworkManager();

Expand Down
4 changes: 2 additions & 2 deletions src/webrtc/include/scy/webrtc/peermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <iostream>
#include <string>
Expand Down Expand Up @@ -48,7 +48,7 @@ class PeerManager : public PointerCollection<std::string, Peer>

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);
};


Expand Down
2 changes: 1 addition & 1 deletion src/webrtc/include/scy/webrtc/streamrecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/webrtc/include/scy/webrtc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand All @@ -26,7 +26,7 @@ namespace wrtc {

std::vector<std::string> getVideoCaptureDevices();

std::unique_ptr<cricket::VideoCapturer> openWebRtcVideoCaptureDevice(const std::string& deviceName = "");
// std::unique_ptr<cricket::VideoCapturer> openWebRtcVideoCaptureDevice(const std::string& deviceName = "");


} } // namespace scy::wrtc
Expand Down
4 changes: 2 additions & 2 deletions src/webrtc/include/scy/webrtc/yuvframegenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/webrtc/src/audiopacketmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/webrtc/src/fakeaudiodevicemodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
18 changes: 10 additions & 8 deletions src/webrtc/src/peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -121,7 +121,8 @@ void Peer::createOffer()
assert(_mode == Offer);
assert(_peerConnection);

_peerConnection->CreateOffer(this, &_constraints);
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
_peerConnection->CreateOffer(this, options);
}


Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -295,7 +297,7 @@ std::string Peer::token() const
}


webrtc::FakeConstraints& Peer::constraints()
webrtc::MediaConstraints& Peer::constraints()
{
return _constraints;
}
Expand Down Expand Up @@ -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);
}

Expand Down
22 changes: 13 additions & 9 deletions src/webrtc/src/peerfactorycontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<webrtc::AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory)
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing)
{
// Setup threads
networkThread = rtc::Thread::CreateWithSocketServer();
Expand All @@ -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<webrtc::VideoEncoderFactory>(video_encoder_factory), std::unique_ptr<webrtc::VideoDecoderFactory>(video_decoder_factory),
audio_mixer, audio_processing);

// if (audio_encoder_factory || audio_decoder_factory) {
// factory = webrtc::CreatePeerConnectionFactory(
Expand Down
2 changes: 1 addition & 1 deletion src/webrtc/src/peermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/webrtc/src/streamrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
4 changes: 2 additions & 2 deletions src/webrtc/src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::vector<std::string> getVideoCaptureDevices()
return deviceNames;
}


/*
// cricket::VideoCapturer* openWebRtcVideoCaptureDevice(const std::string& deviceName)
std::unique_ptr<cricket::VideoCapturer> openWebRtcVideoCaptureDevice(const std::string& deviceName)
{
Expand All @@ -56,7 +56,7 @@ std::unique_ptr<cricket::VideoCapturer> openWebRtcVideoCaptureDevice(const std::

assert(0 && "no video devices");
return nullptr;
}
}/**/



Expand Down
2 changes: 1 addition & 1 deletion src/webrtc/src/yuvframegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string.h>
#include <sstream>
Expand Down