Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / agk::PlayVideoToImage() is working, however...

Author
Message
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 9th Jul 2022 19:08
I have read the other threads about this function, and it is working for me. However, it appears that DeleteVideo() is not working. As I watch in debug mode (Visual Studio 17) I can see the memory usage increase when loading the video but it doesn't decrease after DeleteVideo(). I set a breakpoint on the line for DeleteVideo(), so I know it is being executed.

I went so far as to set a breakpoint for every LoadVideo() and DeleteVideo() to make sure there was a Delete for every Load. All is looking good there. I also monitored the images, sprites and sound... all of which are being deleted after use (I have code that lists images, sprites and sounds by ID number). Everything is accounted for except the memory issue when I play video.

The manual states that we do not need to delete the image that is used by PlayVideoToImage(77), but I tried that resulting in a message trap stating that image 77 does not exist. Which would make sense if DeleteVideo() is taking care of that.

Anyone else experience this memory issue using PlayVideoToImage()?
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 9th Jul 2022 21:34
After using TaskManager to monitor memory instead of relying only on VS17, I found that there is a return to nominal memory usage after DeleteVideo(). For some reason VS17 is showing a 300-400 MB increase for each video but does not return to nominal after DeleteVideo().

Even though Task Manager is showing a decrease after DeleteVideo(), there is still a 22MB increase from before the video played.
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 10th Jul 2022 16:05 Edited at: 10th Jul 2022 16:06
Interesting, I just tried with a ~130mb video file and the difference after deleting was a +2mb. I do not get the exact same values every time the below clip is from one run:

Check out Automation on Steam now
https://store.steampowered.com/app/1698690/Automation/
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 10th Jul 2022 19:32 Edited at: 10th Jul 2022 19:35
Since I was in scrutinize mode, I noticed that I saw an increase in memory usage every time I clicked the mouse button. About 100K every click.
I isolated it down to a bit of code I use to read a file then parse the data. I could not see why it was increasing memory usage. As an experiment, I swapped all the AppGameKit string functions to C++ functions, and now the issue is gone. Something weird is going on with the string functions: Left(), Right(), Mid() and Asc(). I knew about Str() where we need to assign to char* then delete[] the string. But I found nothing about the other string functions having similar protocols.
such as:


Now, it takes 10 clicks instead of 1 to see a 100K change. I am sure this is due to my replacing all the string functions except for Asc().

Code after swapping to C++ functions:

Login to post a reply

Server time is: 2024-03-29 14:05:20
Your offset time is: 2024-03-29 14:05:20