Question

On the initial graph start, appoxly after 10 video samples, i keep receiving from the GraphManager the EC_DISPLAY_CHANGE event, even though, i didn't physically move the graph from one monitor to another, I only started it on the secondary monitor.

I tried to search for additional information regarding the causes the cause CGraphManager to send it but couldn't find any.

I've additionally used the following code snippet to handle the particular event by myself.

if (FAILED(hr = m_spMediaEventEx->CancelDefaultHandling(EC_DISPLAY_CHANGED)))
    return hr; 

Thanks for the help

Was it helpful?

Solution

EC_DISPLAY_CHANGE on MSDN:

If the display mode changes, the video renderer might need to choose another format. By sending this message, the renderer signals to the filter graph manager that it needs to be reconnected. During the reconnection, the renderer can select a new format.

The typical scenario is a video renderer expecting to be shown up on primary monitor, and then positioned onto secondary. The renderer generates the event in order to update itself through filter graph transition. You see the event after a few samples are already streamed because the event is handled asynchronously. To work this around, use IVMRMonitorConfig::SetMonitor and friends to position the renderer correctly well in advance.

Note that under normal circumstances, the event and reconnected is just a small delay and should be handled transparently.

By canceling default behavior, you are canceling the following exactly. And you are expected to take care yourself of what default action is trying to fix.

Default Action

The filter graph manager temporarily stops the graph, and then disconnects and reconnects the video renderer. It does not pass the event to the application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top