After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 375866 - plugin broken with xine backend
plugin broken with xine backend
Status: VERIFIED FIXED
Product: totem
Classification: Core
Component: xine-lib backend
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Maintainer alias for xine-lib component of Totem
Maintainer alias for xine-lib component of Totem
: 420519 432416 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-11-16 11:15 UTC by Christian Persch
Modified: 2007-07-13 15:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
xine-lib-dont-fail-select-with-intr.patch (501 bytes, patch)
2007-05-04 17:10 UTC, Bastien Nocera
none Details | Review
totem-xine-backend-queued-actions.patch (5.34 KB, patch)
2007-05-04 17:14 UTC, Bastien Nocera
none Details | Review
totem-2-18-xine-lib-browser-plugin-fix.patch (5.07 KB, patch)
2007-05-05 00:19 UTC, Bastien Nocera
committed Details | Review

Description Christian Persch 2006-11-16 11:15:47 UTC
due to blocking on bvw_open with URI = "fd://0".
Comment 1 Bastien Nocera 2006-11-17 12:05:43 UTC
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().
Comment 2 Bastien Nocera 2006-12-13 14:19:20 UTC
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
Comment 3 Christian Persch 2006-12-13 17:56:10 UTC
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
Comment 4 Bastien Nocera 2006-12-13 18:12:47 UTC
I didn't see that...
I guess I'll need to test it again.
Comment 5 Bastien Nocera 2006-12-20 11:17:38 UTC
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.
Comment 6 Bastien Nocera 2007-01-11 17:54:58 UTC
(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...
Comment 7 Bastien Nocera 2007-01-12 10:34:26 UTC
Did you add a file at /tmp/dmp.mov before loading the page? I really can't reproduce that problem...
Comment 8 Christian Persch 2007-01-17 21:36:20 UTC
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.
Comment 9 Bastien Nocera 2007-02-13 14:47:49 UTC
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
Comment 10 Bastien Nocera 2007-03-20 14:43:25 UTC
*** Bug 420519 has been marked as a duplicate of this bug. ***
Comment 11 Bastien Nocera 2007-03-20 14:44:08 UTC
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.
Comment 12 Bastien Nocera 2007-04-22 23:13:56 UTC
*** Bug 432416 has been marked as a duplicate of this bug. ***
Comment 13 Dan Nicholson 2007-04-22 23:30:50 UTC
I tried the test case gnomevfs-cat'ing to xine and totem. Bad news. Xine works, but totem doesn't.
Comment 14 Bastien Nocera 2007-05-04 15:09:14 UTC
(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
Comment 15 Bastien Nocera 2007-05-04 15:35:21 UTC
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.
Comment 16 Bastien Nocera 2007-05-04 16:24:37 UTC
_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.
Comment 17 Bastien Nocera 2007-05-04 17:10:24 UTC
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...).
Comment 18 Bastien Nocera 2007-05-04 17:14:29 UTC
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.
Comment 19 Bastien Nocera 2007-05-05 00:17:44 UTC
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)
Comment 20 Bastien Nocera 2007-05-05 00:19:20 UTC
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.
Comment 21 Bastien Nocera 2007-05-09 12:30:19 UTC
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)
Comment 22 Frederic Crozat 2007-05-09 12:58:04 UTC
I can confirm it works fine with xine-lib 1.1.6 + patch and totem 2.18.1 + patch.
Comment 23 Dan Nicholson 2007-05-17 18:20:03 UTC
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?
Comment 24 Bastien Nocera 2007-05-17 22:18:19 UTC
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.
Comment 25 Bastien Nocera 2007-07-13 10:16:35 UTC
(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.
Comment 26 Dan Nicholson 2007-07-13 14:51:25 UTC
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
Comment 27 Bastien Nocera 2007-07-13 15:07:47 UTC
(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
Comment 28 Dan Nicholson 2007-07-13 15:18:44 UTC
(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.