If my understanding is correctly, SharedMemoryFactory does not clear the SharedMemory instance it created.
Usually this is not a big deal, but it impacts DirectX capturer, since it captures monitors one-by-one. Each DxgiOutputDuplicator object does not clear the area out of its scope. Considering the following situation,
- Two monitors are attaching to the system with same screen resolution, say, 1000x800. The size of the SharedMemory is 2000 x 800
- Reduce the resolution of the primary monitor, say 800 x 600. The size of the new SharedMemory is 1800 x 800, while the left-bottom 800 x 200 is not controlled by both DxgiOutputDuplicator.
If the SharedMemory is not cleared, this 800 x 200 area may contain random image from previous frame.
This behavior is not consistent: I have reproduced it several times only. But according to the source code, this behavior should be expected.
Since this issue impacts DirectX capturer only, a simple solution is to clear it in DxgiFrame.
Comment 1 by zijiehe@chromium.org
, Apr 24 2017