summaryrefslogtreecommitdiff
path: root/subprojects/gstreamer/docs/random/wtay/eos2
blob: 361290cc5366473c22ebd9a14b84d74ce429ac88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
OUTDATED
--------


case 1) 

(--------------------------------------------------)
! bin                                              !
! (--------)         (--------)         (--------) !
! ! fakesrc!         !identity!         !fakesink! !
! !       src ----- sink     src ---- sink       ! !
! (--------)         (--------)         (--------) !
(--------------------------------------------------)

.scheduling.
  
  case1 has just one scheduled entity (chain) no problem here.

.eos.

  fakesrc detects the end of stream. It just returned the last buffer.
  The next _pull will cause the srcpad to trigger gst_pad_set_eos ().
  After that it will return a NULL buffer.

  gst_pad_set_eos() will notify the parent about the plugins attempt to
  signal eos. the parent adds the element to its possible EOS 
  providers.
  
  gst_pad_set_eos() will by default propagate to identy and to fakesink.
  none of these plugins override the default behaviour so gst_pad_set_eos
  returns TRUE and fakesrc signals EOS with the value TRUE.

  The parent looks in the list of EOS providers and finds the faksrc
  element that is now signaling EOS. all EOS providers are now in EOS
  and so the bin fires EOS.



case 2) 
                                                     (---------------)
                                                     !thread         !
 (--------)         (--------)         (--------)    !     (--------)!
 ! fakesrc!         !identity!         !  queue !    !     !fakesink!!
 !       src ----- sink     src ---- sink       src ---- sink       !!
 (--------)         (--------)         (--------)    !     (--------)!
                                                     (---------------)

.scheduling.

  case2 has two scheduled entities: fsr-i-q, q-fsk.
  
.eos.

  fakesrc detects the end of stream. It just returned the last buffer.
  The next _pull will cause the srcpad to trigger gst_pad_set_eos ().
  After that it will return a NULL buffer.

  gst_pad_set_eos() will notify the parent about the plugins attempt to
  signal eos. the parent adds the element to its possible EOS 
  providers.

  gst_pad_eos() will by default propagate to identy and to queue.
  queue overrides the eos handler and returns false on the eos
  request. fakesrc signals EOS with a value of false and the parent
  bin removes the EOS provider from its list.

  after the queue has sent out the last buffer, its calls eos on its
  src pad. queue is added to the top level bin as an eos provider and
  the default eos handler signals EOS with a value of TRUE to the parent.

  the parent sees that all the eos providers are in eos now and signals
  EOS.


case 3) 
                                                     (---------------)
                                                     !thread         !
 (--------)         (--------)         (--------)    !     (--------)!
 ! fakesrc!         !  tee   !         ! queue1 !    !     !fakesink!!
 !       src ----- sink     src ---- sink       src ---- sink       !!
 (--------)         !        !         (--------)    !     (--------)!
                    !        !                       (---------------)
                    !        !
                    !        !                       (---------------)
                    !        !                       !thread         !
                    !        !         (--------)    !     (--------)!
                    !        !         ! queue2 !    !     !fakesink!!
                    !       src ---- sink       src ---- sink       !!
                    !        !         (--------)    !     (--------)!
                    (--------)                       (---------------)


  fakesrc detects the end of stream. It just sent the last buffer
  and sets the srcpad to EOS with gst_pad_eos ().

  the eos handler returns false because both queues return false on the
  eos request. the parent removes fakesrc as an EOS provider.

  queue1 and queue2 were responsible for the EOS delay and so they get
  added to the bin as possible EOS providers.

  after the queues have sent out their last buffer, they calls eos on their
  src pads.
  the parent already has the two queues in the EOS provider list so they don't
  get added twice.
  the two queues perform gst_pad_eos () on their pads when the queue is empty,
  the parent removes the EOS providers from its list, when the list is empty,
  the parent fires EOS.
  
  
case 4) 

                                                     (---------------)
                                                     !thread         !
 (--------)       (----------)         (--------)    !     (--------)!
 ! fakesrc!       !mpeg1parse!         ! queue1 !    !     !fakesink!!
 !       src -- sink        src ---- sink       src ---- sink       !!
 (--------)       !          !         (--------)    !     (--------)!
                  !          !                       (---------------)
                  !          !
                  !          !                       (---------------)
                  !          !                       !thread         !
                  !          !         (--------)    !     (--------)!
                  !          !         ! queue2 !    !     !fakesink!!
                  !         src ---- sink       src ---- sink       !!
                  !          !         (--------)    !     (--------)!
                  (----------)                       (---------------)


  this case differs from case3 in that one of the queues can be empty
  while the other isn't. we assume queue1 is empty while queue2 isn't yet.

  fakesrc detects the end of stream. It just sent the last buffer
  and sets the srcpad to EOS with gst_pad_eos ().

  the eos handler returns false because queue2 returns false on the
  eos request. the parent removes fakesrc as an EOS provider.

  queue2 was responsible for the EOS delay and so it gets added to the bin
  as a possible EOS provider.

  after the queue2 has sent its last buffer, it performs gst_pad_eos on its
  src pad.
  the parent already has the queue2 in the list of EOS providers so it does not
  get added twice.
  queue2 finally fires the EOS signal and the parent removes the EOS provider 
  from its list, when the list is empty, the parent fires EOS.