Hi team
I am developing an application that uses Gstreamer for reading audio files. I am using a playbin connected to an appsink to do the reading. I am getting a stall only for MP3 files when I attempt to stop the pipeline i.e. move the state from PLAYING->NULL before I have read until the end of file.The stall happens in the call to: gst_element_set_state(element, GST_STATE_NULL); The traces for the relevant threads are below: Thread 49 (Thread 0x7f9c2b2a3700 (LWP 59340)): #0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 #1 0x00007f9c87b1d24f in g_cond_wait () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007f9c2e25cd66 in gst_app_sink_event (sink=0x23873d30, event=0x21428960) at gstappsink.c:686 #3 0x00007f9c2e00fd14 in ?? () from /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 #4 0x00007f9c2e8dd837 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #5 0x00007f9c2e8ddcfe in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #6 0x00007f9c2e8de110 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #7 0x00007f9c2e8dbcff in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #8 0x00007f9c2e8e8061 in gst_pad_push_event () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #9 0x00007f9c2e8e81de in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #10 0x00007f9c2e8e3a7e in gst_pad_forward () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #11 0x00007f9c2e8e3bd3 in gst_pad_event_default () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #12 0x00007f9c2e8dd837 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #13 0x00007f9c2e8ddcfe in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #14 0x00007f9c2e8de110 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #15 0x00007f9c2e8dbcff in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #16 0x00007f9c2e8e8061 in gst_pad_push_event () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #17 0x00007f9c2e02b56d in ?? () from /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 #18 0x00007f9c2e8dd837 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #19 0x00007f9c2e8ddcfe in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #20 0x00007f9c2e8de110 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #21 0x00007f9c2e8dbcff in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #22 0x00007f9c2e8e8061 in gst_pad_push_event () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #23 0x00007f9c2e02b56d in ?? () from /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 #24 0x00007f9c2e8dd837 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #25 0x00007f9c2e8ddcfe in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #26 0x00007f9c2e8de110 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #27 0x00007f9c2e8dbcff in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #28 0x00007f9c2e8e8061 in gst_pad_push_event () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #29 0x00007f9c2e02b56d in ?? () from /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 #30 0x00007f9c2e8dd837 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #31 0x00007f9c2e8ddcfe in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #32 0x00007f9c2e8de110 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #33 0x00007f9c2e8dbcff in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #34 0x00007f9c2e8e8061 in gst_pad_push_event () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #35 0x00007f9c2e8e81de in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #36 0x00007f9c2e8e3a7e in gst_pad_forward () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #37 0x00007f9c2e8e3bd3 in gst_pad_event_default () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #38 0x00007f9c2d985376 in gst_play_sink_convert_bin_sink_event (pad=0x212ed170, parent=0x2146ac60, event=0x21428960) at gstplaysinkconvertbin.c:260 #39 0x00007f9c2e8dd837 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #40 0x00007f9c2e8ddcfe in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #41 0x00007f9c2e8de110 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #42 0x00007f9c2e8dbcff in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #43 0x00007f9c2e8e8061 in gst_pad_push_event () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #44 0x00007f9c2c910d58 in ?? () from /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstcoreelements.so #45 0x00007f9c2e912a21 in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #46 0x00007f9c87affdce in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #47 0x00007f9c87aff3d5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #48 0x00007f9d08468494 in start_thread (arg=0x7f9c2b2a3700) at pthread_create.c:333 #49 0x00007f9d08766aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97 Thread 3 (Thread 0x7f77c6454700 (LWP 66663)): #0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 #1 0x00007f779bd3587c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007f779b1d578c in ?? () from /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 #3 0x00007f779c26872e in gst_element_change_state () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #4 0x00007f779c268e9f in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #5 0x00007f779c2471ad in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #6 0x00007f779c26872e in gst_element_change_state () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #7 0x00007f779c268e9f in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #8 0x00007f779c2471ad in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #9 0x00007f779990a138 in gst_play_sink_change_state (element=0xe620500, transition=GST_STATE_CHANGE_PLAYING_TO_PAUSED) at gstplaysink.c:4872 #10 0x00007f779c26872e in gst_element_change_state () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #11 0x00007f779c268e9f in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #12 0x00007f779c2471ad in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #13 0x00007f779c28c73a in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #14 0x00007f77998fb84f in gst_play_bin_change_state (element=0xe61bb10, transition=GST_STATE_CHANGE_PLAYING_TO_PAUSED) at gstplaybin2.c:5768 #15 0x00007f779c26872e in gst_element_change_state () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #16 0x00007f779c268e9f in ?? () from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 #17 0x00007f779c54a6c8 in (anonymous namespace)::changeElementState (element=0xe61bb10, newState=newState@entry=@0x7f77c64488b0: GST_STATE_NULL, timeToWait=5000000000) <my application specific trace> This used to work fine on Debian 8. However, on Debian 9 and Ubuntu 16.04 and higher which have Gstreamer versions 1.8 and higher, this happens. My application is multi-threaded and below is a brief description: Main Thread: -> Creates playbin and appsink -> Connects them -> Runs the pipeline -> Stop the pipeline either upon EOF or upon request Thread 2: --> Pulls samples from the appsink I have confirmed that Thread 2 is completely shutdown when the Main thread is attempting to stop the pipeline i.e. there is no situation when I am attempting to change state in the middle of a call to gst_app_sink_pull_sample. I attempted to use a pad probe which was recommended when wanting to play only a portion of a media file as per https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html However, I do not believe that this will work for me because I do not know which portion of the media file is to be played in advance i.e. users can stop playback at anytime. After I added the probe, I noticed that the frequency of the stalls reduced quite drastically i.e. from everytime to 1 in 500. My pad probe callback is as below: // If the stopping of the playbin has not been initiated, // then allow the sample to pass through. if( !_isPlaybinToBeStopped ) { return GST_PAD_PROBE_PASS; } BOOST_SCOPE_EXIT((&_isPlaybinToBeStopped)) { _isPlaybinToBeStopped = false; } BOOST_SCOPE_EXIT_END // Remove the pad probe if the playbin is to be stopped. return GST_PAD_PROBE_REMOVE; I really do not understand how adding this probe is really helping because it does no action other than pass through OR just remove the probe. Am I just getting lucky? Any thoughts? As this happens only for Mp3 files, is this a bug? Dinesh _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |