question

IWantKnowWhy-2484 avatar image
0 Votes"
IWantKnowWhy-2484 asked IWantKnowWhy-2484 published

GraphBuilder.RenderFile.WHITE_SCREEN.error

I previously edited a simple video playback function
video () ;
this function was originally no problem, can run properly,
until the use of
int main()
{
std: : Thread t (video) ;
video();
t.join();
return 0;
}

concurrent opened video () function, one window is normal, another white screen, maximize the white screen will get a full screen shot, can be moved, resize, cropped parts will become black screen. Even back to single-threaded, the first renderfile created by the video player is also bound to white screen. I could really use some help
void video()
{
...//init
pGraph->RenderFile(L"D:\\Downloads\\movie.avi", NULL);//WHITE SCREEN
pGraph->RenderFile(L"D:\\Downloads\\movie1.avi", NULL);//normal
pGraph->RenderFile(L"D:\\Downloads\\movie2.avi", NULL);//normal
pCtrl->Run();//create 3 windows for play;
...//release
}




windows-apic++
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Maybe you must execute CoInitializeEx or CoInitialize inside each new thread?


0 Votes 0 ·
IWantKnowWhy-2484 avatar image
0 Votes"
IWantKnowWhy-2484 answered IWantKnowWhy-2484 published

Thank you for your reply.

I reinstalled the system and fixed the bug. In order to reproduce this bug, I built a virtual machine of windows 10.

Test record

Test 1: single thread, normal operation, simple program

Test 2: dual thread, normal operation, simple program

Test 3: single thread, normal operation, simple program

It proves that the source of the bug does not start a simple video player for multithreading.

Sorry, this is my misunderstanding of the cause of the bug.

Therefore, I further tried to reproduce the bug with the original video player.

The header file of EasyX. H is attached

Test 4: single thread, normal operation, original program

Test 5: dual thread, simple program and original program. normal operation

Test 6: single thread, original program, normal operation

Test 7: dual thread, original program, normal operation

Test 8: single thread, original program, normal operation

Test 9: single thread, simple program, normal operation

Test 10: single thread, enable render (PIN) of the original program, and display normally

Test 11: dual thread, one side of the simple program, one side of the original program, normal operation.

Test 12: dual thread, original program, normal operation.

Test 13: single thread, the original program, enable render and renderfile at the same time, and run normally

Test 14: dual thread, the original program, renderfile are all displayed normally, and render is displayed normally

Test 15: single thread, simple program, normal operation.

After several possible tests, sorry, I can't reproduce the bug in the virtual machine at present.

The only details I can provide now:

During the existence of the bug, the playback task of calling renderfile or render for the first time will not play the picture, but the subsequent playback tasks will display normally,

The exception window created by renderfile will occur when the window is moved in debug mode

Nvd3dum. H (x86) / nvd3dumx. H (x64) / access conflict exception of c0000005 accessing 00000000 (1player only) / 0000011e (when2players) / 0000000000000000 (x64) / at position.

This problem may be a bug caused by a system error with a small probability. I would appreciate it if someone could explain it in detail. All tests are run on the virtual machine, which may be different from the physical host.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

XiaopoYang-MSFT avatar image
0 Votes"
XiaopoYang-MSFT answered XiaopoYang-MSFT edited

After running the following code based on the code, I cannot reproduce it.

 #include <iostream>
 #include <windows.h>
 #include <Dshow.h>
    
 #include <thread>
 //#include "qedit.h"
 //#include "atlbase.h"
    
 using namespace std;
 void main1()
 {
  int option;
     IGraphBuilder *pGraph = NULL;  //Creem l'apuntador al graf de filtres
  IMediaControl *pControl = NULL; //creem l'apuntador a un controlador per ayurar i iniciar el graf 
  IMediaEvent *pEvent = NULL; // apunta a l'objecte necessari per obtenir events del filter graph manager
  //IBaseFilter *pGrabberF = NULL;
     //ISampleGrabber *pGrabber = NULL;
    
  HRESULT hr = CoInitialize(NULL); // Inicialitzem la llibreria COM
  if ( FAILED(hr) ){
  printf("ERROR - Could not initialize COM library");
         return;
  }
  // Create the filter graph manager and query for interfaces.
     hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
     if (FAILED(hr))
     {
         printf("ERROR - Could not create the Filter Graph Manager.");
         return;
     }
    
     hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
     hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
    
     // Build the graph. IMPORTANT: Change this string to a file on your system.
  cout<<"introduce 1:chicken 2:futbol 3: video futbol audio chicken: \n";
  //cin>>option;
  switch(1)
  {
  case 1: hr = pGraph->RenderFile(L"C:\\Users\\Downloads\\file_example.avi", NULL);
  break;
  case 2: hr = pGraph->RenderFile(L"C:\\Users\\Downloads\\futbol.mpg", NULL);
  break;
  case 3:  // Create the Sample Grabber filter.
    break;
  }
    
     if (SUCCEEDED(hr))
     {
         // Run the graph.
         hr = pControl->Run();
         if (SUCCEEDED(hr))
         {
             // Wait for completion.
             long evCode;
             pEvent->WaitForCompletion(INFINITE, &evCode);
    
             // Note: Do not use INFINITE in a real application, because it
             // can block indefinitely.
         }
     }
     pControl->Release();
     pEvent->Release();
     pGraph->Release();
     CoUninitialize();
    
 }
    
 void main()
 {
     thread t(main1);
     main1();
     t.join();
 }

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.