From: <rb...@fr...> - 2005-02-24 10:45:51
|
CVS Root: /cvs/gstreamer Module: gst-plugins Changes by: rbultje Date: Thu Feb 24 2005 02:45:46 PST Branch: BRANCH-GSTREAMER-0_8 Log message: * gst/playback/gstplaybasebin.c: (check_queue), (buffer_underrun), (buffer_running), (buffer_overrun), (gen_source_element): Remove probe when no longer blocking for buffering (requested). Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.1641.2.4&r2=1.1641.2.5 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/playback/gstplaybasebin.c.diff?r1=1.62&r2=1.62.2.1 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.1641.2.4 retrieving revision 1.1641.2.5 diff -u -d -r1.1641.2.4 -r1.1641.2.5 --- ChangeLog 23 Feb 2005 23:37:24 -0000 1.1641.2.4 +++ ChangeLog 24 Feb 2005 10:45:34 -0000 1.1641.2.5 @@ -1,3 +1,9 @@ +2005-02-24 Ronald S. Bultje <rb...@ro...> + + * gst/playback/gstplaybasebin.c: (check_queue), (buffer_underrun), + (buffer_running), (buffer_overrun), (gen_source_element): + Remove probe when no longer blocking for buffering (requested). 2005-02-24 Gergely Nagy <alg...@bo...> reviewed by: Maciej Katafiasz Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins/gst/playback/gstplaybasebin.c,v retrieving revision 1.62 retrieving revision 1.62.2.1 diff -u -d -r1.62 -r1.62.2.1 --- gstplaybasebin.c 25 Jan 2005 16:10:33 -0000 1.62 +++ gstplaybasebin.c 24 Feb 2005 10:45:34 -0000 1.62.2.1 @@ -922,9 +922,12 @@ g_object_get (G_OBJECT (queue), "current-level-bytes", &level, NULL); GST_DEBUG ("Queue size: %u bytes", level); + level = level * 100 / (64 * 1024); + if (level > 100) + level = 100; g_signal_emit (play_base_bin, - gst_play_base_bin_signals[BUFFERING_SIGNAL], 0, - level * 100 / (512 * 1024)); + gst_play_base_bin_signals[BUFFERING_SIGNAL], 0, level); /* continue! */ return TRUE; @@ -933,6 +936,9 @@ static void buffer_underrun (GstElement * queue, GstPlayBaseBin * play_base_bin) { + GstProbe *probe; + GstPad *sourcepad; GST_DEBUG ("Underrun, re-caching"); /* On underrun, we want to temoprarily pause playback, set a "min-size" @@ -942,16 +948,45 @@ gst_play_base_bin_signals[BUFFERING_SIGNAL], 0, 0); + /* re-connect probe */ + if (!(probe = g_object_get_data (G_OBJECT (queue), "probe"))) { + probe = gst_probe_new (FALSE, check_queue, queue); + sourcepad = GST_PAD_PEER (gst_element_get_pad (queue, "sink")); + gst_pad_add_probe (sourcepad, probe); + g_object_set_data (G_OBJECT (queue), "probe", probe); + GST_DEBUG_OBJECT (play_base_bin, + "Re-attaching buffering probe %p to pad %s:%s (%p)", + probe, GST_DEBUG_PAD_NAME (sourcepad), sourcepad); + } } buffer_running (GstElement * queue, GstPlayBaseBin * play_base_bin) GST_DEBUG ("Running"); /* When we had an underrun, we now want to play again. */ g_object_set (queue, "min-threshold-bytes", 0, "max-size-bytes", 512 * 1024, NULL); + if ((probe = g_object_get_data (G_OBJECT (queue), "probe"))) { + GstPad *sourcepad; + "Removing buffer probe %p from pad %s:%s (%p)", + g_signal_emit (play_base_bin, + gst_play_base_bin_signals[BUFFERING_SIGNAL], 0, 100); + g_object_set_data (G_OBJECT (queue), "probe", NULL); + gst_pad_remove_probe (sourcepad, probe); + gst_probe_destroy (probe); @@ -962,8 +997,8 @@ /* we want to decrease max-size here so the next few bytes are flushed */ g_object_set (queue, "max-size-bytes", 448 * 1024, NULL); - g_signal_emit (play_base_bin, - gst_play_base_bin_signals[BUFFERING_SIGNAL], 0, 100); + /*g_signal_emit (play_base_bin, + gst_play_base_bin_signals[BUFFERING_SIGNAL], 0, 100); */ /* @@ -1005,6 +1040,7 @@ GstElement *source, *queue, *bin; GstProbe *probe; gboolean is_stream; /* stip subtitle from uri */ if (!play_base_bin->uri) @@ -1043,8 +1079,12 @@ /* give updates on queue size */ probe = gst_probe_new (FALSE, check_queue, queue); - gst_pad_add_probe (gst_element_get_pad (source, "src"), probe); + sourcepad = gst_element_get_pad (source, "src"); + gst_pad_add_probe (sourcepad, probe); + GST_DEBUG_OBJECT (play_base_bin, "Attaching probe %p to pad %s:%s (%p)", + probe, GST_DEBUG_PAD_NAME (sourcepad), sourcepad); g_object_set_data (G_OBJECT (queue), "pbb", play_base_bin); + g_object_set_data (G_OBJECT (queue), "probe", probe); gst_element_link (source, queue); gst_bin_add_many (GST_BIN (bin), source, queue, NULL); |