A licensee reported trouble with a crash on exit on Mac. They discovered that the file AvfMediaPlayer.cpp, on the function Open there is this piece of code:
// Force the AV player to not be able to decode the scheme - this makes it use our ResourceLoader NSString* formatString = [NSString stringWithFormat:@"UE4-Media://%@", [Path.GetNSString() stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]]]; nsMediaUrl = [NSURL URLWithString:formatString]; [formatString release];
They found that removing the final manual release of formatString fixed the problem for them as an autorelease took care of it. We need to audit all the paths that could call AvfMediaPlayer::Open and ensure they're all within autorelease pool scope. If so, the manual release is unnecessary and should be removed.
To test this code path.
1) Follow this URL to create a project with a movie playing on a surface:
https://docs.unrealengine.com/en-US/Engine/MediaFramework/HowTo/FileMediaSource/index.html
2) Make sure movie and the move file source is in /Content/Movies in the editor.
3) Package for MacOS.
4) Ensure in the resulting mac .app package there is a movie in /Content/Movies/
5) Run the app make sure the movie plays and shutdown. This tests the usual path and nothing has been broken.
6) Load the project back up in the Editor and goto settings.
7) Tick the "Exclude Movie Files When Staging" box.
8) Add your movie name to "Specific Movies to Package" (see attached image for more info).
9) Package again for MacOS.
10 Look in resulting package. There should be no movie in /Content/Movies/
11) Run the app, the movie should still work as its loaded from the Pak file.
12) Quit the app. It should not crash during shutdown. This is the bit that was failing.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-97017 in the post.
0 |
Component | Media Framework |
---|---|
Affects Versions | 4.25 |
Target Fix | 4.26 |
Created | Aug 17, 2020 |
---|---|
Resolved | Oct 7, 2020 |
Updated | Apr 28, 2021 |