ekiga r5895 - in trunk: . src src/devices
- From: mschneid svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r5895 - in trunk: . src src/devices
- Date: Wed, 9 Jan 2008 07:13:53 +0000 (GMT)
Author: mschneid
Date: Wed Jan 9 07:13:53 2008
New Revision: 5895
URL: http://svn.gnome.org/viewvc/ekiga?rev=5895&view=rev
Log:
New FPS calculations in VideoDisplay.
Some reorganisation between the classes.
Modified:
trunk/ChangeLog
trunk/src/common.h
trunk/src/devices/videodisplay.cpp
trunk/src/devices/videodisplay.h
trunk/src/devices/videodisplay_dx.cpp
trunk/src/devices/videodisplay_x.cpp
Modified: trunk/src/common.h
==============================================================================
--- trunk/src/common.h (original)
+++ trunk/src/common.h Wed Jan 9 07:13:53 2008
@@ -247,4 +247,15 @@
};
+//will be moved at a later stage
+typedef struct {
+ unsigned rxFPS;
+ unsigned rxWidth;
+ unsigned rxHeight;
+ unsigned txFPS;
+ unsigned txWidth;
+ unsigned txHeight;
+ VideoAccelStatus videoAccelStatus;
+} VideoStats;
+
#endif /* GM_COMMON_H */
Modified: trunk/src/devices/videodisplay.cpp
==============================================================================
--- trunk/src/devices/videodisplay.cpp (original)
+++ trunk/src/devices/videodisplay.cpp Wed Jan 9 07:13:53 2008
@@ -54,18 +54,34 @@
#include "misc.h"
#include "main.h"
-GMVideoDisplay::GMVideoDisplay ()
- : PThread (1000, NoAutoDeleteThread, HighPriority, "GMVideoDisplay") // to be verified
+GMVideoDisplay::GMVideoDisplay (Ekiga::ServiceCore & _core)
+ : PThread (1000, NoAutoDeleteThread, HighPriority, "GMVideoDisplay"),
+ core (_core)
{
+ videoStats.rxWidth = videoStats.rxWidth = videoStats.rxFPS = 0;
+ videoStats.txWidth = videoStats.txWidth = videoStats.txFPS = 0;
+ videoStats.videoAccelStatus = NONE;
}
GMVideoDisplay::~GMVideoDisplay ()
{
}
+void GMVideoDisplay::SetVideoInfo (VideoInfo* newVideoInfo)
+{
+ PWaitAndSignal m(video_info_mutex);
+ videoInfo = *newVideoInfo;
+}
+
+void GMVideoDisplay::GetVideoInfo (VideoInfo* getVideoInfo)
+{
+ PWaitAndSignal m(video_info_mutex);
+ *getVideoInfo = videoInfo;
+}
+
/* The functions */
-GMVideoDisplay_embedded::GMVideoDisplay_embedded (Ekiga::ServiceCore & _core)
-: core (_core)
+GMVideoDisplay_embedded::GMVideoDisplay_embedded(Ekiga::ServiceCore & _core)
+: GMVideoDisplay(_core)
{
/* Variables */
@@ -91,6 +107,12 @@
update_required.local = FALSE;
update_required.remote = FALSE;
+
+ rxFrames = 0;
+ txFrames = 0;
+
+ lastStats = PTime ();
+
runtime = dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"));
sigc::connection conn;
@@ -200,6 +222,14 @@
currentFrame.localWidth = width;
currentFrame.localHeight= height;
+ txFrames++;
+
+ if ((width != videoStats.txWidth) || (height != videoStats.txHeight)) {
+ videoStats.txWidth = width;
+ videoStats.txHeight = height;
+ //FIXME
+ }
+
memcpy (lframeStore.GetPointer(), data, (width * height * 3) >> 1);
if (update_required.local)
PTRACE(3, "Skipped earlier local frame");
@@ -211,12 +241,31 @@
rframeStore.SetSize (width * height * 3);
currentFrame.remoteWidth = width;
currentFrame.remoteHeight= height;
+
+ rxFrames++;
+
+ if ((width != videoStats.rxWidth) || (height != videoStats.rxHeight)) {
+ videoStats.rxWidth = width;
+ videoStats.rxHeight = height;
+ //FIXME
+ }
memcpy (rframeStore.GetPointer(), data, (width * height * 3) >> 1);
if (update_required.remote)
PTRACE(3, "Skipped earlier remote frame");
update_required.remote = TRUE;
}
+
+ PTimeInterval t = PTime () - lastStats;
+ if (t.GetMilliSeconds() > 2000) {
+ videoStats.txFPS = round ((rxFrames * 1000) / t.GetMilliSeconds());
+ videoStats.rxFPS = round ((txFrames * 1000) / t.GetMilliSeconds());
+ rxFrames = 0;
+ txFrames = 0;
+ lastStats = PTime();
+ //FIXME
+ }
+
var_mutex.Signal();
if ((localVideoInfo.display == UNSET) || (localVideoInfo.zoom == 0) || (!localVideoInfo.gconfInfoSet)) {
@@ -324,16 +373,5 @@
return sync_required;
}
-void GMVideoDisplay_embedded::SetVideoInfo (VideoInfo* newVideoInfo)
-{
- PWaitAndSignal m(video_info_mutex);
- videoInfo = *newVideoInfo;
-}
-
-void GMVideoDisplay_embedded::GetVideoInfo (VideoInfo* getVideoInfo)
-{
- PWaitAndSignal m(video_info_mutex);
- *getVideoInfo = videoInfo;
-}
Modified: trunk/src/devices/videodisplay.h
==============================================================================
--- trunk/src/devices/videodisplay.h (original)
+++ trunk/src/devices/videodisplay.h Wed Jan 9 07:13:53 2008
@@ -86,7 +86,7 @@
* BEHAVIOR : Initialises the VideoDisplay.
* PRE : /
*/
- GMVideoDisplay ();
+ GMVideoDisplay (Ekiga::ServiceCore & core);
/* DESCRIPTION : The destructor.
@@ -108,6 +108,56 @@
const BYTE *data,
bool local,
int devices_nbr) = 0;
+ /* DESCRIPTION : Update all information about the video_image widget,
+ gconf-settings and display type and zoom settings..
+ * Needed for embedded window
+ * BEHAVIOR : Called when the video_image widget receives an expose event,
+ * when a parameter like zoom or display type is change and
+ * once before the display i opened to initialize all settings
+ * obtained from gconf.
+ * PRE : A VideoInfo object with all the updated information
+ */
+ virtual void SetVideoInfo (VideoInfo* newVideoInfo);
+
+ protected:
+
+ /* Callbacks for functions that have to be
+ executed in the main thread */
+ sigc::signal<void,
+ VideoMode> set_display_type; /* gm_main_window_set_display_type */
+
+ sigc::signal<void,
+ int> fullscreen_menu_update_sensitivity; /* gm_main_window_fullscreen_menu_update_sensitivity */
+
+ sigc::signal<void,
+ FSToggle> toggle_fullscreen; /* gm_main_window_toggle_fullscreen */
+
+ sigc::signal<void,
+ int,
+ int> set_resized_video_widget; /* gm_main_window_set_resized_video_widget */
+
+ sigc::signal<void> update_logo; /* gm_main_window_update_logo */
+ sigc::signal<void> force_redraw; /* gm_main_window_force_redraw */
+ sigc::signal<void> update_zoom_display; /* gm_main_window_update_zoom_display */
+ sigc::signal<void,
+ VideoAccelStatus> update_video_accel_status; /* gm_main_window_update_video_accel_status */
+
+ /* DESCRIPTION : /
+ * BEHAVIOR : Copy the VideoInfo information to a local variable
+ in a protected manner
+ * PRE : The protected VideoInfo has been set via SetVideoInfo.
+ */
+ virtual void GetVideoInfo (VideoInfo* getVideoInfo);
+
+ VideoStats videoStats;
+
+ PMutex video_info_mutex; /* To protect the VideoInfo object*/
+
+ /* This variable has to be protected by video_info_mutex */
+ VideoInfo videoInfo;
+
+ Ekiga::Runtime* runtime;
+ Ekiga::ServiceCore & core;
};
@@ -149,16 +199,6 @@
bool local,
int devices_nbr);
- /* DESCRIPTION : Update all information about the video_image widget,
- gconf-settings and display type and zoom settings..
- * Needed for embedded window
- * BEHAVIOR : Called when the video_image widget receives an expose event,
- * when a parameter like zoom or display type is change and
- * once before the display i opened to initialize all settings
- * obtained from gconf.
- * PRE : A VideoInfo object with all the updated information
- */
- virtual void SetVideoInfo (VideoInfo* newVideoInfo);
protected:
@@ -230,12 +270,6 @@
*/
virtual UpdateRequired Redraw ();
- /* DESCRIPTION : /
- * BEHAVIOR : Copy the VideoInfo information to a local variable
- in a protected manner
- * PRE : The protected VideoInfo has been set via SetVideoInfo.
- */
- virtual void GetVideoInfo (VideoInfo* getVideoInfo);
/* DESCRIPTION : /
* BEHAVIOR : Sync the output of the frame to the display
@@ -249,6 +283,9 @@
FrameInfo lastFrame;
FrameInfo currentFrame;
+ unsigned rxFrames;
+ unsigned txFrames;
+
bool stop;
bool first_frame_received;
bool video_disabled;
@@ -257,39 +294,14 @@
PMutex var_mutex; /* To protect variables that are read and written
from various threads */
PMutex quit_mutex; /* To exit */
- PMutex video_info_mutex; /* To protect the VideoInfo object*/
PSyncPoint frame_available_sync_point; /* To signal a new frame has to be displayed */
PSyncPoint thread_sync_point; /* To signal that the thread has been created */
- /* Callbacks for functions that have to be
- executed in the main thread */
- sigc::signal<void,
- VideoMode> set_display_type; /* gm_main_window_set_display_type */
-
- sigc::signal<void,
- int> fullscreen_menu_update_sensitivity; /* gm_main_window_fullscreen_menu_update_sensitivity */
-
- sigc::signal<void,
- FSToggle> toggle_fullscreen; /* gm_main_window_toggle_fullscreen */
-
- sigc::signal<void,
- int,
- int> set_resized_video_widget; /* gm_main_window_set_resized_video_widget */
-
- sigc::signal<void> update_logo; /* gm_main_window_update_logo */
- sigc::signal<void> force_redraw; /* gm_main_window_force_redraw */
- sigc::signal<void> update_zoom_display; /* gm_main_window_update_zoom_display */
- sigc::signal<void,
- VideoAccelStatus> update_video_accel_status; /* gm_main_window_update_video_accel_status */
-
- std::vector<sigc::connection> connections;
-
- /* This variable has to be protected by video_info_mutex */
- VideoInfo videoInfo;
+ std::vector<sigc::connection> connections; //FIXME
- Ekiga::Runtime* runtime;
- Ekiga::ServiceCore & core;
+ PTime lastStats;
+
};
#endif /* VIDEODISPLAY */
Modified: trunk/src/devices/videodisplay_dx.cpp
==============================================================================
--- trunk/src/devices/videodisplay_dx.cpp (original)
+++ trunk/src/devices/videodisplay_dx.cpp Wed Jan 9 07:13:53 2008
@@ -76,7 +76,6 @@
unsigned int zoom)
{
VideoInfo localVideoInfo;
- VideoAccelStatus status = 0;
GetVideoInfo(&localVideoInfo);
@@ -111,11 +110,13 @@
runtime->run_in_main (sigc::bind (set_display_type.make_slot (), display));
+ videoStats.videoAccelStatus = NONE;
+
switch (display) {
case LOCAL_VIDEO:
PTRACE(4, "GMVideoDisplay_DX\tOpening LOCAL_VIDEO display with image of " << lf_width << "x" << lf_height);
dxWindow = new DXWindow();
- status = (VideoAccelStatus) dxWindow->Init (localVideoInfo.hwnd,
+ videoStats.videoAccelStatus = (VideoAccelStatus) dxWindow->Init (localVideoInfo.hwnd,
localVideoInfo.x,
localVideoInfo.y,
(int) (lf_width * zoom / 100),
@@ -135,7 +136,7 @@
case REMOTE_VIDEO:
PTRACE(4, "GMVideoDisplay_DX\tOpening REMOTE_VIDEO display with image of " << rf_width << "x" << rf_height);
dxWindow = new DXWindow();
- status = (VideoAccelStatus) dxWindow->Init (localVideoInfo.hwnd,
+ videoStats.videoAccelStatus = (VideoAccelStatus) dxWindow->Init (localVideoInfo.hwnd,
localVideoInfo.x,
localVideoInfo.y,
(int) (rf_width * zoom / 100),
@@ -159,7 +160,7 @@
<< lf_width << "x" << lf_height << "(local) and "
<< rf_width << "x" << rf_height << "(remote)");
dxWindow = new DXWindow();
- status = (VideoAccelStatus) dxWindow->Init ((display == PIP) ? localVideoInfo.hwnd : NULL,
+ videoStats.videoAccelStatus = (VideoAccelStatus) dxWindow->Init ((display == PIP) ? localVideoInfo.hwnd : NULL,
(display == PIP) ? localVideoInfo.x : 0,
(display == PIP) ? localVideoInfo.y : 0,
(int) (rf_width * zoom / 100),
@@ -199,16 +200,17 @@
//
// CloseFrameDisplay ();
- runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), status));
+ runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), videoStats.videoAccelStatus));
}
bool
GMVideoDisplay_DX::CloseFrameDisplay ()
{
- if (runtime) //FIXME
- runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), NO_VIDEO));
-
+ if (runtime) {//FIXME
+ videoStats.videoAccelStatus = NO_VIDEO;
+ runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), videoStats.videoAccelStatus));
+ }
if (dxWindow) {
delete dxWindow;
Modified: trunk/src/devices/videodisplay_x.cpp
==============================================================================
--- trunk/src/devices/videodisplay_x.cpp (original)
+++ trunk/src/devices/videodisplay_x.cpp Wed Jan 9 07:13:53 2008
@@ -95,7 +95,6 @@
unsigned int zoom)
{
VideoInfo localVideoInfo;
- VideoAccelStatus status = NONE;
if (video_disabled)
return;
@@ -135,6 +134,8 @@
pipWindowAvailable = FALSE;
+ videoStats.videoAccelStatus = NONE;
+
switch (display) {
// LOCAL_VIDEO ------------------------------------------------------------------
case LOCAL_VIDEO:
@@ -151,18 +152,18 @@
(int) (lf_height * zoom / 100),
lf_width,
lf_height)) {
- status = ALL;
+ videoStats.videoAccelStatus = ALL;
PTRACE(4, "GMVideoDisplay_X\tLOCAL_VIDEO: Successfully opened XV Window");
}
else {
delete lxWindow;
lxWindow = NULL;
- status = NONE;
+ videoStats.videoAccelStatus = NONE;
PTRACE(4, "GMVideoDisplay_X\tLOCAL_VIDEO: Could not open XV Window");
}
}
#endif
- if (status==NONE) {
+ if (videoStats.videoAccelStatus==NONE) {
PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((localVideoInfo.disableHwAccel)
? " since HW acceleration was deactivated by configuration"
: " since HW acceleration failed to initalize"));
@@ -183,7 +184,7 @@
delete lxWindow;
lxWindow = NULL;
video_disabled = TRUE;
- status = NO_VIDEO;
+ videoStats.videoAccelStatus = NO_VIDEO;
PTRACE(1, "GMVideoDisplay_X\tLOCAL_VIDEO: Could not open X Window - no video");
}
}
@@ -212,19 +213,19 @@
(int) (rf_height * zoom / 100),
rf_width,
rf_height)) {
- status = ALL;
+ videoStats.videoAccelStatus = ALL;
PTRACE(4, "GMVideoDisplay_X\tREMOTE_VIDEO: Successfully opened XV Window");
}
else {
delete rxWindow;
rxWindow = NULL;
- status = NONE;
+ videoStats.videoAccelStatus = NONE;
PTRACE(1, "GMVideoDisplay_X\tLOCAL_VIDEO: Could not open XV Window");
}
}
#endif
- if (status==NONE) {
+ if (videoStats.videoAccelStatus==NONE) {
PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((localVideoInfo.disableHwAccel)
? " since HW acceleration was deactivated by configuration"
: " since HW acceleration failed to initalize"));
@@ -245,7 +246,7 @@
delete rxWindow;
rxWindow = NULL;
video_disabled = TRUE;
- status = NO_VIDEO;
+ videoStats.videoAccelStatus = NO_VIDEO;
PTRACE(1, "GMVideoDisplay_X\tREMOTE_VIDEO: Could not open X Window - no video");
}
}
@@ -278,19 +279,19 @@
(int) (rf_height * zoom / 100),
rf_width,
rf_height)) {
- status = REMOTE_ONLY;
+ videoStats.videoAccelStatus = REMOTE_ONLY;
PTRACE(4, "GMVideoDisplay_X\tPIP: Successfully opened remote XV Window");
}
else
{
delete rxWindow;
rxWindow = NULL;
- status = NONE;
+ videoStats.videoAccelStatus = NONE;
PTRACE(1, "GMVideoDisplay_X\tPIP: Could not open remote XV Window");
}
}
#endif
- if (status == NONE) {
+ if (videoStats.videoAccelStatus == NONE) {
PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((localVideoInfo.disableHwAccel)
? " since HW acceleration was deactivated by configuration"
: " since HW acceleration failed to initalize"));
@@ -311,14 +312,14 @@
delete rxWindow;
rxWindow = NULL;
video_disabled = TRUE;
- status = NO_VIDEO;
+ videoStats.videoAccelStatus = NO_VIDEO;
PTRACE(1, "GMVideoDisplay_X\tPIP: Could not open remote X Window - no video");
}
}
#ifdef HAVE_XV
- if (status == REMOTE_ONLY) {
+ if (videoStats.videoAccelStatus == REMOTE_ONLY) {
lxWindow = new XVWindow();
if (lxWindow->Init ( rxWindow->GetDisplay (),
rxWindow->GetWindowHandle (),
@@ -329,7 +330,7 @@
(int) (rf_height * zoom / 100 / 3),
lf_width,
lf_height)) {
- status = ALL;
+ videoStats.videoAccelStatus = ALL;
pipWindowAvailable = TRUE;
PTRACE(4, "GMVideoDisplay_X\tPIP: Successfully opened local XV Window");
}
@@ -341,7 +342,7 @@
}
}
#endif
- if ((status != ALL) && (localVideoInfo.allowPipSwScaling)) {
+ if ((videoStats.videoAccelStatus != ALL) && (localVideoInfo.allowPipSwScaling)) {
PTRACE(3, "GMVideoDisplay_X\tFalling back to SW" << ((localVideoInfo.disableHwAccel)
? " since HW acceleration was deactivated by configuration"
: " since HW acceleration failed to initalize"));
@@ -367,9 +368,9 @@
}
}
- if ((status != ALL) && (!localVideoInfo.allowPipSwScaling)) {
+ if ((videoStats.videoAccelStatus != ALL) && (!localVideoInfo.allowPipSwScaling)) {
PTRACE(3, "GMVideoDisplay_X\tNot opening PIP window since HW acceleration is not available and SW fallback is disabled by configuration");
- status = ALL;
+ videoStats.videoAccelStatus = ALL;
}
if (rxWindow && lxWindow) {
@@ -408,15 +409,17 @@
rxWindow->ToggleOntop ();
}
- runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), status));
+ runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), videoStats.videoAccelStatus));
}
bool
GMVideoDisplay_X::CloseFrameDisplay ()
{
- if (runtime) //FIXME
- runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), NO_VIDEO));
+ if (runtime) { //FIXME
+ videoStats.videoAccelStatus = NO_VIDEO;
+ runtime->run_in_main (sigc::bind (update_video_accel_status.make_slot (), videoStats.videoAccelStatus));
+ }
if (rxWindow)
rxWindow->RegisterSlave (NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]