GNOME Bugzilla – Bug 671614
Cheese/webcam will not save first taken photo on first opening.
Last modified: 2012-11-13 01:19:52 UTC
1. Open Cheese for the first time. 2. Take a photo. Counter will show the countdown, 3, 2, 1 take photo. Thumbnail of the photo is not shown, however, the photo file is saved in the file system.
Cheese uses gfilemonitor to dectect files changes of photo save directory.If photo save directory is not created yet, gfilemonitor has to monitor a missing directory. In lower level(glib/gio), gio checks whether the directory has been created every 4 seconds, if yes, add a watch to detect file changes under the directory. Otherwise, it won’t add watch for the directory. When user takes the first photo, cheese will do two jobs in sequence: 1.Create photo save directory. 2.Create first photo file. Note that the interval of these two jobs is usually less than 1 second. According to above information, it is very possible that(possibility >= 75%) directory and photo file has been created while gio hasn’t add watch for the directory. Thus the create event of first photo file is lost.
Created attachment 220035 [details] [review] Create the video and photo directories. Hi, I made this patch to fix this bug. Please help to review it. Any feedback is welcome. Regards, $4
1. Your system is badly setup, and xdg-user-dirs-update isn't run correctly. The directories should be created on session startup. 2. The patch shouldn't create the directories straight away, but only when needed. 3. 0775 is most likely not the right mode to use
1. My patch is to create ~/Pictures/Webcam and ~/Videos/Webcam. Are they created by xdg-user-dirs-update? I thought they were created by Cheese, but only when first photo or video chip. 2. These two directories are needed by Cheese to put its saving files. Why do we create them when Cheese starts? 3. 0775 is the same permission copied from the same code base in Cheese. To see src/thumbview/cheese-thumb-view.c for `g_mkdir_with_parents (path_videos, 0775);` and `g_mkdir_with_parents (path_photos, 0775);`.
Revising previous comment. Why don't we create them when Cheese starts?
Created attachment 222908 [details] [review] show photo thumbnail(s) when photo dir is not created yet. As mentioned before, I think root cause is gio problem. please check https://bugzilla.gnome.org/show_bug.cgi?id=671518 for more details. Here is a work round solution, patch is attached.
Comment on attachment 220035 [details] [review] Create the video and photo directories. The directories are already created as needed in cheese_fileutil_get_new_media_filename(), and I would rather not duplicate that.
Comment on attachment 222908 [details] [review] show photo thumbnail(s) when photo dir is not created yet. Seems reasonable. Can you split adding the prototype into a separate patch and check to see that the logic is still correct with the latest git master version of Cheese, as there were some changes in file monitoring due to the camerabin2 porting.
Created attachment 223608 [details] updated patch Rebase patch to latest git trunk.Please kindly help to review. Sorry that I haven't test this patch, since it is really a PITA work to set up build environment for latest Cheese on my old machine. However, the original patch for Cheese 3.2.2 is tested OK before.
*** Bug 687094 has been marked as a duplicate of this bug. ***
Created attachment 227535 [details] [review] show first photo thumbnail Cleaned up Changbin's last patch by removing trailing whitespaces and the function prototype. It is still relevant to Git master.
Comment on attachment 227535 [details] [review] show first photo thumbnail Pushed to master and gnome-3-6 as commits 8e8f11bc36ade0120cc006acc6d2730ec91248a0 and 8b06d28da36fed275097ee408a0596ee6c387a9a, thanks!
Thanks all, glad to see this bug is finally fixed.