Merge lp:~sylvain-pineau/checkbox/story482.7_screenshot_fullscreen_video into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Merged at revision: 1302
Proposed branch: lp:~sylvain-pineau/checkbox/story482.7_screenshot_fullscreen_video
Merge into: lp:checkbox
Diff against target: 176 lines (+97/-15) (has conflicts)
4 files modified
debian/changelog (+10/-0)
debian/control (+1/-1)
jobs/graphics.txt.in (+21/-0)
scripts/gst_pipeline_test (+65/-14)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/story482.7_screenshot_fullscreen_video
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Marc Tardif (community) Approve
Jeff Lane  Needs Fixing
Review via email: mp+95575@code.launchpad.net

Description of the change

This proposal comes with a new gst_pipeline_test script which support fullscreen video playback by forcing the video sink element to use a specific Gtk Window identifier for rendering.

A new features ensures that the video playback will loop until the given timeout is reached by seeking to the first frame on EOS events.

A new job takes care of performing a still capture during a fullscreen video playback.

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

I'm not comfortable with hard coding /dev/video1 into the job command like that.

On the system I tested with, I somehow ended up with three video devices:
bladernr@klaatu:~$ find /dev -name video*
/dev/video1
/dev/video0
bladernr@klaatu:~$ find /dev -name video*
/dev/video2
/dev/video1
/dev/video0

And in my system, the USB webcam I just plugged in is video2, not video1.

Also, some systems may not already have a built in webcam... for example, my Thinkpad x201:

bladernr@GarbageScow:~/Downloads$ find /dev -name video*
bladernr@GarbageScow:~/Downloads$

and after plugging in the webcam:

bladernr@GarbageScow:~/Downloads$ find /dev -name video*
/dev/video0
bladernr@GarbageScow:~/Downloads$

review: Needs Fixing
Revision history for this message
Daniel Manrique (roadmr) wrote :

As things continue moving towards gtk3 and gi.repository the bug will need to be addressed. We can expect some pressure to port all of our test scripts to avoid depending on python-gtk2. Once this makes it in, we need to keep an eye on the bug and on whether python-gtk2 is still on the default cd.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

@Daniel, the latest manifest still mentions python-gtk2, so i think we're good with precise. The bug with the gi Gst version should be solved for gstreamer-0.11 or version 1. So yes, i'll keep an eye on this bug to move this code to gtk3 asap.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

@Jeff,

I'm not super happy with the hard-coded /dev/video1 too and Javier Collado proposed to take the higher digit of video device to find the usb camera. The change will certainly be in the camera_test script. Once done, all jobs like this one (with /dev/video1) will be corrected.

Revision history for this message
Javier Collado (javier.collado) wrote :

@Jeff

Please find the changes Sylvain mentioned in the previous comment in this merge proposal:
https://code.launchpad.net/~javier.collado/checkbox/story482_avoid_hardcoding_device/+merge/95867

1294. By Sylvain Pineau

Updated job commands to use --highest-device to find the USB camera

1295. By Sylvain Pineau

typo fixed

Revision history for this message
Marc Tardif (cr3) wrote :

In jobs/graphics.txt.in, I see the following command:

+command:
+ gst_pipeline_test -t 20 -f "playbin2 uri=file://${CHECKBOX_SHARE}/data/video/Ogg_Theora_Video.ogv" &
+ sleep 15 && camera_test still --highest-device -f ${CHECKBOX_DATA}/screenshot_fullscreen_video.jpg -q 2>&1 | ansi_parser

So, you run a gst_pipeline_test for 20 seconds in the background and then sleep for 15 seconds before running the camera_test. Any reason why you're sleeping for such a long time?

The rest looks good though, so I'd merge after clarifying the above question.

review: Needs Information
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I wanted the playback to run for a longer period before performing the screengrab, maximizing the chance to find a bug. As the file is just a 4s sample, looping/waiting 15s seemed to me quite reasonable

Revision history for this message
Marc Tardif (cr3) wrote :

Is there any precedent of a bug occuring within those 15 seconds or is that hypothetical?

review: Needs Information
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Not really, I not only want to trap bugs that occur at the beginning of the playback but also those that may happen later. So yes later is difficult to estimate. That's why am looping 3 times the same video before the performing screenshot. I don't want to create a stress test for this one but 15 seconds is not so long.

Revision history for this message
Marc Tardif (cr3) wrote :

Agreed, 15 seconds sounds reasonable then. Merging and pushing. Thanks!

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

Even if the branch is already merged, I just want to add that I've finally been able to run the test cases and submit the results successfully (using the merged changes in trunk).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-03-05 14:40:48 +0000
3+++ debian/changelog 2012-03-05 16:27:21 +0000
4@@ -42,6 +42,7 @@
5 plugins/jobs_prompt.py: Added a progress bar showing tests completed and
6 total.
7
8+<<<<<<< TREE
9 [Tiago Salem Herrmann]
10 * checkbox_qt/qt_interface.py, qt/frontend/qtfront.cpp,
11 qt/frontend/qtfront.h, qt/frontend/treemodel.cpp, qt/frontend/treemodel.h:
12@@ -49,6 +50,15 @@
13 children nodes.
14
15 -- Jeff Lane <jeff@ubuntu.com> Fri, 02 Mar 2012 12:13:34 -0500
16+=======
17+ [Sylvain Pineau]
18+ * Updated gst_pipeline_test to add a --fullscreen option for video playback.
19+ * Add python-gtk2 dependency, Gst from gi.repository don't work well with
20+ messages (See https://bugzilla.gnome.org/show_bug.cgi?id=631901).
21+ * Add a new job to capture screen during fullscreen video playback.
22+
23+ -- Daniel Manrique <roadmr@ubuntu.com> Thu, 01 Mar 2012 17:32:15 -0500
24+>>>>>>> MERGE-SOURCE
25
26 checkbox (0.13.3) precise; urgency=low
27
28
29=== modified file 'debian/control'
30--- debian/control 2012-02-24 10:05:04 +0000
31+++ debian/control 2012-03-05 16:27:21 +0000
32@@ -11,7 +11,7 @@
33 Section: python
34 Architecture: any
35 Depends: ${misc:Depends}, ${python:Depends}, debconf, python-libxml2, udev
36-Recommends: dpkg (>= 1.13), gstreamer0.10-gconf, lsb-release, perl, pm-utils, python-apport, python-apt, python-dateutil, python-gst0.10
37+Recommends: dpkg (>= 1.13), gstreamer0.10-gconf, lsb-release, perl, pm-utils, python-apport, python-apt, python-dateutil, python-gst0.10, python-gtk2
38 Suggests: checkbox-cli | checkbox-gtk, bonnie++, bootchart, bzr, cvs, ethtool, flex, fwts, git-core, hdparm, lshw, make, nmap, obexd-client, python-pexpect, smartmontools, sox, stress, wodim
39 Description: System testing application
40 This project provides an extensible interface for system testing. The
41
42=== modified file 'jobs/graphics.txt.in'
43--- jobs/graphics.txt.in 2012-03-05 16:10:58 +0000
44+++ jobs/graphics.txt.in 2012-03-05 16:27:21 +0000
45@@ -163,3 +163,24 @@
46 depends: graphics/screenshot
47 command: cat ${CHECKBOX_DATA}/screenshot.jpg
48 _description: Attaches the screenshot captured in graphics/screenshot.
49+
50+plugin: shell
51+name: graphics/screenshot_fullscreen_video
52+requires: package.name == 'fswebcam'
53+command:
54+ gst_pipeline_test -t 20 -f "playbin2 uri=file://${CHECKBOX_SHARE}/data/video/Ogg_Theora_Video.ogv" &
55+ sleep 15 && camera_test still --highest-device -f ${CHECKBOX_DATA}/screenshot_fullscreen_video.jpg -q 2>&1 | ansi_parser
56+_description:
57+ PURPOSE:
58+ Take a screengrab of the current screen during fullscreen video playback
59+ STEPS:
60+ 1. Start a fullscreen video playback
61+ 2. Take picture using USB webcam after a few seconds
62+ VERIFICATION:
63+ 1. Review attachment manually later
64+
65+plugin: attachment
66+name: screenshot_fullscreen_video.jpg
67+depends: graphics/screenshot_fullscreen_video
68+command: cat ${CHECKBOX_DATA}/screenshot_fullscreen_video.jpg
69+_description: Attaches the screenshot captured in graphics/screenshot_fullscreen_video.
70
71=== modified file 'scripts/gst_pipeline_test'
72--- scripts/gst_pipeline_test 2008-10-23 03:34:16 +0000
73+++ scripts/gst_pipeline_test 2012-03-05 16:27:21 +0000
74@@ -1,37 +1,88 @@
75 #!/usr/bin/python
76
77+# Note: this code is not based on gi.repository because of a bug that prevents
78+# sync-message to be decoded from the bus (current message reports "None" in
79+# all cases). See https://bugzilla.gnome.org/show_bug.cgi?id=631901
80+
81 import sys
82-import time
83-
84+import gtk
85+import gobject
86 import pygst
87 pygst.require("0.10")
88-
89+import gst
90 from optparse import OptionParser
91
92
93+class GTK_Main:
94+
95+ def __init__(self, pipeline, options):
96+ self.options = options
97+ self.loop = gobject.MainLoop()
98+ self.player = gst.parse_launch(pipeline)
99+ bus = self.player.get_bus()
100+ bus.add_signal_watch()
101+ bus.enable_sync_message_emission()
102+ bus.connect("message", self.on_message)
103+ bus.connect("sync-message::element", self.on_sync_message)
104+ self.player.set_state(gst.STATE_PLAYING)
105+ gobject.timeout_add(self.options.timeout*1000, self.timeout_cb)
106+ self.loop.run()
107+
108+ def delete_event(self, widget, event, data=None):
109+ return False
110+
111+ def destroy(self, widget, data=None):
112+ self.timeout_cb()
113+
114+ def on_message(self, bus, message):
115+ t = message.type
116+ if t == gst.MESSAGE_EOS:
117+ self.player.seek_simple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, 0)
118+
119+ def on_sync_message(self, bus, message):
120+ if message.structure is None:
121+ return
122+ message_name = message.structure.get_name()
123+ if message_name == "prepare-xwindow-id":
124+ gtk.gdk.threads_enter()
125+ gtk.gdk.display_get_default().sync()
126+ self.window = gtk.Window()
127+ self.window.connect("delete_event", self.delete_event)
128+ self.window.connect("destroy", self.destroy)
129+ self.movie_window = gtk.DrawingArea()
130+ self.window.add(self.movie_window)
131+ if self.options.fullscreen:
132+ self.window.fullscreen()
133+ self.window.show_all()
134+ imagesink = message.src
135+ imagesink.set_property("force-aspect-ratio", True)
136+ imagesink.set_xwindow_id(self.movie_window.window.xid)
137+ gtk.gdk.threads_leave()
138+
139+ def timeout_cb(self):
140+ self.player.set_state(gst.STATE_NULL)
141+ self.loop.quit()
142+
143+
144 def main(args):
145- import gst
146-
147 usage = "Usage: %prog [OPTIONS] PIPELINE"
148 parser = OptionParser(usage=usage)
149 parser.add_option("-t", "--timeout",
150 type="int",
151- default=0,
152+ default=-1,
153 help="Timeout for running the pipeline.")
154+ parser.add_option("-f", "--fullscreen",
155+ default=False,
156+ action="store_true",
157+ help="Fullscreen mode (pipeline with video sink only).")
158 (options, args) = parser.parse_args(args)
159
160 if len(args) != 1:
161 parser.error("Must provide a PIPELINE")
162
163 pipeline = args[0]
164- element = gst.parse_launch(pipeline)
165- element.set_state(gst.STATE_PLAYING)
166-
167- if options.timeout:
168- time.sleep(options.timeout)
169-
170- element.set_state(gst.STATE_NULL)
171- return 0
172+ gtk.gdk.threads_init()
173+ GTK_Main(pipeline, options)
174
175
176 if __name__ == "__main__":

Subscribers

People subscribed via source and target branches