[Bug 737901] playbin: no message when current stream ends and setting next uri failed

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Oct 9 08:13:43 PDT 2014


https://bugzilla.gnome.org/show_bug.cgi?id=737901
  GStreamer | gst-plugins-base | 1.4.3

--- Comment #2 from Alex <wegwerf at abwesend.de> 2014-10-09 15:13:37 UTC ---

> But in general you're supposed to
> shut down the pipeline when an error message is received, and can't assume that
> anything works afterwards.

Doesn't that depend on the error? 
I don't know if the next track can be played until I try it. And when I do,
it's
too late and I have to stop the current track?

A complete testcase is difficult for me to provide. But this extract should
make clear what I mean (I hope):

GstElement* pipeline;
const char* next_uri_not_decodable = "file:///broken_song.ogg";
bool next_uri_set;

static void about_to_finish_cb(GstPlayBin* bin, gpointer obj) {
  GstTest *gst_test = reinterpret_cast<GstTest*>(obj);

  gst_test->next_uri_set = true;
  g_object_set(G_OBJECT(gst_test->pipeline), "uri",
gst_test->next_uri_not_decodable, nullptr);
}

static gboolean bus_cb(GstBus* bus, GstMessage* msg, gpointer obj) {
  GstTest *gst_test = reinterpret_cast<GstTest*>(obj);

  switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_ERROR: {

      GError* error;
      gchar* debugs;
      gst_message_parse_error(msg, &error, &debugs);
      int domain = error->domain;
      g_error_free(error);
      free(debugs);

      GstState state, state_pending;
      gst_element_get_state(gst_test->pipeline, &state, &state_pending, 1 *
GST_SECOND);

      if (state == GST_STATE_PLAYING && gst_test->next_uri_set &&
          (domain == GST_RESOURCE_ERROR || domain == GST_STREAM_ERROR)) {
      // A track is still playing and the next URI is not playable. We ignore
      // the error here so the current track (which is playing fine) can play
      // until the end.
      } else {
        emit gst_test->Error();
      }
      break;
    }

    case GST_MESSAGE_EOS: {
      // If there was an error for the next URI we will never get here.
      emit gst_test->Finished();
      break;
    }

    default:
      break;
  }
  return TRUE;
}

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list