Skip to content

Commit

Permalink
update to Unreal SDK Version 1.5.6
Browse files Browse the repository at this point in the history
fixes Bug with Memory Management that caused interrupted Connections
  • Loading branch information
SFuhrmann committed Jun 28, 2023
1 parent 9be98f1 commit ff1f0e0
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 36 deletions.
Binary file modified Content/Blueprints/Game/GameInstance_TD.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Lobby/LobbyGameMode.uasset
Binary file not shown.
Binary file modified Content/Maps/Lobby.umap
Binary file not shown.
Binary file modified Content/Maps/TopDownExampleMap.umap
Binary file not shown.
2 changes: 1 addition & 1 deletion Plugins/Odin/Odin.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Version": 1,
"EngineVersion": "4.26.0",
"WhitelistPlatforms": [ "Win64", "Mac", "IOS", "Linux", "Android" ],
"VersionName": "1.5.5",
"VersionName": "1.5.6",
"FriendlyName": "4Players ODIN",
"Description": "Unreal integration plugin to integrate real-time chat technology into your game",
"Category": "Other",
Expand Down
1 change: 0 additions & 1 deletion Plugins/Odin/Source/Odin/Private/OdinAudioCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "Async/Async.h"
#include "Async/TaskGraphInterfaces.h"
#include "Runtime/Launch/Resources/Version.h"

#if ENGINE_MAJOR_VERSION >= 5
#include "AudioDeviceNotificationSubsystem.h"
Expand Down
6 changes: 3 additions & 3 deletions Plugins/Odin/Source/Odin/Private/OdinCaptureMedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void UOdinCaptureMedia::SetAudioCapture(UAudioCapture *audio_capture)

void UOdinCaptureMedia::Reset()
{
if (audio_capture_.IsValid()) {
audio_capture_.Reset();
if (nullptr != audio_capture_) {
audio_capture_ = nullptr;
this->audio_generator_handle_ = {};
}

Expand All @@ -63,7 +63,7 @@ void UOdinCaptureMedia::Reset()
OdinReturnCode UOdinCaptureMedia::ResetOdinStream()
{
FScopeLock lock(&this->capture_generator_delegate_);
if (audio_capture_.IsValid())
if (nullptr != audio_capture_)
this->audio_capture_->RemoveGeneratorDelegate(this->audio_generator_handle_);

this->audio_generator_handle_ = {};
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Odin/Source/Odin/Private/OdinPlaybackMedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ void UOdinPlaybackMedia::BeginDestroy()
odin_media_stream_destroy(this->stream_handle_);
this->stream_handle_ = 0;
}
Room.Reset();
Room = nullptr;
}
12 changes: 6 additions & 6 deletions Plugins/Odin/Source/Odin/Private/OdinRoom.AsyncNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ void UOdinRoomAddMedia::Activate()
// ->StartBackgroundTask();
FFunctionGraphTask::CreateAndDispatchWhenReady(
[=]() {
if (!(Room.IsValid() && CaptureMedia.IsValid()))
if (!(Room && CaptureMedia))
return;

OdinRoomHandle room_handle = Room.IsValid() ? Room->RoomHandle() : 0;
OdinRoomHandle room_handle = Room ? Room->RoomHandle() : 0;
OdinMediaStreamHandle media_handle =
CaptureMedia.IsValid() ? CaptureMedia->GetMediaHandle() : 0;
CaptureMedia ? CaptureMedia->GetMediaHandle() : 0;

auto result = odin_room_add_media(room_handle, media_handle);

Expand All @@ -86,7 +86,7 @@ void UOdinRoomAddMedia::Activate()
OnResponse.Broadcast(false);

} else {
Room->BindCaptureMedia(CaptureMedia.Get());
Room->BindCaptureMedia(CaptureMedia);

OnSuccess.ExecuteIfBound(result);
OnResponse.Broadcast(true);
Expand Down Expand Up @@ -120,8 +120,8 @@ void UOdinRoomRemoveMedia::Activate()
FFunctionGraphTask::CreateAndDispatchWhenReady(
[=]() {
OdinReturnCode result = -1;
if (Room.IsValid() && CaptureMedia.IsValid()) {
Room->UnbindCaptureMedia(CaptureMedia.Get());
if (Room && CaptureMedia) {
Room->UnbindCaptureMedia(CaptureMedia);
result = CaptureMedia->ResetOdinStream();
}

Expand Down
16 changes: 8 additions & 8 deletions Plugins/Odin/Source/Odin/Private/OdinRoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ void UOdinRoom::UpdateAPMConfig(FOdinApmSettings apm_config)
odin_apm_config.gain_controller = apm_config.bGainController;

if (odin_apm_config.echo_canceller) {
if (!submix_listener_.IsValid()) {
if (submix_listener_ == nullptr) {
submix_listener_ = NewObject<UOdinSubmixListener>();
submix_listener_->SetRoom(this->room_handle_);
}
submix_listener_->StartSubmixListener();
} else if (submix_listener_.IsValid()) {
} else if (submix_listener_ != nullptr) {
submix_listener_->StopSubmixListener();
}

Expand Down Expand Up @@ -248,7 +248,7 @@ void UOdinRoom::HandleOdinEvent(const OdinEvent event)
},
TStatId(), nullptr, ENamedThreads::GameThread);
} break;
case OdinEvent_RoomUserDataChanged: {
case OdinEventTag::OdinEvent_RoomUserDataChanged: {
auto room_data_changed = event.room_user_data_changed;
TArray<uint8> room_data{room_data_changed.room_user_data,
(int)room_data_changed.room_user_data_len};
Expand Down Expand Up @@ -289,10 +289,10 @@ void UOdinRoom::HandleOdinEvent(const OdinEvent event)
if (!this->IsValidLowLevel())
return;

TWeakObjectPtr<UOdinMediaBase> base_media = nullptr;
UOdinMediaBase* base_media = nullptr;
if (medias_.Contains(media_handle)) {
if (medias_.RemoveAndCopyValue(media_handle, base_media)
&& base_media.IsValid()) {
&& base_media != nullptr) {
auto playback_media = Cast<UOdinPlaybackMedia>(base_media);
this->onMediaRemoved.Broadcast(peer_id, playback_media, this);
}
Expand All @@ -312,9 +312,9 @@ void UOdinRoom::HandleOdinEvent(const OdinEvent event)

if (!medias_.Contains(media_handle))
return;
TWeakObjectPtr<UOdinMediaBase> media = *medias_.Find(media_handle);
if (media.IsValid()) {
this->onMediaActiveStateChanged.Broadcast(peer_id, media.Get(), active,
UOdinMediaBase* media = *medias_.Find(media_handle);
if (media) {
this->onMediaActiveStateChanged.Broadcast(peer_id, media, active,
this);
}
},
Expand Down
2 changes: 2 additions & 0 deletions Plugins/Odin/Source/Odin/Private/OdinSubmixListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "OdinSubmixListener.h"

#include "Odin.h"

using namespace Audio;

UOdinSubmixListener::UOdinSubmixListener(const class FObjectInitializer &PCIP)
Expand Down
1 change: 0 additions & 1 deletion Plugins/Odin/Source/Odin/Private/OdinSynthComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "Engine/Engine.h"
#include "Kismet/GameplayStatics.h"
#include "Runtime/Launch/Resources/Version.h"

#include "Odin.h"
#include "OdinMediaSoundGenerator.h"
Expand Down
5 changes: 4 additions & 1 deletion Plugins/Odin/Source/Odin/Public/OdinAudioCapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
#include "AudioCapture.h"
#include "CoreMinimal.h"
#include "Tickable.h"
#include "Runtime/Launch/Resources/Version.h"

#if ENGINE_MAJOR_VERSION >= 5
#include "AudioDeviceNotificationSubsystem.h"
#endif // ENGINE_MAJOR_VERSION >= 5
#endif

#include "OdinAudioCapture.generated.h"

USTRUCT(BlueprintType)
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Odin/Source/Odin/Public/OdinCaptureMedia.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ODIN_API UOdinCaptureMedia : public UOdinMediaBase

FCriticalSection capture_generator_delegate_;
UPROPERTY(BlueprintReadOnly, Category = "Audio Capture")
TWeakObjectPtr<UAudioCapture> audio_capture_ = nullptr;
UAudioCapture* audio_capture_ = nullptr;

FAudioGeneratorHandle audio_generator_handle_;
};
2 changes: 1 addition & 1 deletion Plugins/Odin/Source/Odin/Public/OdinPlaybackMedia.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ class ODIN_API UOdinPlaybackMedia : public UOdinMediaBase
void BeginDestroy() override;

UPROPERTY(BlueprintReadOnly, Category = "Room")
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;
};
24 changes: 12 additions & 12 deletions Plugins/Odin/Source/Odin/Public/OdinRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ODIN_API UOdinRoomJoin : public UBlueprintAsyncActionBase
FJoinRoomResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

FString Url;
FString Token;
Expand Down Expand Up @@ -91,10 +91,10 @@ class ODIN_API UOdinRoomAddMedia : public UBlueprintAsyncActionBase
FAddMediaResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

UPROPERTY()
TWeakObjectPtr<UOdinCaptureMedia> CaptureMedia;
UOdinCaptureMedia* CaptureMedia;

FOdinRoomAddMediaError OnError;
FOdinRoomAddMediaSuccess OnSuccess;
Expand Down Expand Up @@ -123,10 +123,10 @@ class ODIN_API UOdinRoomRemoveMedia : public UBlueprintAsyncActionBase
FRemoveMediaResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

UPROPERTY()
TWeakObjectPtr<UOdinCaptureMedia> CaptureMedia;
UOdinCaptureMedia* CaptureMedia;

FOdinRoomRemoveMediaError OnError;
FOdinRoomRemoveMediaSuccess OnSuccess;
Expand Down Expand Up @@ -155,7 +155,7 @@ class ODIN_API UOdinRoomUpdatePosition : public UBlueprintAsyncActionBase
FUpdatePositionResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

FVector2D Position;

Expand Down Expand Up @@ -186,7 +186,7 @@ class ODIN_API UOdinRoomUpdatePeerUserData : public UBlueprintAsyncActionBase
FUpdatePeerUserDataResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

TArray<uint8> Data;

Expand Down Expand Up @@ -217,7 +217,7 @@ class ODIN_API UOdinRoomUpdateRoomUserData : public UBlueprintAsyncActionBase
FUpdateRoomUserDataResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

TArray<uint8> Data;

Expand Down Expand Up @@ -250,7 +250,7 @@ class ODIN_API UOdinRoomSendMessage : public UBlueprintAsyncActionBase
FSendMessageResponsePin OnResponse;

UPROPERTY()
TWeakObjectPtr<UOdinRoom> Room;
UOdinRoom* Room;

TArray<uint8> Data;
TArray<int64> Targets;
Expand Down Expand Up @@ -527,11 +527,11 @@ class ODIN_API UOdinRoom : public /* USceneComponent */ UObject

FCriticalSection capture_medias_cs_;
UPROPERTY(transient)
TArray<TWeakObjectPtr<UOdinCaptureMedia>> capture_medias_;
TArray<UOdinCaptureMedia*> capture_medias_;

FCriticalSection medias_cs_;
UPROPERTY(transient)
TMap<uint64, TWeakObjectPtr<UOdinMediaBase>> medias_;
TMap<uint64, UOdinMediaBase*> medias_;

FCriticalSection joined_callbacks_cs_;

Expand All @@ -542,7 +542,7 @@ class ODIN_API UOdinRoom : public /* USceneComponent */ UObject
void HandleOdinEvent(const OdinEvent event);

UPROPERTY(transient)
TWeakObjectPtr<UOdinSubmixListener> submix_listener_;
UOdinSubmixListener* submix_listener_;

friend class UOdinRoomJoin;
friend class UOdinRoomAddMedia;
Expand Down
1 change: 1 addition & 0 deletions Plugins/Odin/Source/Odin/Public/OdinSynthComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "Components/SynthComponent.h"
#include "CoreMinimal.h"
#include "Runtime/Launch/Resources/Version.h"

#include "OdinPlaybackMedia.h"

Expand Down

0 comments on commit ff1f0e0

Please sign in to comment.