summaryrefslogtreecommitdiff
path: root/indra/llwebrtc/llwebrtc_impl.h
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-02 19:36:11 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-02 19:36:11 +0800
commitad9e004037349b75b992c142c1cbcff50765ba6c (patch)
tree7fc422ead94e01e1d2fd976366b9ca2cec0e8518 /indra/llwebrtc/llwebrtc_impl.h
parent06e8f0c443c1ba7858d000c6d695b7e988e02053 (diff)
parent5f66a15142083a047ac945da94f167c24c95f49a (diff)
Merge remote-tracking branch 'secondlife/release/webrtc-voice' into webrtc-voice
Diffstat (limited to 'indra/llwebrtc/llwebrtc_impl.h')
-rw-r--r--indra/llwebrtc/llwebrtc_impl.h59
1 files changed, 56 insertions, 3 deletions
diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h
index eb675f4062..bc9b7762dd 100644
--- a/indra/llwebrtc/llwebrtc_impl.h
+++ b/indra/llwebrtc/llwebrtc_impl.h
@@ -69,6 +69,54 @@ 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.
@@ -142,8 +190,11 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface
#endif
{
public:
- LLWebRTCImpl();
- ~LLWebRTCImpl() {}
+ LLWebRTCImpl(LLWebRTCLogCallback* logCallback);
+ ~LLWebRTCImpl()
+ {
+ delete mLogSink;
+ }
void init();
void terminate();
@@ -235,6 +286,8 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface
void setRecording(bool recording);
protected:
+ LLWebRTCLogSink* mLogSink;
+
// The native webrtc threads
std::unique_ptr<rtc::Thread> mNetworkThread;
std::unique_ptr<rtc::Thread> mWorkerThread;
@@ -242,7 +295,7 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface
// 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