[gst-devel] Threads in 0.8.10
MDK
mdk at mdk.org.pl
Mon Jul 4 07:16:06 CEST 2005
Uh. I've got serious problems understanding how threading works in
0.8.10... I've got the following pipeline:
+Thread_1-------------+ +Thread_2---------------------+
| | | |
| | | +Queue------+ +AlsaSink--+ |
| [asrc] --- | [sink] [src]-[sink] | |
| | | +-----------+ +----------+ |
| | +-----------------------------+
| (Avi file bin with |
| a loopfunc that | +Thread_3---------------------+
| pushes on asrc & | | |
| vsrc) | | +Queue------+ +XvImagesink+ |
| [vsrc] --- | [sink] [src]-[sink] | |
| | | +-----------+ +-----------+ |
+---------------------+ +-----------------------------+
Now, I already smoked 2 packs of ciggarettes today trying to figure out
what's the right way to stop/start this pipeline.
When I "play", I change the state of Thread_1 to PLAYING and wait till
on of the queues fills up (overrun). Than I start playing Thread_2 and
Thread_3. That works pretty smoothly.
The problem is with pausing. I think I tried every possible combination
here...
---
01: gst_set_element_state (Thread_3, GST_STATE_PAUSED)
02: gst_set_element_state (Thread_2, GST_STATE_PAUSED)
03: gst_set_element_state (Thread_1, GST_STATE_PAUSED)
I lock on 03 as Thread_1 is locked in a push on the queue that's already
full. I tried pausing Thread_1 from the Overrun func, but It seems it
doesn't work (not suprising)
---
01: gst_set_element_state (Thread_1, GST_STATE_PAUSED)
02: gst_set_element_state (Thread_2, GST_STATE_PAUSED)
03: gst_set_element_state (Thread_3, GST_STATE_PAUSED)
That works 90% of times. But in the remaining 10% it locks on 02 (or 03)
supposingly because of underrun (?).
...
gstelement.c(2825):gst_element_set_state_func:<thread2> setting state
from PLAYING to PAUSED
(LOCK)
...
I tried messing up with queue params (may-deadlock, block-timeout) but
it doesn't help :
ERROR (0x82cf468 - 311246:07:25.740349000) queue_dataflow(11011)
gstqueue.c(821):gst_queue_get:<queue2> deadlock found, shutting down
sink pad elements
INFO (0x82cf468 - 311246:07:25.740381000) GST_ERROR_SYSTEM(11011)
gstelement.c(2606):gst_element_error_full: signaling error in queue2:
Internal GStreamer error: thread problem. File a bug.
INFO (0x82cf468 - 311246:07:25.740438000) GST_ERROR_SYSTEM(11011)
gstelement.c(2634):gst_element_error_full: signalled error in queue2:
Internal GStreamer error: thread problem. File a bug.
I also tried inserting my own mutexes and doing other nasty things. I'm
lost.
Should the threads call the state_change functions from within
themselves or is it okay to call them from the outside world? (Thread_4
in this example, the "GUI" thread)
--
Michał Dominik K.
mdk at mdk.org.pl
www.mdk.org.pl
More information about the gstreamer-devel
mailing list