mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
Added case6: a multithreaded audio mixer setup.
Original commit message from CVS: Added case6: a multithreaded audio mixer setup.
This commit is contained in:
parent
8ea591ef29
commit
92820d240d
1 changed files with 51 additions and 24 deletions
|
@ -198,29 +198,56 @@ case 5)
|
|||
and audio is playing again...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case 6)
|
||||
|
||||
(-------------------------------------------------------------------------------------)
|
||||
! bin !
|
||||
! (---------------) !
|
||||
! (---------------------------------------------) !audiosink ! !
|
||||
! ! thread1 ! ! ! !
|
||||
! ! (--------) (----------) (-----) ! (--------) ! ! !
|
||||
! ! !disksrc1! ! effect ! !queue! ! ! mixer ! ! ! !
|
||||
! ! ! src -- sink src -- sink src -- sink src -- sink ! !
|
||||
! ! (--------) (----------) (-----) ! ! ! ! ! !
|
||||
! (---------------------------------------------) ! ! ! ! !
|
||||
! ! ! (---------------) !
|
||||
! (---------------------------------------------) ! ! !
|
||||
! ! thread2 ! ! ! !
|
||||
! ! (--------) (----------) (-----) ! ! ! !
|
||||
! ! !disksrc2! ! effect ! !queue! ! ! ! !
|
||||
! ! ! src -- sink src -- sink src -- sink ! !
|
||||
! ! (--------) (----------) (-----) ! (--------) !
|
||||
! (---------------------------------------------) !
|
||||
(-------------------------------------------------------------------------------------)
|
||||
|
||||
This is a simple audio mixer (mp3audio mixer).
|
||||
We assume disksrc1 is going to be in EOS while disksrc2 is still in !EOS
|
||||
|
||||
.scheduling.
|
||||
|
||||
Scheduling is a bit tricky here: we have two threads with each one chain ds1-e-q and
|
||||
ds2-e-q. the mixer element is loop based and forms a third chain, mixer-audiosink
|
||||
|
||||
.eos.
|
||||
|
||||
disksrc1 has passed the last buffer in the _get function. with its next
|
||||
call to _get, it will return a NULL buffer and set the src pad to EOS.
|
||||
|
||||
the EOS call travels up till the queue element because it has overridden
|
||||
the handler. The first chain is disabled from the scheduler. thread1 fires EOS
|
||||
because it does not have any chains to schedule.
|
||||
|
||||
the mixer element pulls buffers from queue1 until queue1 is empty. At that time,
|
||||
queue1 sets the pad to EOS, mixer now knows that it does not have to request
|
||||
another buffer from that pad again.
|
||||
|
||||
disksrc2 finally sets its pad to EOS, rendering chain2 unscheduled which makes
|
||||
the thread2 fire an EOS.
|
||||
|
||||
the mixer element pulls buffers from queue2 until queue2 is empty. At that time,
|
||||
queue2 sets the pad to EOS, mixer now knows that it does not have to request
|
||||
another buffer from that pad again. all pads for the mixer are in EOS now so
|
||||
it sets the src pad to EOS. the last chain now also becomes unscheduled and
|
||||
the bin fires EOS.
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue