Reputation: 1
I wish to create a custom WebRTC channel for a specific VoiceChat solution that would use that technology in the background. Unreal Engine already has a built in WebRTC API, but it is not documented, and I haven't found any public examples using it. I'm looking for a general example solution, or a documentation how to use set it up and use it properly.
I've tried to dig into Unreal's PixelStreaming solution, since that's the main usage of that API, but it is very convoluted. What I've probably solved is that "WebRTC", "libOpus"
modules added to my .Build.cs, as well as these two lines to fix a few linker issues:
PublicDefinitions.Add("NOMINMAX");
AddEngineThirdPartyPrivateStaticDependencies(Target, "OpenSSL");
I'm guessing that I'd need to use webrtc::CreatePeerConnectionFactory
, then PeerConnectionFactory->CreatePeerConnectionOrError
, but the former always results in a crash with the following crash log:
Unhandled Exception: 0x80000003
KERNELBASE UnrealEditor_AudioTest!rtc::webrtc_checks_impl::UnreachableCodeReached() UnrealEditor_AudioTest!rtc::webrtc_checks_impl::FatalLog() UnrealEditor_AudioTest!cricket::WebRtcVoiceEngine::Init() UnrealEditor_AudioTest!cricket::CompositeMediaEngine::Init() UnrealEditor_AudioTest!cricket::ChannelManager::Create() UnrealEditor_AudioTest!std::vector<std::unique_ptr<cricket::VoiceChannel,std::default_delete<cricket::VoiceChannel> >,std::allocator<std::unique_ptr<cricket::VoiceChannel,std::default_delete<cricket::VoiceChannel> > > >::erase() UnrealEditor_AudioTest!rtc::Thread::Restart() UnrealEditor_AudioTest!rtc::Thread::QueuedTaskHandler::OnMessage() UnrealEditor_AudioTest!rtc::Thread::Dispatch() UnrealEditor_AudioTest!rtc::Thread::ProcessMessages() UnrealEditor_AudioTest!rtc::Thread::PreRun()
Which doesn't really help what could be the source of my problem.
How I currently try to call is:
PeerConnectionFactory = webrtc::CreatePeerConnectionFactory(
NetworkThread.Get(), // Network thread
WorkerThread.Get(), // Worker thread
SignallingThread.Get(), // Signaling thread
nullptr, // Audio device module
webrtc::CreateAudioEncoderFactory<webrtc::AudioEncoderOpus>(),
webrtc::CreateAudioDecoderFactory<webrtc::AudioDecoderOpus>(),
nullptr,
nullptr,
nullptr,
nullptr
);
But based on what I've read, the two audiofactory should be enough for it work, but that doesn't seem to be the case.
I've only found this question on stackoverflow to try to do something similar: Trouble sending audio via custom AudioDeviceModule with WebRTC in C++
This is what I've been trying to follow (combined with the PixelStreaming solution), but I still crash nontheless.
Upvotes: -1
Views: 505
Reputation: 17340
VoiceChat is supported as part of Epic Online Service, see https://dev.epicgames.com/docs/game-services/real-time-communication-interface/voice which uses WebRTC under the hood.
Upvotes: 0