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

Commit 0a1cd97

Browse files
author
Kuba Audykowicz
authored
Merge pull request #407 from DolbyIO/disco_crash
Ignore new frames instead of destroying SDK during subsystem deinitia…
2 parents cb386de + d134cdf commit 0a1cd97

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

DolbyIO/Source/Private/DolbyIOSubsystem.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ void UDolbyIOSubsystem::Initialize(FSubsystemCollectionBase& Collection)
5353

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

5862
Super::Deinitialize();
5963
}

DolbyIO/Source/Private/DolbyIOVideoSink.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,18 @@ namespace DolbyIO
7878
});
7979
}
8080

81+
void FVideoSink::Disable()
82+
{
83+
bIsEnabled = false;
84+
}
85+
8186
void FVideoSink::handle_frame(const video_frame& VideoFrame)
8287
{
88+
if (!bIsEnabled)
89+
{
90+
return;
91+
}
92+
8393
!Texture ? CreateTexture(VideoFrame.width(), VideoFrame.height())
8494
: ResizeTexture(VideoFrame.width(), VideoFrame.height());
8595
Convert(VideoFrame);

DolbyIO/Source/Private/DolbyIOVideoSink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace DolbyIO
2525
void BindMaterial(UMaterialInstanceDynamic* Material);
2626
void UnbindMaterial(UMaterialInstanceDynamic* Material);
2727
void UnbindAllMaterials();
28+
void Disable();
2829

2930
private:
3031
void handle_frame(const dolbyio::comms::video_frame&) override;
@@ -37,5 +38,6 @@ namespace DolbyIO
3738
TSet<UMaterialInstanceDynamic*> Materials;
3839
const FString VideoTrackID;
3940
FOnTextureCreated OnTexCreated = [] {};
41+
bool bIsEnabled = true;
4042
};
4143
}

0 commit comments

Comments
 (0)