mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-16 21:36:35 +00:00
08eaa11259
Original commit message from CVS: - added playondemand plugin by Leif Morgan Johnson <lmjohns3@eos.ncsu.edu> - some fixes to int2float - aplied a patch from wrobell <wrobell@ite.pl> that is a first attempt at making automake 1.5 happy (gst now requires automake1.5). It's still not perfect but it builds. - Made the schedulers plugable. The default scheduler now lives inside a plugin. - Added a new mpeg1/2 parser/demuxer. - Fixed some compiler warnings in the core libs. - substantial work to GstThread (hopefully less race conditions). simplified the code in GstThread a bit. A state change can now also happen in the thread context. - reworked the state semantics of a bin. it'll now automatically get the highest state of its children. - the autoplugger now nests the threads so that a state change failure of one thread doesn't make its upstream thread lock. - GstQueue refuses to go to PLAYING if the sinkpad is not connected. This way the queue will not wedge in the _get lock. - GstQueue unlocks its mutexes when going to PAUSED. - make sure that when all elements in a bin/thread go to PAUSED, the bin is set to PAUSED too. - make a parent bin wait for its children to PAUSE before ending the iteration with FALSE (EOS) - Some changes to GstPlay to deal with EOS. - aplied the latest patch from Zeenix to gstrtp. end result: GstPlay doesn't crash on EOS and the pipeline is now shut down properly.
172 lines
4.1 KiB
Text
172 lines
4.1 KiB
Text
1) terms
|
|
--------
|
|
|
|
- the managing container (top half). This is the main thread that
|
|
will create and control the main_loop.
|
|
|
|
- the main_loop (bottom half), this is the thread that actually does
|
|
the work.
|
|
|
|
|
|
|
|
2) state changes
|
|
================
|
|
|
|
|
|
NULL->READY
|
|
-----------
|
|
|
|
precondition:
|
|
At this point only the top half exists.
|
|
flag GST_THREAD_ACTIVE is unset
|
|
|
|
flow: (TH column 1, BH column 2, ! denotes (possible) thread switch)
|
|
get mutex
|
|
pthread create BH
|
|
wait for spin up (release lock) !
|
|
get mutex
|
|
set flag GST_THREAD_ACTIVE
|
|
change state of children to READY (*)
|
|
signal TH
|
|
! wait for commands (release lock)
|
|
(lock reacquired after wait)
|
|
unlock mutex
|
|
|
|
(*) marks a spot that could potentially induce another state change.
|
|
|
|
|
|
READY->NULL
|
|
-----------
|
|
|
|
precondition:
|
|
BH is waiting for commands.
|
|
flag GST_THREAD_ACTIVE is set
|
|
|
|
flow:
|
|
get mutex
|
|
set command for BH (NULL)
|
|
signal for new command
|
|
wait for ACK (release lock) !
|
|
(lock reacquired after wait for cmd)
|
|
change state of children to NULL (*)
|
|
signal TH
|
|
unset flag GST_THREAD_ACTIVE
|
|
! unlock (release lock)
|
|
! exit
|
|
(lock reacquired after wait)
|
|
join
|
|
unlock (release lock)
|
|
|
|
|
|
READY->PAUSED
|
|
-------------
|
|
|
|
precondition:
|
|
BH is waiting for commands.
|
|
flag GST_THREAD_ACTIVE is set
|
|
|
|
flow:
|
|
get mutex
|
|
set command for BH (PAUSED)
|
|
signal for new command
|
|
wait for ACK (release lock) !
|
|
(lock reacquired after wait for cmd)
|
|
change state of children to READY (*)
|
|
signal TH
|
|
! wait for commands (release lock)
|
|
(lock reacquired after wait)
|
|
unlock (release lock)
|
|
|
|
|
|
PAUSED->PLAYING
|
|
---------------
|
|
|
|
precondition:
|
|
BH is waiting for commands.
|
|
flag GST_THREAD_ACTIVE is set
|
|
|
|
flow:
|
|
get mutex
|
|
set command for BH (PLAYING)
|
|
signal for new command
|
|
wait for ACK (release lock) !
|
|
(lock reacquired after wait for cmd)
|
|
change state of children to PLAYING (*)
|
|
set flag GST_THREAD_SPINNING
|
|
while (flag SPINNING is set) {
|
|
signal TH
|
|
! unlock mutex
|
|
(lock reacquired after wait) !
|
|
unlock (release lock) !
|
|
! status = iterate() (*)
|
|
lock mutex
|
|
signal TH
|
|
if (!status) // EOS
|
|
unset SPINNING flag
|
|
}
|
|
signal TH
|
|
! wait for commands (release lock)
|
|
|
|
|
|
PLAYING->PAUSED
|
|
---------------
|
|
|
|
precondition:
|
|
1. either:
|
|
BH is spinning
|
|
flag GST_THREAD_ACTIVE is set
|
|
flag GST_THREAD_SPINNING is set
|
|
2. or:
|
|
BH is waiting for commands.
|
|
flag GST_THREAD_ACTIVE is set
|
|
flag GST_THREAD_SPINNING is unset
|
|
|
|
flow:
|
|
|
|
case 1.
|
|
|
|
! while (flag SPINNING is set) {
|
|
! signal TH
|
|
! unlock mutex
|
|
get mutex !
|
|
set command for BH (PAUSED) !
|
|
unset SPINNING flag ! status = iterate ()
|
|
signal for new command !
|
|
wait for ACK (release lock) !
|
|
lock mutex (reacquired after iteration)
|
|
if (!status) // EOS
|
|
unset SPINNING flag
|
|
}
|
|
if (status)
|
|
change state of children to READY (*) (!EOS)
|
|
signal TH
|
|
! wait for commands (release lock)
|
|
(lock reacquired after wait)
|
|
unlock (release lock)
|
|
|
|
case 2.
|
|
|
|
get mutex
|
|
set command for BH (PAUSED)
|
|
unset SPINNING flag (nop)
|
|
signal for new command
|
|
wait for ACK (release lock) !
|
|
(lock reacquired after wait for cmd)
|
|
change state of children to READY (*)
|
|
signal TH
|
|
! wait for commands (release lock)
|
|
(lock reacquired after wait)
|
|
unlock (release lock)
|
|
|
|
|
|
PAUSED->READY
|
|
-------------
|
|
|
|
similar to READY->PAUSED
|
|
|
|
TODO
|
|
----
|
|
|
|
- review
|
|
- figure all all state change scenarios occuring in code marked with (*)
|
|
|