leadedge / Spout2

A video frame sharing system for Microsoft Windows
BSD 2-Clause "Simplified" License
757 stars 138 forks source link

Executable:xxx.exe Pid d24 Tid d24 1bb0. Module SpoutCam.ax, 2 object left active! At line 317 of dllentry.cpp #30

Closed Klusxy closed 6 years ago

Klusxy commented 6 years ago

Hi , my friends First i'm use SpoutCam as a capture card , when I close the program, I get this error: ASSERT Failed Executable:xxx.exe Pid d24 Tid 1bb0. Module SpoutCam.ax, 2 objects left active! At line 317 of dllentry.cpp I'm look for some things for this error . The conclusion is the object is Addref but no release. so i want to know this error is dshow Baseclasses problem or SpoutCam problem.

leadedge commented 6 years ago

This is most likely a bug in SpoutCam. But finding it is virtually impossible without a repeatable fault to trace. Is xxx.exe your own program?

Klusxy commented 6 years ago

xxx.exe is can not my own program , like VLC , I build SpoutCam(32bit debug) yesterday , and regist SpoutCam.ax , when I us VLC to show SpoutCam DirectShow , it can cause this error. So I think this error is the SpoutCam bug.

leadedge commented 6 years ago

What happens when you build "Release" ? Why do you need to rebuild SpoutCam? Does SpoutCam installed with the Spout installation cause this error? What version of VLC? I can check it.

Klusxy commented 6 years ago

1 3question: if use release version , this error is not appear , because in baseclasses:

#ifdef DEBUG
        if (CBaseObject::ObjectsActive()) {
            DbgSetModuleLevel(LOG_MEMORY, 2);
            TCHAR szInfo[512];
            extern TCHAR m_ModuleName[];     // Cut down module name

            TCHAR FullName[_MAX_PATH];      // Load the full path and module name
            TCHAR *pName;                   // Searches from the end for a backslash

            GetModuleFileName(NULL,FullName,_MAX_PATH);
            pName = _tcsrchr(FullName,'\\');
            if (pName == NULL) {
                pName = FullName;
            } else {
                pName++;
            }

        DWORD cch = wsprintf(szInfo, TEXT("Executable: %s  Pid %x  Tid %x. "),
                pName, GetCurrentProcessId(), GetCurrentThreadId());

            wsprintf(szInfo+cch, TEXT("Module %s, %d objects left active!"),
                     m_ModuleName, CBaseObject::ObjectsActive());
            DbgAssert(szInfo, TEXT(__FILE__),__LINE__);

        // If running remotely wait for the Assert to be acknowledged
        // before dumping out the object register
            DbgDumpObjectRegister();
        }
        DbgTerminate();
#endif

2nd question:I need to rebuild SpoutCam because I need to use SpoutCam DirectShow in 64bit. VLC version:2.2.5.1 Umbrella. I think this error is not VLC problem , because I use AMCap(32bit) or GraphStudioNext(64bit) , it also can cause this error.

leadedge commented 6 years ago

OK thanks. When I get some time I will build debug to see if I can reproduce the error.

I have never compiled SpoutCam 64bit so do not know whether the code will support it.

I tried VLC 2.2.5 "Weatherwax" and it crashes when SpoutCam is selected. Version 2.2.6 does not crash but shows a black screen. It seems that the last version that worked with SpoutCam was 2.2.1. http://spout.zeal.co/forums/topic/spoutcam-and-vlc/

Also to get SpoutCam to work you need to specify the audio device as none and set the video size.

Use "SpoutCamSettings.exe" to select the required size. For example, 30fps and 640x480.

Start the demo sender, then start VLC.

In VLC - Media > Open Capture Device Video device name : SpoutCam Audio device name: none Video size: 640x480 Click the PLAY button

SpoutCam code is based on an early capture source filter project by Vivek, available on the TMhare site as "Vcam" - http://tmhare.mvps.org

Many programs do not accept virtual cameras, so SpoutCam has been modified in an attempt to make it more compatible. However, it is still does not not fully emulate a typical webcam.

Klusxy commented 6 years ago

ok , thanks for you. This error isn't SpoutCam 64bit cause.The SpoutCam 32bit also cause this error. And SpoutCam don't support 64bit because

void CVCamStream::rgb2bgr(void* source, void *dest, unsigned int width, unsigned int height, bool bInvert){}

Inline asm only supported for 32bit by Visual Studio.

leadedge commented 6 years ago

Yes I understand that the error is not specific to 64bit.

rgb2bgr would have to be re-written using intrinsics. But the speed is probably not critical and the function could be done using pointers. You could quickly convert from rgb2rgba in SpoutCopy.cpp -

https://github.com/leadedge/Spout2/blob/master/SpoutSDK/Source/SpoutCopy.cpp

Klusxy commented 6 years ago

ok , thanks for you.

leadedge commented 6 years ago

Let's close this for now then.