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 737901 - playbin: no message when current stream ends and setting next uri failed
playbin: no message when current stream ends and setting next uri failed
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.4.3
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-04 19:41 UTC by Alex
Modified: 2018-05-06 12:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alex 2014-10-04 19:41:08 UTC
Using playbin the next uri can be set on the about-to-finish signal while the current stream is still playing.

However, when the next uri is not playable an error message is send immediately on the bus. In this case I want the current stream play until the end but there is no way to tell when it does finish: no message is send and no signal is emitted.

I'm sending EOS myself to the sink but I would expect playbin to do that.
Comment 1 Sebastian Dröge (slomo) 2014-10-07 12:12:51 UTC
Can you provide a simple testcase for this? 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.
Comment 2 Alex 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;
}
Comment 3 Sebastian Dröge (slomo) 2018-05-06 12:11:34 UTC
This should be solved properly with playbin3, delaying the error until the next track actually happens.

If there are still problems, please file a new bug