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 439536 - (games-sound) Warning when quitting while playing a sound
(games-sound) Warning when quitting while playing a sound
Status: RESOLVED FIXED
Product: gnome-games-superseded
Classification: Deprecated
Component: general
2.19.x
Other Linux
: Normal minor
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
Depends on:
Blocks:
 
 
Reported: 2007-05-18 22:13 UTC by Andreas Røsdal
Modified: 2007-05-22 18:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
exemplary patch for gnobots (1.06 KB, patch)
2007-05-20 13:18 UTC, Christian Persch
none Details | Review

Description Andreas Røsdal 2007-05-18 22:13:45 UTC
I get this warning when quitting a game which is currently playing a sound:

Xlib: unexpected async reply (sequence 0x106ab)!

This is related to the new games-sound API, which uses threads to play sounds with GStreamer.
Comment 1 Christian Persch 2007-05-20 13:18:06 UTC
Created attachment 88485 [details] [review]
exemplary patch for gnobots

When I init XThreads, the error goes away. Does GStreamer access X even when only playing sound ?
Comment 2 Andreas Røsdal 2007-05-20 14:26:26 UTC
I don't know if or why GStreamer accesses X when playing sounds. It could be because gnome-games uses Playbin from Gstreamer, which could output both audio and video.

But do you think think that we should commit this?  Could there be any portability-problems with the ifdef's that you've added?




Comment 3 Christian Persch 2007-05-20 23:02:08 UTC
I think we should ask the gstreamer guys for advice :)
Comment 4 Tim-Philipp Müller 2007-05-21 18:16:57 UTC
> I don't know if or why GStreamer accesses X when playing sounds. It could be
> because gnome-games uses Playbin from Gstreamer, which could output both audio
> and video.

GStreamer should not access any X resources as long as the files you're playing only contain audio. Nevertheless, you might want to do something like this

  GstElement *fakevideosink;

  fakevideosink = gst_element_factory_make ("fakesink", "fakevideosink");
  g_object_set (playbin, "video-sink", fakevideosink, NULL);

to make sure it never ever uses a real video sink (e.g. via the autovideosink element which it will try to use if you don't specify a video sink explicitly). If GStreamer really does do X stuff for an audio file, that would be a bug. I'd be surprised if that was the problem though.

Unrelated to this bug, you might also want to set the audio-sink property to a gconfaudiosink element so the user's preferences are honoured if they differ from the default.

What might be related, however, is the way you run main loops from the sound thread functions. I'm not entirely sure how this works across several thread boundaries, but it looks like trouble to me :)  You create a main loop that iterates the default main context (NULL) and then g_main_loop_run(loop) that in your thread function. This is the same main context that Gtk+ uses for the main GUI thread, so you might end up dispatching gtk stuff from your playbin thread if I'm not mistaken (which I well might be).

As far as I can tell, you don't really need the main loop and the bus watch at all. If you're doing playback in a separate thread in a blocking way, you could just do something like this and get rid of the main loop/ bus watch stuff:

  if (!playbin_in_use) {
    gboolean done = FALSE;
    GstBus *bus;

    playbin_in_use = TRUE;  // maybe do atomically or with locking

    bus = gst_pipeline_get_bus (GST_PIPELINE (playbin));

    .. set uri ...
    .. set playbin to PLAYING state ..
    .. (and check return value for STATE_CHANE_FAILURE!) ..

    do {
      GstMessage *msg;

      /* wait for message on the bus */
      msg = gst_bus_timed_pop (bus, GST_CLOCK_TIME_NONE);

      switch (GST_MESSAGE_TYPE (msg)) {
        case GST_MESSAGE_EOS:
        case GST_MESSAGE_ERROR:
          done = TRUE;
          break;
        default:
          break;
      }
      gst_message_unref (msg);
    }
    while (!done);

    ... set playbin to NULL state ...
    ... cleanup ...
    playbin_in_use = FALSE;
  }


Hope this helps.
Comment 5 Andreas Røsdal 2007-05-21 21:54:30 UTC
Thanks for the help, Tim-Phillip. Christian, could you please decrypt the above comment into a patch?  :-)
Comment 6 Andreas Røsdal 2007-05-22 18:24:06 UTC
Thanks for the help, both of you. I have committed a fix, based on the comments from Tim-Philipp.