Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #376 from DolbyIO/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Kuba Audykowicz authored Aug 28, 2023
2 parents 4c6d751 + e102ac6 commit f4f827f
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DolbyIO/DolbyIO.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.2.0-beta.7",
"VersionName": "1.2.0-beta.8",
"FriendlyName": "Dolby.io Virtual Worlds",
"Description": "Plugin integrating Dolby.io Communications.",
"Category": "Communications",
Expand Down
25 changes: 18 additions & 7 deletions DolbyIO/Source/Private/Subsystem/DolbyIOInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ void UDolbyIOSubsystem::Initialize(FSubsystemCollectionBase& Collection)

void UDolbyIOSubsystem::Deinitialize()
{
Sdk.Reset(); // make sure Sdk is dead so it doesn't call handle_frame on VideoSink during game destruction
DLB_UE_LOG("Deinitializing");
for (auto& Sink : VideoSinks)
{
Sink.Value->Disable(); // ignore new frames now on
}

Super::Deinitialize();
}
Expand Down Expand Up @@ -70,18 +74,25 @@ namespace
}

void UDolbyIOSubsystem::SetLogSettings(EDolbyIOLogLevel SdkLogLevel, EDolbyIOLogLevel MediaLogLevel,
EDolbyIOLogLevel DvcLogLevel, bool bLogToConsole)
EDolbyIOLogLevel DvcLogLevel, bool bLogToConsole, bool bLogToFile)
{
const FString& LogDir = FPaths::ProjectLogDir();
DLB_UE_LOG("Logs will be saved in directory %s", *LogDir);

sdk::log_settings LogSettings;
LogSettings.sdk_log_level = ToSdkLogLevel(SdkLogLevel);
LogSettings.media_log_level = ToSdkLogLevel(MediaLogLevel);
LogSettings.dvc_log_level = ToSdkLogLevel(DvcLogLevel);
LogSettings.log_directory = ToStdString(LogDir);
LogSettings.suppress_stdout_logs = true;
LogSettings.log_callback = bLogToConsole ? std::make_shared<FSdkLogCallback>() : nullptr;

if (bLogToConsole)
{
LogSettings.log_callback = std::make_shared<FSdkLogCallback>();
}
if (bLogToFile)
{
const FString& LogDir = FPaths::ProjectLogDir();
DLB_UE_LOG("Logs will be saved in directory %s", *LogDir);
LogSettings.log_directory = ToStdString(LogDir);
}

try
{
sdk::set_log_settings(LogSettings);
Expand Down
10 changes: 10 additions & 0 deletions DolbyIO/Source/Private/Video/DolbyIOVideoSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,18 @@ namespace DolbyIO
});
}

void FVideoSink::Disable()
{
bIsEnabled = false;
}

void FVideoSink::handle_frame(const video_frame& VideoFrame)
{
if (!bIsEnabled)
{
return;
}

!Texture ? CreateTexture(VideoFrame.width(), VideoFrame.height())
: ResizeTexture(VideoFrame.width(), VideoFrame.height());
Convert(VideoFrame);
Expand Down
2 changes: 2 additions & 0 deletions DolbyIO/Source/Private/Video/DolbyIOVideoSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace DolbyIO
void BindMaterial(UMaterialInstanceDynamic* Material);
void UnbindMaterial(UMaterialInstanceDynamic* Material);
void UnbindAllMaterials();
void Disable();

private:
void handle_frame(const dolbyio::comms::video_frame&) override;
Expand All @@ -36,5 +37,6 @@ namespace DolbyIO
TSet<UMaterialInstanceDynamic*> Materials;
const FString VideoTrackID;
FOnTextureCreated OnTexCreated = [] {};
bool bIsEnabled = true;
};
}
3 changes: 2 additions & 1 deletion DolbyIO/Source/Public/DolbyIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ class DOLBYIO_API UDolbyIOSubsystem : public UGameInstanceSubsystem
UFUNCTION(BlueprintCallable, Category = "Dolby.io Comms")
void SetLogSettings(EDolbyIOLogLevel SdkLogLevel = EDolbyIOLogLevel::Info,
EDolbyIOLogLevel MediaLogLevel = EDolbyIOLogLevel::Info,
EDolbyIOLogLevel DvcLogLevel = EDolbyIOLogLevel::Info, bool bLogToConsole = false);
EDolbyIOLogLevel DvcLogLevel = EDolbyIOLogLevel::Info, bool bLogToConsole = false,
bool bLogToFile = true);
UPROPERTY(BlueprintAssignable, Category = "Dolby.io Comms")
FDolbyIOOnErrorDelegate OnSetLogSettingsError;

Expand Down
12 changes: 8 additions & 4 deletions DolbyIO/Source/Public/DolbyIOBlueprints.h
Original file line number Diff line number Diff line change
Expand Up @@ -1032,23 +1032,27 @@ class UDolbyIOBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
DLB_EXECUTE_SUBSYSTEM_METHOD(SetRemotePlayerLocation, ParticipantID, Location);
}

/** Sets what to log in the Dolby.io C++ SDK. The logs will be saved to the default project log directory
* (likely Saved/Logs).
/** Sets what to log in the Dolby.io C++ SDK.
*
* This function should be called before the first call to Set Token if the user needs logs about the plugin's
* operation. Calling this function more than once has no effect.
*
* @param SdkLogLevel - Log level for SDK logs.
* @param MediaLogLevel - Log level for Media Engine logs.
* @param DvcLogLevel - Log level for DVC logs.
* @param bLogToConsole - Sets whether the logs should be displayed in the Output Log.
* @param bLogToFile - If this is true, the logs will be written to a file in the default project log directory
* (e.g. Saved/Logs on Windows).
*/
UFUNCTION(BlueprintCallable, Category = "Dolby.io Comms",
Meta = (WorldContext = "WorldContextObject", DisplayName = "Dolby.io Set Log Settings"))
static void SetLogSettings(const UObject* WorldContextObject, EDolbyIOLogLevel SdkLogLevel = EDolbyIOLogLevel::Info,
EDolbyIOLogLevel MediaLogLevel = EDolbyIOLogLevel::Info,
EDolbyIOLogLevel DvcLogLevel = EDolbyIOLogLevel::Info, bool bLogToConsole = false)
EDolbyIOLogLevel DvcLogLevel = EDolbyIOLogLevel::Info, bool bLogToConsole = false,
bool bLogToFile = true)
{
DLB_EXECUTE_SUBSYSTEM_METHOD(SetLogSettings, SdkLogLevel, MediaLogLevel, DvcLogLevel, bLogToConsole);
DLB_EXECUTE_SUBSYSTEM_METHOD(SetLogSettings, SdkLogLevel, MediaLogLevel, DvcLogLevel, bLogToConsole,
bLogToFile);
}

/** Sets the audio input device.
Expand Down
17 changes: 10 additions & 7 deletions docs/docs/blueprints/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,21 +484,24 @@ Calling this function even once disables the default behavior, which is to autom

:::info 🚀 Beta
The **Log to Console** parameter is a part of the [Beta program](https://docs.dolby.io/communications-apis/docs/overview-beta-programs).

The **Log to File** parameter is a part of the [Beta program](https://docs.dolby.io/communications-apis/docs/overview-beta-programs). In previous versions, logs were always written to a file.
:::

Sets what to log in the Dolby.io C++ SDK. The logs will be saved to the default project log directory (likely Saved/Logs).
Sets what to log in the Dolby.io C++ SDK.

This function should be called before the first call to [Set Token](#dolbyio-set-token) if the user needs logs about the plugin's operation. Calling this function more than once has no effect.

![](../../static/img/generated/DolbyIOBlueprintFunctionLibrary/img/nd_img_SetLogSettings.png)

#### Inputs and outputs
| Name | Direction | Type | Default value | Description |
|---------------------|:----------|:--------------------------------------------------|:--------------|:--------------------------------------------------------------------------|
| **Sdk Log Level** | Input | [Dolby.io Log Level](types.mdx#dolbyio-log-level) | Info | Log level for SDK logs. |
| **Media Log Level** | Input | [Dolby.io Log Level](types.mdx#dolbyio-log-level) | Info | Log level for Media Engine logs. |
| **Dvc Log Level** | Input | [Dolby.io Log Level](types.mdx#dolbyio-log-level) | Info | Log level for DVC logs. |
| **Log to Console** | Input | bool | false | Sets whether the C++ SDK logs should also be displayed in the Output Log. |
| Name | Direction | Type | Default value | Description |
|---------------------|:----------|:--------------------------------------------------|:--------------|:-----------------------------------------------------------------------------------------------------------------------|
| **Sdk Log Level** | Input | [Dolby.io Log Level](types.mdx#dolbyio-log-level) | Info | Log level for SDK logs. |
| **Media Log Level** | Input | [Dolby.io Log Level](types.mdx#dolbyio-log-level) | Info | Log level for Media Engine logs. |
| **Dvc Log Level** | Input | [Dolby.io Log Level](types.mdx#dolbyio-log-level) | Info | Log level for DVC logs. |
| **Log to Console** | Input | bool | false | Sets whether the logs should be displayed in the Output Log. |
| **Log to File** | Input | bool | true | If this is true, the logs will be written to a file in the default project log directory (e.g. Saved/Logs on Windows). |

---

Expand Down
11 changes: 11 additions & 0 deletions docs/docs/tutorial/multiple-games.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_position: 11
sidebar_label: Launching multiple games
title: Launching multiple games
---

If multiple games call [Set Token](../blueprints/functions.md#dolbyio-set-token) at the same time, which is likely to happen when using "Number of Players" with a value of more than 1 in the editor, then it is likely that one of these calls will trigger an error. We recommend handling the error by retrying this function after a short delay. Usually, one tick is enough, but if you have time, we recommend setting a longer delay:

![](../../static/img/multiple-games.png)

There is a known issue with the initialization and deinitialization of the plugin with the workaround above when playing games in the "Selected Viewport". The user can expect sporadic crashes to occur when launching or closing games. These issues do not occur when playing games as "Standalone Games". Therefore, we recommend using the latter option when setting "Number of Players" to more than 1.
2 changes: 1 addition & 1 deletion docs/docs/tutorial/obtain-permissions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 11
sidebar_position: 12
sidebar_label: macOS Permissions
title: macOS Permissions
---
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/img/multiple-games.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f4f827f

Please sign in to comment.