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 794893 - proxy: Setting the base_time for dynamically added pipelines does not work
proxy: Setting the base_time for dynamically added pipelines does not work
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.14.0
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-04-02 11:10 UTC by Carlos Rafael Giani
Modified: 2018-11-03 14:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proxy rtsp test (6.83 KB, text/plain)
2018-04-02 11:12 UTC, Carlos Rafael Giani
Details
proxy rtsp test v2 (7.25 KB, text/plain)
2018-04-16 10:30 UTC, Carlos Rafael Giani
Details

Description Carlos Rafael Giani 2018-04-02 11:10:20 UTC
I wanted to try out the new proxy plugin, and read in the proxysrc documentation that the base_time and the pipeline clock need to be the same in all involved pipelines. So I wrote a small test to try out a combinaton of statically and dynamically added receiver pipelines (the latter are GstRTSPMedia objects).

The statically added receiver pipelines work. The dynamically added don't. It turns out that this is because the base_time is reset by something else, even after I explicitely set the base_time to 0:

0:00:00.021872809 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<videotestsrc0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.021918601 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<tee0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.021992707 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<pipeline0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.022245994 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<queue0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.023129957 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<proxysrc0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.023177037 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<queue1> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.023202962 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<videoconvert0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.023230001 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<jpegenc0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.023252936 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<filesink0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.027786899 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<pipeline1> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.028198324 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<queue2> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.028237121 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<proxysink0> set base_time=0:00:00.000000000, old 0:00:00.000000000
0:00:00.054788131 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<pipeline1> set base_time=7:38:23.167300801, old 0:00:00.000000000
0:00:00.055122293 27152 0x5570b3631300 DEBUG              GST_CLOCK gstelement.c:489:gst_element_set_base_time:<pipeline0> set base_time=7:38:23.167661484, old 0:00:00.000000000

Note the base_time of pipeline0 and pipeline1.

I think the example given in the proxysrc documentation works because both pipelines' base_time is reset to the same value.
Comment 1 Carlos Rafael Giani 2018-04-02 11:12:54 UTC
Created attachment 370434 [details]
proxy rtsp test

Here is the test code I mentioned. You can compile it like this:

g++ -std=c++11 -O0 -g3 -ggdb -o gstproxy-rtsp-file-example gstproxy-rtsp-file-example.cpp $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)

Perhaps the error is in my example. I hacked this together quickly.
Comment 2 Carlos Rafael Giani 2018-04-16 10:29:31 UTC
This discussed idea works:

"1. All pipelines should have gst_element_set_start_time (e, NONE) when 
   they are created. This will disable automatic distribution of 
   base_time when the pipeline goes from PAUSED -> PLAYING.
2. Need to store the base time of the pipeline that is started first 
   and is always running (in your case media_source with videotestsrc).
3. All pipelines added at a later time must be set to that same base 
   time so the running time of all pipelines is the same.

(2) and (3) mean the base time has to be initialized with appropriate
locking; perhaps guarded by a GOnce."

However, if I play the RTSP stream ( rtsp://127.0.0.1:1999/test ) with VLC, this can cause the example to break. I sometimes see this:

0:00:15.951076143  7983 0x7fb9f00018a0 INFO                GST_PADS gstpad.c:4189:gst_pad_peer_query:<udpsrc1:src> pad has no peer
0:00:15.951117442  7983 0x7fba00003850 INFO        GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<funnel5> adding pad 'funnelpad3'
0:00:15.951117280  7983 0x7fb9f00018a0 INFO               GST_EVENT gstevent.c:895:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:15.951133430  7983 0x7fba00003850 INFO        GST_ELEMENT_PADS gstelement.c:920:gst_element_get_static_pad: found pad udpsrc1:src
0:00:15.951148020  7983 0x7fb9f00018a0 INFO                 basesrc gstbasesrc.c:2945:gst_base_src_loop:<udpsrc1> marking pending DISCONT
0:00:15.951149671  7983 0x7fba00003850 INFO                GST_PADS gstpad.c:2378:gst_pad_link_prepare: trying to link udpsrc1:src and funnel5:funnelpad3
0:00:15.951157638  7983 0x7fb9f00018a0 INFO                 basesrc gstbasesrc.c:2965:gst_base_src_loop:<udpsrc1> pausing after gst_pad_push() = not-linked
0:00:15.951174967  7983 0x7fb9f00018a0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc1> error: Internal data stream error.
0:00:15.951181742  7983 0x7fb9f00018a0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc1> error: streaming stopped, reason not-linked (-1)

.....

0:00:15.952402510  7983 0x7fb9f00018a0 INFO        GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details:<udpsrc1> posting message: Internal data stream error.
0:00:15.952429819  7983 0x7fb9f4001680 INFO              GST_STATES gstbin.c:3422:bin_handle_async_done:<media-pipeline> committing state from PAUSED to PAUSED, old pending PLAYING
0:00:15.952443576  7983 0x7fb9f4001680 INFO              GST_STATES gstbin.c:3451:bin_handle_async_done:<media-pipeline> continue state change, pending PLAYING
0:00:15.952438953  7983 0x7fb9f00019e0 INFO               rtspmedia rtsp-media.c:2778:default_handle_message: 0x7fb9f000f220: got message type 16 (tag)
0:00:15.952459198  7983 0x7fb9f00018a0 INFO        GST_ERROR_SYSTEM gstelement.c:2172:gst_element_message_full_with_details:<udpsrc1> posted error message: Internal data stream error.
0:00:15.952454226  7983 0x7fb9f4001680 INFO              GST_STATES gstelement.c:2579:_priv_gst_element_state_changed:<media-pipeline> notifying about state-changed PAUSED to PAUSED (PLAYING pending)
0:00:15.952491419  7983 0x7fb9f00019e0 WARN               rtspmedia rtsp-media.c:2720:default_handle_message: 0x7fb9f000f220: got error Internal data stream error. (gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:media-pipeline/GstUDPSrc:udpsrc1:
streaming stopped, reason not-linked (-1))
0:00:15.952514914  7983 0x7fb9f00018a0 INFO               GST_EVENT gstevent.c:814:gst_event_new_caps: creating caps event application/x-rtcp
0:00:15.952544689  7983 0x7fba00003850 WARN               rtspmedia rtsp-media.c:3933:default_unsuspend: failed to preroll pipeline
0:00:15.952554440  7983 0x7fba00003850 WARN               rtspmedia rtsp-media.c:3974:gst_rtsp_media_unsuspend: failed to unsuspend media 0x7fb9f000f220
0:00:15.952562849  7983 0x7fba00003850 ERROR             rtspclient rtsp-client.c:1742:handle_play_request: client 0x7fba18026eb0: unsuspend failed
0:00:15.952586189  7983 0x7fb9f00018a0 INFO                    task gsttask.c:316:gst_task_func:<udpsrc1:src> Task going to paused


Apparently, this affects the source pipeline as well, since subsequent playback attempts (with VLC or gst-play) fail.

If I only use gst-play, this never happens.
Comment 3 Carlos Rafael Giani 2018-04-16 10:30:32 UTC
Created attachment 370983 [details]
proxy rtsp test v2

Here is the test code with the aforementioned updates.
Comment 4 Nirbheek Chauhan 2018-04-16 11:16:11 UTC
This doesn't look like it's a problem with the proxy elements; can you try to reproduce it with either test-launch in rtsp-server or in your example without the proxy elements?

If you can narrow it down to a test case with test-launch and vlc as the client, it would be easier to reproduce and track down.
Comment 5 Carlos Rafael Giani 2018-04-16 11:18:16 UTC
I can try that. But the proxy-relevant bit here is that the GstRTSPMedia pipeline error also causes failure in the media source pipeline. I wonder if it is possible to "shield" pipelines so that failure in one does not break the other.
Comment 6 Carlos Rafael Giani 2018-04-16 11:21:01 UTC
I tried this: ./test-launch "( videotestsrc ! videoconvert ! x264enc ! h264parse ! rtph264pay name=pay0 )"

with VLC, and no such failure occurs. I do see artifacts at the beginning, but as said, this seems to be different problem involving the RTSP-h264 combo. Either way, this works every time.
Comment 7 GStreamer system administrator 2018-11-03 14:20:51 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/683.