Apertura del repositorio

This commit is contained in:
2025-05-24 18:09:39 -03:00
parent 76e6359dad
commit d883ddd0d0
35253 changed files with 2891973 additions and 2 deletions
+76
View File
@@ -0,0 +1,76 @@
# -*- cmake -*-
# some webrtc headers require C++ 20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(00-Common)
include(Linking)
include(WebRTC)
project(llwebrtc)
if (LINUX)
add_compile_options(-Wno-deprecated-declarations) # webrtc::CreateAudioDeviceWithDataObserver is deprecated
endif (LINUX)
set(llwebrtc_SOURCE_FILES
llwebrtc.cpp
)
set(llwebrtc_HEADER_FILES
CMakeLists.txt
llwebrtc.h
llwebrtc_impl.h
)
list(APPEND llwebrtc_SOURCE_FILES ${llwebrtc_HEADER_FILES})
add_library (llwebrtc SHARED ${llwebrtc_SOURCE_FILES})
set_target_properties(llwebrtc PROPERTIES PUBLIC_HEADER llwebrtc.h)
if (WINDOWS)
cmake_policy(SET CMP0091 NEW)
set_target_properties(llwebrtc
PROPERTIES
LINK_FLAGS "/debug /LARGEADDRESSAWARE"
)
target_link_libraries(llwebrtc PRIVATE ll::webrtc
secur32
winmm
dmoguids
wmcodecdspuuid
msdmo
strmiids
iphlpapi
libcmt)
# as the webrtc libraries are release, build this binary as release as well.
target_compile_options(llwebrtc PRIVATE "/MT")
if (USE_BUGSPLAT)
set_target_properties(llwebrtc PROPERTIES PDB_OUTPUT_DIRECTORY "${SYMBOLS_STAGING_DIR}")
endif (USE_BUGSPLAT)
elseif (DARWIN)
target_link_libraries(llwebrtc PRIVATE ll::webrtc)
if (USE_BUGSPLAT)
set_target_properties(llwebrtc PROPERTIES XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
XCODE_ATTRIBUTE_DWARF_DSYM_FOLDER_PATH "${SYMBOLS_STAGING_DIR}/dSYMs")
endif (USE_BUGSPLAT)
elseif (LINUX)
target_compile_options(llwebrtc PRIVATE "-Wno-deprecated-declarations")
target_link_libraries(llwebrtc PRIVATE ll::webrtc)
endif (WINDOWS)
target_include_directories( llwebrtc INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
if (WINDOWS)
set_property(TARGET llwebrtc PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
endif (WINDOWS)
ADD_CUSTOM_COMMAND(TARGET llwebrtc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:llwebrtc>
${SHARED_LIB_STAGING_DIR})
# Add tests
if (LL_TESTS)
endif (LL_TESTS)
File diff suppressed because it is too large Load Diff
+292
View File
@@ -0,0 +1,292 @@
/**
* @file llwebrtc.h
* @brief WebRTC interface
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free tSoftware
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*
* llwebrtc wraps the native webrtc c++ library in a dynamic library with a simlified interface
* so that the viewer can use it. This is done because native webrtc has a different
* overall threading model than the viewer.
* The native webrtc library is also compiled with clang, and has memory management
* functions that conflict namespace-wise with those in the viewer.
*
* Due to these differences, code from the viewer cannot be pulled in to this
* dynamic library, so it remains very simple.
*/
#ifndef LLWEBRTC_H
#define LLWEBRTC_H
#include <string>
#include <vector>
#ifdef LL_MAKEDLL
#ifdef WEBRTC_WIN
#define LLSYMEXPORT __declspec(dllexport)
#elif WEBRTC_LINUX
#define LLSYMEXPORT __attribute__((visibility("default")))
#else
#define LLSYMEXPORT /**/
#endif
#else
#define LLSYMEXPORT /**/
#endif // LL_MAKEDLL
namespace llwebrtc
{
class LLWebRTCLogCallback
{
public:
typedef enum {
LOG_LEVEL_VERBOSE = 0,
LOG_LEVEL_INFO,
LOG_LEVEL_WARNING,
LOG_LEVEL_ERROR
} LogLevel;
virtual void LogMessage(LogLevel level, const std::string& message) = 0;
};
// LLWebRTCVoiceDevice is a simple representation of the
// components of a device, used to communicate this
// information to the viewer.
// A note on threading.
// Native WebRTC has it's own threading model. Some discussion
// can be found here (https://webrtc.github.io/webrtc-org/native-code/native-apis/)
//
// Note that all callbacks to observers will occurr on one of the WebRTC native threads
// (signaling, worker, etc.) Care should be taken to assure there are not
// bad interactions with the viewer threads.
class LLWebRTCVoiceDevice
{
public:
std::string mDisplayName; // friendly name for user interface purposes
std::string mID; // internal value for selection
LLWebRTCVoiceDevice(const std::string &display_name, const std::string &id) :
mDisplayName(display_name),
mID(id)
{
if (mID.empty())
{
mID = display_name;
}
};
};
typedef std::vector<LLWebRTCVoiceDevice> LLWebRTCVoiceDeviceList;
// The LLWebRTCDeviceObserver should be implemented by the viewer
// webrtc module, which will receive notifications when devices
// change (are unplugged, etc.)
class LLWebRTCDevicesObserver
{
public:
virtual void OnDevicesChanged(const LLWebRTCVoiceDeviceList &render_devices,
const LLWebRTCVoiceDeviceList &capture_devices) = 0;
};
// The LLWebRTCDeviceInterface provides a way for the viewer
// to enumerate, set, and get notifications of changes
// for both capture (microphone) and render (speaker)
// devices.
class LLWebRTCDeviceInterface
{
public:
struct AudioConfig {
bool mAGC { true };
bool mEchoCancellation { true };
// TODO: The various levels of noise suppression are configured
// on the APM which would require setting config on the APM.
// We should pipe the various values through
// later.
typedef enum {
NOISE_SUPPRESSION_LEVEL_NONE = 0,
NOISE_SUPPRESSION_LEVEL_LOW,
NOISE_SUPPRESSION_LEVEL_MODERATE,
NOISE_SUPPRESSION_LEVEL_HIGH,
NOISE_SUPPRESSION_LEVEL_VERY_HIGH
} ENoiseSuppressionLevel;
ENoiseSuppressionLevel mNoiseSuppressionLevel { NOISE_SUPPRESSION_LEVEL_VERY_HIGH };
};
virtual void setAudioConfig(AudioConfig config) = 0;
// instructs webrtc to refresh the device list.
virtual void refreshDevices() = 0;
// set the capture and render devices using the unique identifier for the device
virtual void setCaptureDevice(const std::string& id) = 0;
virtual void setRenderDevice(const std::string& id) = 0;
// Device observers for device change callbacks.
virtual void setDevicesObserver(LLWebRTCDevicesObserver *observer) = 0;
virtual void unsetDevicesObserver(LLWebRTCDevicesObserver *observer) = 0;
// tuning and audio levels
virtual void setTuningMode(bool enable) = 0;
virtual float getTuningAudioLevel() = 0; // for use during tuning
virtual float getPeerConnectionAudioLevel() = 0; // for use when not tuning
virtual void setPeerConnectionGain(float gain) = 0;
};
// LLWebRTCAudioInterface provides the viewer with a way
// to set audio characteristics (mute, send and receive volume)
class LLWebRTCAudioInterface
{
public:
virtual void setMute(bool mute) = 0;
virtual void setReceiveVolume(float volume) = 0; // volume between 0.0 and 1.0
virtual void setSendVolume(float volume) = 0; // volume between 0.0 and 1.0
};
// LLWebRTCDataObserver allows the viewer voice module to be notified when
// data is received over the data channel.
class LLWebRTCDataObserver
{
public:
virtual void OnDataReceived(const std::string& data, bool binary) = 0;
};
// LLWebRTCDataInterface allows the viewer to send data over the data channel.
class LLWebRTCDataInterface
{
public:
virtual void sendData(const std::string& data, bool binary=false) = 0;
virtual void setDataObserver(LLWebRTCDataObserver *observer) = 0;
virtual void unsetDataObserver(LLWebRTCDataObserver *observer) = 0;
};
// LLWebRTCIceCandidate is a basic structure containing
// information needed for ICE trickling.
struct LLWebRTCIceCandidate
{
std::string mCandidate;
std::string mSdpMid;
int mMLineIndex;
};
// LLWebRTCSignalingObserver provides a way for the native
// webrtc library to notify the viewer voice module of
// various state changes.
class LLWebRTCSignalingObserver
{
public:
typedef enum e_ice_gathering_state {
ICE_GATHERING_NEW,
ICE_GATHERING_GATHERING,
ICE_GATHERING_COMPLETE
} EIceGatheringState;
// Called when ICE gathering states have changed.
// This may be called at any time, as ICE gathering
// can be redone while a connection is up.
virtual void OnIceGatheringState(EIceGatheringState state) = 0;
// Called when a new ice candidate is available.
virtual void OnIceCandidate(const LLWebRTCIceCandidate& candidate) = 0;
// Called when an offer is available after a connection is requested.
virtual void OnOfferAvailable(const std::string& sdp) = 0;
// Called when a connection enters a failure state and renegotiation is needed.
virtual void OnRenegotiationNeeded() = 0;
// Called when a peer connection has shut down
virtual void OnPeerConnectionClosed() = 0;
// Called when the audio channel has been established and audio
// can begin.
virtual void OnAudioEstablished(LLWebRTCAudioInterface *audio_interface) = 0;
// Called when the data channel has been established and data
// transfer can begin.
virtual void OnDataChannelReady(LLWebRTCDataInterface *data_interface) = 0;
};
// LLWebRTCPeerConnectionInterface representsd a connection to a peer,
// in most cases a Secondlife WebRTC server. This interface
// allows for management of this peer connection.
class LLWebRTCPeerConnectionInterface
{
public:
struct InitOptions
{
// equivalent of PeerConnectionInterface::IceServer
struct IceServers {
// Valid formats are described in RFC7064 and RFC7065.
// Urls should containe dns hostnames (not IP addresses)
// as the TLS certificate policy is 'secure.'
// and we do not currentply support TLS extensions.
std::vector<std::string> mUrls;
std::string mUserName;
std::string mPassword;
};
std::vector<IceServers> mServers;
};
virtual bool initializeConnection(const InitOptions& options) = 0;
virtual bool shutdownConnection() = 0;
virtual void setSignalingObserver(LLWebRTCSignalingObserver* observer) = 0;
virtual void unsetSignalingObserver(LLWebRTCSignalingObserver* observer) = 0;
virtual void AnswerAvailable(const std::string &sdp) = 0;
};
// The following define the dynamic linked library
// exports.
// This library must be initialized before use.
LLSYMEXPORT void init(LLWebRTCLogCallback* logSink);
// And should be terminated as part of shutdown.
LLSYMEXPORT void terminate();
// Return an interface for device management.
LLSYMEXPORT LLWebRTCDeviceInterface* getDeviceInterface();
// Allocate and free peer connections.
LLSYMEXPORT LLWebRTCPeerConnectionInterface* newPeerConnection();
LLSYMEXPORT void freePeerConnection(LLWebRTCPeerConnectionInterface *connection);
}
#endif // LLWEBRTC_H
+441
View File
@@ -0,0 +1,441 @@
/**
* @file llwebrtc_impl.h
* @brief WebRTC dynamic library implementation header
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLWEBRTC_IMPL_H
#define LLWEBRTC_IMPL_H
#define LL_MAKEDLL
#if defined(_WIN32) || defined(_WIN64)
#define WEBRTC_WIN 1
#elif defined(__APPLE__)
#define WEBRTC_MAC 1
#define WEBRTC_POSIX 1
#elif __linux__
#define WEBRTC_LINUX 1
#define WEBRTC_POSIX 1
#endif
#include "llwebrtc.h"
// WebRTC Includes
#ifdef WEBRTC_WIN
#pragma warning(push)
#pragma warning(disable : 4996) // ignore 'deprecated.' We don't use the functions marked
// deprecated in the webrtc headers, but msvc complains anyway.
// Clang doesn't, and that's generally what webrtc uses.
#pragma warning(disable : 4068) // ignore 'invalid pragma.' There are clang pragma's in
// the webrtc headers, which msvc doesn't recognize.
#endif // WEBRTC_WIN
#include "api/scoped_refptr.h"
#include "rtc_base/ref_count.h"
#include "rtc_base/ref_counted_object.h"
#include "rtc_base/ssl_adapter.h"
#include "rtc_base/thread.h"
#include "api/peer_connection_interface.h"
#include "api/media_stream_interface.h"
#include "api/create_peerconnection_factory.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_device/include/audio_device_data_observer.h"
#include "rtc_base/task_queue.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "modules/audio_device/include/audio_device_defines.h"
namespace llwebrtc
{
class LLWebRTCPeerConnectionImpl;
class LLWebRTCLogSink : public rtc::LogSink {
public:
LLWebRTCLogSink(LLWebRTCLogCallback* callback) :
mCallback(callback)
{
}
// Destructor: close the log file
~LLWebRTCLogSink() override
{
}
void OnLogMessage(const std::string& msg,
rtc::LoggingSeverity severity) override
{
if (mCallback)
{
switch(severity)
{
case rtc::LS_VERBOSE:
mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg);
break;
case rtc::LS_INFO:
mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg);
break;
case rtc::LS_WARNING:
mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg);
break;
case rtc::LS_ERROR:
mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg);
break;
default:
break;
}
}
}
void OnLogMessage(const std::string& message) override
{
if (mCallback)
{
mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, message);
}
}
private:
LLWebRTCLogCallback* mCallback;
};
// Implements a class allowing capture of audio data
// to determine audio level of the microphone.
class LLAudioDeviceObserver : public webrtc::AudioDeviceDataObserver
{
public:
LLAudioDeviceObserver();
// Retrieve the RMS audio loudness
float getMicrophoneEnergy();
// Data retrieved from the caputure device is
// passed in here for processing.
void OnCaptureData(const void *audio_samples,
const size_t num_samples,
const size_t bytes_per_sample,
const size_t num_channels,
const uint32_t samples_per_sec) override;
// This is for data destined for the render device.
// not currently used.
void OnRenderData(const void *audio_samples,
const size_t num_samples,
const size_t bytes_per_sample,
const size_t num_channels,
const uint32_t samples_per_sec) override;
protected:
static const int NUM_PACKETS_TO_FILTER = 30; // 300 ms of smoothing (30 frames)
float mSumVector[NUM_PACKETS_TO_FILTER];
float mMicrophoneEnergy;
};
// Used to process/retrieve audio levels after
// all of the processing (AGC, AEC, etc.) for display in-world to the user.
class LLCustomProcessor : public webrtc::CustomProcessing
{
public:
LLCustomProcessor();
~LLCustomProcessor() override {}
// (Re-) Initializes the submodule.
void Initialize(int sample_rate_hz, int num_channels) override;
// Analyzes the given capture or render signal.
void Process(webrtc::AudioBuffer *audio) override;
// Returns a string representation of the module state.
std::string ToString() const override { return ""; }
float getMicrophoneEnergy() { return mMicrophoneEnergy; }
void setGain(float gain) { mGain = gain; }
protected:
static const int NUM_PACKETS_TO_FILTER = 30; // 300 ms of smoothing
int mSampleRateHz;
int mNumChannels;
float mSumVector[NUM_PACKETS_TO_FILTER];
float mMicrophoneEnergy;
float mGain;
};
// Primary singleton implementation for interfacing
// with the native webrtc library.
class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceSink
{
public:
LLWebRTCImpl(LLWebRTCLogCallback* logCallback);
~LLWebRTCImpl()
{
delete mLogSink;
}
void init();
void terminate();
//
// LLWebRTCDeviceInterface
//
void setAudioConfig(LLWebRTCDeviceInterface::AudioConfig config = LLWebRTCDeviceInterface::AudioConfig()) override;
void refreshDevices() override;
void setDevicesObserver(LLWebRTCDevicesObserver *observer) override;
void unsetDevicesObserver(LLWebRTCDevicesObserver *observer) override;
void setCaptureDevice(const std::string& id) override;
void setRenderDevice(const std::string& id) override;
void setTuningMode(bool enable) override;
float getTuningAudioLevel() override;
float getPeerConnectionAudioLevel() override;
void setPeerConnectionGain(float gain) override;
//
// AudioDeviceSink
//
void OnDevicesUpdated() override;
//
// Helpers
//
// The following thread helpers allow the
// LLWebRTCPeerConnectionImpl class to post
// tasks to the native webrtc threads.
void PostWorkerTask(absl::AnyInvocable<void() &&> task,
const webrtc::Location& location = webrtc::Location::Current())
{
mWorkerThread->PostTask(std::move(task), location);
}
void PostSignalingTask(absl::AnyInvocable<void() &&> task,
const webrtc::Location& location = webrtc::Location::Current())
{
mSignalingThread->PostTask(std::move(task), location);
}
void PostNetworkTask(absl::AnyInvocable<void() &&> task,
const webrtc::Location& location = webrtc::Location::Current())
{
mNetworkThread->PostTask(std::move(task), location);
}
void WorkerBlockingCall(rtc::FunctionView<void()> functor,
const webrtc::Location& location = webrtc::Location::Current())
{
mWorkerThread->BlockingCall(std::move(functor), location);
}
void SignalingBlockingCall(rtc::FunctionView<void()> functor,
const webrtc::Location& location = webrtc::Location::Current())
{
mSignalingThread->BlockingCall(std::move(functor), location);
}
void NetworkBlockingCall(rtc::FunctionView<void()> functor,
const webrtc::Location& location = webrtc::Location::Current())
{
mNetworkThread->BlockingCall(std::move(functor), location);
}
// Allows the LLWebRTCPeerConnectionImpl class to retrieve the
// native webrtc PeerConnectionFactory.
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> getPeerConnectionFactory()
{
return mPeerConnectionFactory;
}
// create or destroy a peer connection.
LLWebRTCPeerConnectionInterface* newPeerConnection();
void freePeerConnection(LLWebRTCPeerConnectionInterface* peer_connection);
// enables/disables capture via the capture device
void setRecording(bool recording);
void setPlayout(bool playing);
protected:
LLWebRTCLogSink* mLogSink;
// The native webrtc threads
std::unique_ptr<rtc::Thread> mNetworkThread;
std::unique_ptr<rtc::Thread> mWorkerThread;
std::unique_ptr<rtc::Thread> mSignalingThread;
// The factory that allows creation of native webrtc PeerConnections.
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> mPeerConnectionFactory;
rtc::scoped_refptr<webrtc::AudioProcessing> mAudioProcessingModule;
// more native webrtc stuff
std::unique_ptr<webrtc::TaskQueueFactory> mTaskQueueFactory;
// Devices
void updateDevices();
rtc::scoped_refptr<webrtc::AudioDeviceModule> mTuningDeviceModule;
rtc::scoped_refptr<webrtc::AudioDeviceModule> mPeerDeviceModule;
std::vector<LLWebRTCDevicesObserver *> mVoiceDevicesObserverList;
// accessors in native webrtc for devices aren't apparently implemented yet.
bool mTuningMode;
int32_t mRecordingDevice;
LLWebRTCVoiceDeviceList mRecordingDeviceList;
int32_t mPlayoutDevice;
LLWebRTCVoiceDeviceList mPlayoutDeviceList;
bool mMute;
LLAudioDeviceObserver * mTuningAudioDeviceObserver;
LLCustomProcessor * mPeerCustomProcessor;
// peer connections
std::vector<rtc::scoped_refptr<LLWebRTCPeerConnectionImpl>> mPeerConnections;
};
// The implementation of a peer connection, which contains
// the various interfaces used by the viewer to interact with
// the webrtc connection.
class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface,
public LLWebRTCAudioInterface,
public LLWebRTCDataInterface,
public webrtc::PeerConnectionObserver,
public webrtc::CreateSessionDescriptionObserver,
public webrtc::SetRemoteDescriptionObserverInterface,
public webrtc::SetLocalDescriptionObserverInterface,
public webrtc::DataChannelObserver
{
public:
LLWebRTCPeerConnectionImpl();
~LLWebRTCPeerConnectionImpl();
void init(LLWebRTCImpl * webrtc_impl);
void terminate();
virtual void AddRef() const override = 0;
virtual rtc::RefCountReleaseStatus Release() const override = 0;
//
// LLWebRTCPeerConnection
//
bool initializeConnection(const InitOptions& options) override;
bool shutdownConnection() override;
void setSignalingObserver(LLWebRTCSignalingObserver *observer) override;
void unsetSignalingObserver(LLWebRTCSignalingObserver *observer) override;
void AnswerAvailable(const std::string &sdp) override;
//
// LLWebRTCAudioInterface
//
void setMute(bool mute) override;
void setReceiveVolume(float volume) override; // volume between 0.0 and 1.0
void setSendVolume(float volume) override; // volume between 0.0 and 1.0
//
// LLWebRTCDataInterface
//
void sendData(const std::string& data, bool binary=false) override;
void setDataObserver(LLWebRTCDataObserver *observer) override;
void unsetDataObserver(LLWebRTCDataObserver *observer) override;
//
// PeerConnectionObserver implementation.
//
void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) override {}
void OnAddTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver,
const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>> &streams) override;
void OnRemoveTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver) override;
void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> channel) override;
void OnRenegotiationNeeded() override {}
void OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) override {};
void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) override;
void OnIceCandidate(const webrtc::IceCandidateInterface *candidate) override;
void OnIceConnectionReceivingChange(bool receiving) override {}
void OnConnectionChange(webrtc::PeerConnectionInterface::PeerConnectionState new_state) override;
//
// CreateSessionDescriptionObserver implementation.
//
void OnSuccess(webrtc::SessionDescriptionInterface *desc) override;
void OnFailure(webrtc::RTCError error) override;
//
// SetRemoteDescriptionObserverInterface implementation.
//
void OnSetRemoteDescriptionComplete(webrtc::RTCError error) override;
//
// SetLocalDescriptionObserverInterface implementation.
//
void OnSetLocalDescriptionComplete(webrtc::RTCError error) override;
//
// DataChannelObserver implementation.
//
void OnStateChange() override;
void OnMessage(const webrtc::DataBuffer& buffer) override;
// Helpers
void resetMute();
void enableSenderTracks(bool enable);
void enableReceiverTracks(bool enable);
protected:
LLWebRTCImpl * mWebRTCImpl;
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> mPeerConnectionFactory;
bool mMute;
// signaling
std::vector<LLWebRTCSignalingObserver *> mSignalingObserverList;
std::vector<std::unique_ptr<webrtc::IceCandidateInterface>> mCachedIceCandidates;
bool mAnswerReceived;
rtc::scoped_refptr<webrtc::PeerConnectionInterface> mPeerConnection;
rtc::scoped_refptr<webrtc::MediaStreamInterface> mLocalStream;
// data
std::vector<LLWebRTCDataObserver *> mDataObserverList;
rtc::scoped_refptr<webrtc::DataChannelInterface> mDataChannel;
};
}
#if WEBRTC_WIN
#pragma warning(pop)
#endif
#endif // LLWEBRTC_IMPL_H