GNOME Bugzilla – Bug 375866
plugin broken with xine backend
Last modified: 2007-07-13 15:18:44 UTC
due to blocking on bvw_open with URI = "fd://0".
Problem is that xine-lib will only return from _open() once it has received enough data to gather the metadata from the stream (which demuxer/decoder/etc. to use). We need to add some threading to the xine-lib backend, and feed the input until it returns from _open().
2006-12-13 Bastien Nocera <hadess@hadess.net> * src/backend/bacon-video-widget-xine.c: (bacon_video_widget_open_async_error), (bacon_video_widget_open_thread), (bacon_video_widget_open_async), (bacon_video_widget_open_with_subtitle), (bacon_video_widget_close): open fd://0 async, so that it doesn't block waiting for data to come in, fixes the browser plugin with xine-lib (Closes: #375866) * src/backend/bvw-test.c: (test_bvw_set_mrl), (on_redirect), (on_eos_event), (error_cb), (main): catch errors, fix up indent
Now when I try the src/test.html test page, it hangs the browser (!) for about 10 -20 seconds. And I get these warnings: ** Message: BEFORE _open ** (totem-plugin-viewer:23399): CRITICAL **: bacon_video_widget_open_with_subtitle: assertion `bvw->com->mrl == NULL' failed ** Message: AFTER _open (totem-plugin-viewer:23399): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
I didn't see that... I guess I'll need to test it again.
We would need to use pthreads, instead of GThread, so that we can cancel threads (we can't with GThread because of bug 324931), and follow the example in: http://www.mail-archive.com/xine-cvslog@lists.sourceforge.net/msg00888.html Need to up the xine-lib reqs as well.
(In reply to comment #3) > Now when I try the src/test.html test page, it hangs the browser (!) for about > 10 -20 seconds. And I get these warnings: I don't see this in my tests...
Did you add a file at /tmp/dmp.mov before loading the page? I really can't reproduce that problem...
It happens in the SetLocalFile call which is sync (because of the temp file issue). So once we fix that and make the SetLocalFile call async, this should be gone.
We can cancel the _open now: 2007-02-13 Bastien Nocera <hadess@hadess.net> * configure.in: * src/backend/bacon-video-widget-xine.c: (bacon_video_widget_finalize), (bacon_video_widget_new), (bacon_video_widget_open_thread), (bacon_video_widget_open_async), (bacon_video_widget_play), (bacon_video_widget_close): Use pthreads instead of GThreads so we can cancel the xine_open, require a xine-lib that can cancel xine_open as well
*** Bug 420519 has been marked as a duplicate of this bug. ***
From bug 420519: > follow-up of http://qa.mandriva.com/show_bug.cgi?id=29513 > 1/ make sure you use totem xine-based mozilla plugin > 2/ go to http://fredrik.hubbe.net/plugger/test.mpg in your favorite browser > 3/ no thing appears That's a dupe of bug 375866. > two problems here : > -plugin is using fd://0 but xine-backend doesn't understand this mrl, which > must be replaced by stdin://0 No. The backend does understand it, unless you have an ancient version of xine-lib. In src/input/input_stdin_fifo.c stdin_class_get_instance(): if (!strncasecmp(mrl, "stdin:/", 7) || !strncmp(mrl, "-", 1) || !strncmp(mrl, "fd://0", 6)) { revision 1.57 date: 2004/04/19 20:20:51; author: hadess; state: Exp; lines: +3 -2 - also accept "fd://0" as an mrl for stdin input, as used by GStreamer I added support 3 years ago :) > -once this modification is done, playback isn't possible because buffer seems > empty. That's because the xine-lib open() blocks waiting for data, whereas the GStreamer one doesn't. We try to work around that and return ASAP from the bvw_open() by spawning a thread. I'm not sure what the problem is with the xine-lib backend, but it seems that the problems might be due to xine-lib itself. Ie. if "gnomevfs-cat http://fredrik.hubbe.net/plugger/test.mpg | xine fd://0" works, but "gnomevfs-cat http://fredrik.hubbe.net/plugger/test.mpg | totem fd://0" doesn't, then the problem lies with the the Totem code.
*** Bug 432416 has been marked as a duplicate of this bug. ***
I tried the test case gnomevfs-cat'ing to xine and totem. Bad news. Xine works, but totem doesn't.
(In reply to comment #13) > I tried the test case gnomevfs-cat'ing to xine and totem. Bad news. Xine works, > but totem doesn't. That now works, as we make sure that the open() happens before play is possible, but it means that we deadlock in the browser plugin, as open isn't finished, play is blocking, and no data is being read from the plugin yet. 2007-05-04 Bastien Nocera <hadess@hadess.net> * src/backend/bacon-video-widget-xine.c: (bacon_video_widget_open_async), (bacon_video_widget_open_with_subtitle), (bacon_video_widget_play): Yield to the newly created open() thread so that we can block on open later, fix "cat foo | totem fd://0" not working, fix a comment about the icyx protocol * src/totem-menu.c: (totem_action_add_recent): don't try to add movies without a mime-type to the recent files list
I tried making it not-block on play, and push the play, pause, etc. once the open finished, but I still end up with the stdin/fifo plugin reading nothing from the stdin, and failing atrociously to do anything. If somebody fancies helping out a bit on that.
_x_io_select() (which the stdin plugin ultimately uses to read data off the stdin) exits with a EINTR errno, as XIO_ERROR after less than a second. I don't think _x_io_select should break on EINTR, but fixing this just makes it hang trying to get data out.
Created attachment 87550 [details] [review] xine-lib-dont-fail-select-with-intr.patch This makes the stdin plugin not exit straight away when the select gets interrupted (by god knows what...).
Created attachment 87552 [details] [review] totem-xine-backend-queued-actions.patch Queue actions that occur during the open() rather than punt them, or fail on them.
2007-05-05 Bastien Nocera <hadess@hadess.net> * configure.in: Up the required xine-lib version, to get the xine-lib fix at http://hg.debian.org/hg/xine-lib/xine-lib?cmd=changeset;node=2b182beaba68;style=gitweb * src/backend/bacon-video-widget-xine.c: (bacon_video_widget_finalize), (bacon_video_widget_new), (bacon_video_widget_open_thread), (bacon_video_widget_play), (bacon_video_widget_stop), (bacon_video_widget_close), (bacon_video_widget_pause): Queue the actions that occur during the threaded open() so that we can apply them when we really finished the open(), Fixes the xine-lib backend for use in the browser plugin (Closes: #375866)
Created attachment 87580 [details] [review] totem-2-18-xine-lib-browser-plugin-fix.patch To commit to the 2-18 branch once I've had some more feedback on the patch(es). Frederic, could you please test whether it works for you? Make sure you apply the xine-lib patch as well.
Committed to gnome-2-18. 2007-05-09 Bastien Nocera <hadess@hadess.net> * configure.in: Up the required xine-lib version, to get the xine-lib fix at http://hg.debian.org/hg/xine-lib/xine-lib?cmd=changeset;node=2b182beaba68;style=gitweb * src/backend/bacon-video-widget-xine.c: (bacon_video_widget_finalize), (bacon_video_widget_new), (bacon_video_widget_open_thread), (bacon_video_widget_open_async), (bacon_video_widget_play), (bacon_video_widget_stop), (bacon_video_widget_close), (bacon_video_widget_pause): Yield to the newly created open() thread so that we can block on open later, fix "cat foo | totem fd://0" not working; Queue the actions that occur during the threaded open() so that we can apply them when we really finished the open(), Fixes the xine-lib backend for use in the browser plugin (Closes: #375866)
I can confirm it works fine with xine-lib 1.1.6 + patch and totem 2.18.1 + patch.
I applied the two patches and it works pretty well, but it's not perfect. I'm not at home to test right now or provide logs, so I'll repost later if you'd like. Anyway, it seems like there still some sort of race. If I start a movie, sometimes the audio will come up, but totem's visualization will play instead of the video. Refreshing usually gets both streams going. Here's the movie I had trouble with: http://www.linspire.com/file_types/wmv_sample.php http://www.linspire.com/file_types/filetypes.php Any ideas?
I saw that as well, but I believe it's a problem with xine-lib, not with Totem. Please open another bug, and push the debug logs you have with it.
(In reply to comment #23) <snip> > Anyway, it seems like there still some sort of race. If I start a movie, > sometimes the audio will come up, but totem's visualization will play instead > of the video. Refreshing usually gets both streams going. Here's the movie I > had trouble with: This is fixed in SVN now.
Is this the commit, and is it safe to backport to 2.18.2? http://svn.gnome.org/viewcvs/totem/trunk/src/backend/bacon-video-widget-xine.c?r1=4411&r2=4436&sortby=date
(In reply to comment #26) > Is this the commit, and is it safe to backport to 2.18.2? Yes, and it's already on the 2.18 branch
(In reply to comment #27) > > Yes, and it's already on the 2.18 branch Wow, it helps if you look :) OK, I just tried totem-2.18-2+patch and xine-lib-1.1.7 and everything seems to be working fine now. Thanks, Bastien.