In my code I launch two mplayer clients to process two RTSP streams. However when I launch the program most of the time, only one of the process will work the other either disappears or never appears in the first place.

Below is my constructor for this process

Qt Code:
  1. mplayer::mplayer(QString rtsp_path, QWidget *parent) :
  2. QWidget(parent)
  3. {
  4. QPalette p(palette());
  5. p.setColor(QPalette::Background, Qt::black);
  6. this->setAutoFillBackground(true);
  7. this->setPalette(p);
  8. this->setMinimumSize(720,576);
  9.  
  10.  
  11. qDebug("\nCreating Process = Mplayer");
  12. arguments << rtsp_path << " -vo gl:yuv=2:force-pbo:ati-hack -fps 25 ";
  13. this->m_process = new QProcess();
  14.  
  15. this->m_process->setProgram(program);
  16. this->m_process->setArguments(arguments);
  17. this->m_process->start();
  18.  
  19. if(this->m_process->state()==QProcess::Running)
  20. {
  21. qDebug("\nSuccess in starting Process = Mplayer");
  22.  
  23. }
  24. if(!this->m_process->waitForStarted())
  25. {
  26. qDebug("\nFailed To start Process = Mplayer");
  27. }
  28. }
To copy to clipboard, switch view to plain text mode 

Below is the wrapper that holds these QProcesses.
Qt Code:
  1. mplayer_wrapper::mplayer_wrapper(QWidget *parent) :
  2. QWidget(parent)
  3. {
  4. QPalette p(palette());
  5. p.setColor(QPalette::Background, Qt::black);
  6. this->setAutoFillBackground(true);
  7. this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  8. this->setPalette(p);
  9. this->setMinimumSize(720,576);
  10. this->setMaximumSize(1440,576);
  11.  
  12. hlayout = new QHBoxLayout();
  13.  
  14. this->setLayout(hlayout);
  15.  
  16. if ((rtsp_path_cam_1 != nullptr)&&(rtsp_path_cam_2 != nullptr))
  17. {
  18. this->setFixedSize(1440,576);
  19. }
  20. else if((rtsp_path_cam_1 != nullptr)&&(rtsp_path_cam_2 == nullptr))
  21. {
  22. this->setFixedSize(720,576);
  23. }
  24. else if((rtsp_path_cam_1 == nullptr)&&(rtsp_path_cam_2 != nullptr))
  25. {
  26. this->setFixedSize(720,576);
  27. }
  28. else
  29. {
  30. qDebug("Error no camera's");
  31. }
  32. }
  33.  
  34. mplayer_wrapper::~mplayer_wrapper()
  35. {
  36. qDebug("\nDeleting Process = mplayer_wrapper");
  37. }
  38.  
  39. void mplayer_wrapper::start_mplayer()
  40. {
  41.  
  42. if ((!player)&&(rtsp_path_cam_1 != nullptr)) // Only allow one instance of the pointer to be generated.
  43. {
  44. player = new mplayer(rtsp_path_cam_1);
  45. hlayout->addWidget(player);
  46. count += 1;
  47. }
  48. if ((!player2)&&(rtsp_path_cam_2 != nullptr)) // Only allow one instance of the pointer to be generated.
  49. {
  50. player2 = new mplayer(rtsp_path_cam_2);
  51. hlayout->addWidget(player2);
  52. count += 1;
  53. }
  54.  
  55. }
To copy to clipboard, switch view to plain text mode 


If anyone has any idea why this is failing to launch the second mplayer client that would be great.As currently a bit lost really, as the code seems fine but I just cant see why it is failing.