aboutsummaryrefslogtreecommitdiffstats
path: root/src/callbacks.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-07-24 12:18:39 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-07-24 12:45:56 (GMT)
commit3bbc07f94c3bf49e2828902dfeb3f6f2e6953336 (patch)
treeeabf27fc04fd80cb27275e5573b339b78ff89cf8 /src/callbacks.c
parent00dca626855904e955ec4c164505a0bc34db671d (diff)
Prevent activating an already active size
Changing resolution is costly, as we need first to wait for pending buffers and stop streaming. So, optimize resolution switch by not trying to activate the already activated resolution.
Diffstat (limited to 'src/callbacks.c')
-rw-r--r--src/callbacks.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 0b193c8..3db9ba5 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -364,29 +364,32 @@ void on_change_size_activate (GtkWidget * widget, cam * cam)
{
gchar const *name;
gchar *title;
+ int width, height;
name = gtk_widget_get_name (widget);
- printf("name = %s\n",name);
+
if (strcmp (name, "small") == 0) {
- cam->width = cam->min_width;
- cam->height = cam->min_height;
- if (cam->debug) {
- printf ("\nsmall\n");
- }
+ width = cam->min_width;
+ height = cam->min_height;
} else if (strcmp (name, "medium") == 0) {
- cam->width = cam->max_width / 2;
- cam->height = cam->max_height / 2;
- if (cam->debug) {
- printf ("\nmed\n");
- }
+ width = cam->max_width / 2;
+ height = cam->max_height / 2;
} else {
- cam->width = cam->max_width;
- cam->height = cam->max_height;
- if (cam->debug) {
- printf ("\nlarge\n");
- }
+ width = cam->max_width;
+ height = cam->max_height;
}
+ try_set_win_info(cam, &width, &height);
+
+ /* Nothing to do, so just return */
+ if (width == cam->width && height == cam->height)
+ return;
+
+ cam->width = width;
+ cam->height = height;
+
+ printf("name = %s\n",name);
+
if (cam->read == FALSE)
stop_streaming(cam);
set_win_info (cam);

Privacy Policy