سؤال

I have a DirectShow filter written Delphi 6 using the DSPACK component library. Currently I lock the filter state using the sync obj created for that purpose at the top of the FillBuffer() call and release it at the end (inside the finally section of a try/finally construct). Since the FillBuffer() call can block while waiting for new data to send out, via a WaitForSingleObject() call that is released by the thread that fulfills the data generation task, is this a bad idea? I am concerned that if the FillBuffer() call blocks for a (relatively) long time, this could affect negatively my filter or the entire filter graph.

هل كانت مفيدة؟

المحلول

You should be waiting with an unlocked critical section. Otherwise it will eventaully be a problem, with waiting worker thread blocking controlling thread, e.g. with a request to change filter graph state.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top