[XviD-devel] encoding from a worker thread can stall if encoding status dialog is enabled

Rev. Chris Korda victimofleisure at gmail.com
Wed May 19 23:56:11 CEST 2010


I have an unexpected problem using XviD to encode from a multi-threaded
application in which DirectShow is run from a worker thread (a recording
thread). The issue is that if the "Display encoding status" option is
checked, the application can stall. The stall occurs when the main (GUI)
thread tries to stop the recording thread, because the recording thread is
indirectly accessing a window (the XviD status dialog) via SendMessage and
therefore can block in the app's message pump.

Put more simply: The message handler that's trying to stop the recorder
thread gets blocked because the recorder thread blocks in SendMessage, which
is modal/single-threaded and is already handling a message.

It seems that the design of XviD's encoding status dialog assumes encoding
will be done from the app's main thread. If so this is a needless
constraint, and could be avoided if XviD accessed the dialog via PostMessage
instead of SendMessage. This is a significant implementation change but
wouldn't impact the user since the dialog is already a top-level window.

If I uncheck the "Display encoding status" option everything works fine. Any
suggestions? Is there a safe way to automatically disable the encoding
status dialog from within my app?

Best regards,

Chris
http://ffrend.sourceforge.net/



More information about the Xvid-devel mailing list