Replies: 3 comments 34 replies
|
Hi, See: Example MfAudioClipEx (function TAudioClipClass.OnReadSample) Although I think you need to implement a callback function from IMFMediaEvent, that reports when a sample is processed, before processing the next one, as usual in a-synchronous mode. I think function IMFMediaEvent.GetStatus(out phrStatus: HRESULT) could do the job. Right now I'm working on a WASAPI component that should render RAW/WAV formats. (See: Examples\MFComponents\WasApiRenderFile.pas. That is not working yet. Greeting, Tony. |
|
Hi Tony, Thanks for your reply. Unfortunately, I haven't had any luck with that solution either. This example below is the memory in use, when reading a single video frame sample.
As you can see, the memory is nearly freed up after destroying the source reader, but not before.. Edit - I can put together a sample project demonstrating this, if that would be of use. |
|
Hi Tony, I've added a sample frame capture project here: Let me know if you see any ways to improve it. Ideally, I'll update it to have an asynchronous capture example as the memory issue does not seem as bad with this synchronous code. If you think this sample project is of use for MfPack, I can open a pull request 👍 |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
Thanks for the great work on keeping this library maintained! Sorry I have not contributed in a long time..
I have a question regarding using ReadSample on the source reader - with asynchronous mode.
Essentially: (https://docs.microsoft.com/en-us/windows/win32/medfound/using-the-source-reader-in-asynchronous-mode)
I'm just capturing video frames, so I am not selecting the audio stream.
I've read your discussion on the topic:
microsoft/Windows-classic-samples#108
https://social.msdn.microsoft.com/Forums/en-US/c2b39d7b-5203-492c-9663-75d1601f82c7/memory-leak-imfsourcereaderreadsample-method?forum=mediafoundationdevelopment
I'm using critical section and releasing the sample (=nil), but still the memory usage seems to keep going up.. Even after the source reader is flushed and closed the memory usage does not seem to free up completely.
Is this still a known memory issue with media foundation? Or perhaps I'm still missing something.
If the source reader is caching the samples, I would expect these to be released at least on Flush.
Admittedly i'm using version: 2.6.1, so upgrading to 3.0.1 will be my next step, in case some calls have been updated to fix this.
All reactions