From 64f7c5f55ec54621141ba3676298510dcf0bdb70 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Tue, 17 Apr 2012 09:55:30 +0000 Subject: Re #1355: vidgui: new rendering window may cause all rendering processes to stop Despite this fix, there is still a possibility that the rendering window can occasionally get stuck because SDL_PollEvent() gets stuck. This is most likely because there are two unsynchronized event pollers, Qt and SDL. The problem only happened on Windows with SDL 1.3 r5538, runs fine on Mac. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4060 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/vidgui/vidgui.cpp | 4 ++-- pjsip-apps/src/vidgui/vidwin.cpp | 7 +++++++ pjsip-apps/src/vidgui/vidwin.h | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'pjsip-apps/src/vidgui') diff --git a/pjsip-apps/src/vidgui/vidgui.cpp b/pjsip-apps/src/vidgui/vidgui.cpp index 77f805d7..4a0b4d7d 100644 --- a/pjsip-apps/src/vidgui/vidgui.cpp +++ b/pjsip-apps/src/vidgui/vidgui.cpp @@ -260,7 +260,7 @@ void MainWin::preview() pjsua_vid_win_get_info(wid, &wi); video_prev_ = new VidWin(&wi.hwnd); - vbox_left->addWidget(video_prev_, 1); + video_prev_->putIntoLayout(vbox_left); //Using this will cause SDL window to display blank //screen sometimes, probably because it's using different //X11 Display @@ -339,7 +339,7 @@ void MainWin::initVideoWindow() pjsua_vid_win_get_info(ci.media[i].stream.vid.win_in, &wi); video_= new VidWin(&wi.hwnd); - vbox_left->addWidget(video_, 1); + video_->putIntoLayout(vbox_left); break; } diff --git a/pjsip-apps/src/vidgui/vidwin.cpp b/pjsip-apps/src/vidgui/vidwin.cpp index 654035c1..3e38b6cd 100644 --- a/pjsip-apps/src/vidgui/vidwin.cpp +++ b/pjsip-apps/src/vidgui/vidwin.cpp @@ -50,6 +50,13 @@ VidWin::~VidWin() detach(); } +void VidWin::putIntoLayout(QBoxLayout *box) +{ + box->addWidget(this, 1); + show(); + activateWindow(); +} + bool VidWin::event(QEvent *e) { switch(e->type()) { diff --git a/pjsip-apps/src/vidgui/vidwin.h b/pjsip-apps/src/vidgui/vidwin.h index b784943b..8ab4a76d 100644 --- a/pjsip-apps/src/vidgui/vidwin.h +++ b/pjsip-apps/src/vidgui/vidwin.h @@ -21,6 +21,7 @@ #include #include +#include class VidWin : public QWidget { @@ -33,6 +34,8 @@ public: virtual ~VidWin(); QSize sizeHint() const { return size_hint; } + void putIntoLayout(QBoxLayout *layout); + protected: virtual bool event(QEvent *e); -- cgit v1.2.3