This repository was archived by the owner on Sep 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,11 @@ void UDolbyIOSubsystem::Initialize(FSubsystemCollectionBase& Collection)
5353
5454void 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}
Original file line number Diff line number Diff 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);
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments