After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688251 - xvimagesink: don't leave the ref to the pool in case of re-negotiation
xvimagesink: don't leave the ref to the pool in case of re-negotiation
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-13 13:49 UTC by sreerenj
Modified: 2012-11-26 09:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
xvimagesink: don't leave the ref to the pool in case of re-negotiation (1.43 KB, patch)
2012-11-13 13:49 UTC, sreerenj
rejected Details | Review

Description sreerenj 2012-11-13 13:49:54 UTC
Created attachment 228885 [details] [review]
xvimagesink: don't leave the ref to the pool in case of  re-negotiation

The xvimagesink should always keep a reference to the bufferpool.
If renegotiation happens, sink is creating a new pool but doesn't keeping the reference to that at the moment.
Attaching a patch to fix this:
Comment 1 Wim Taymans 2012-11-21 09:31:07 UTC
This is not correct. The sink only keeps a ref to its pool when it gets a caps event and when it actually negotiates to the format.

In the allocation query, the sink proposes a bufferpool. If the requested format is the same as the currently negotiated format, it can propose that pool, otherwise it needs to make a new one.
Comment 2 Tim-Philipp Müller 2012-11-21 09:42:45 UTC
sreerenj: btw, it is always helpful to describe the context / situation / bug that led you to create a patch (what pipeline were you using? What did you do? What happened? etc.) - anything that might give us some clues where the actual problem lies - or did you just happen to read the code and propose this?
Comment 3 sreerenj 2012-11-21 14:11:01 UTC
(In reply to comment #1)
> This is not correct. The sink only keeps a ref to its pool when it gets a caps
> event and when it actually negotiates to the format.
> 
> In the allocation query, the sink proposes a bufferpool. If the requested
> format is the same as the currently negotiated format, it can propose that
> pool, otherwise it needs to make a new one.

so you meant the the sink doesn't need to keep the ref to the pool, even though it is a new pool created in propose_allocation ? Then the sink is keeping ref to a pool(created in set_caps) which is not using by the upstream elements,,right?
Comment 4 Wim Taymans 2012-11-21 14:28:38 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > This is not correct. The sink only keeps a ref to its pool when it gets a caps
> > event and when it actually negotiates to the format.
> > 
> > In the allocation query, the sink proposes a bufferpool. If the requested
> > format is the same as the currently negotiated format, it can propose that
> > pool, otherwise it needs to make a new one.
> 
> so you meant the the sink doesn't need to keep the ref to the pool, even though
> it is a new pool created in propose_allocation ? Then the sink is keeping ref
> to a pool(created in set_caps) which is not using by the upstream
> elements,,right?

Yes, correct.
Comment 5 sreerenj 2012-11-21 14:30:14 UTC
okay,,is that scenario right??seems like tool pool active at the same time !!
Comment 6 sreerenj 2012-11-21 14:31:12 UTC
(In reply to comment #5)
> okay,,is that scenario right??seems like tool pool active at the same time !!

hm,,sorry for the spelling mistake :(
okay,,is that scenario right??seems like two pools active at the same time !!
Comment 7 Wim Taymans 2012-11-21 14:37:54 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > okay,,is that scenario right??seems like tool pool active at the same time !!
> 
> hm,,sorry for the spelling mistake :(
> okay,,is that scenario right??seems like two pools active at the same time !!

What could be done is disable the pool from setcaps if a buffer with a different pool arrives.
Comment 8 sreerenj 2012-11-21 22:11:58 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > okay,,is that scenario right??seems like tool pool active at the same time !!
> > 
> > hm,,sorry for the spelling mistake :(
> > okay,,is that scenario right??seems like two pools active at the same time !!
> 
> What could be done is disable the pool from setcaps if a buffer with a
> different pool arrives.

you mean we have to unref the dirty pool when the buffer received in show_frame() ?...

hm,,i am again bit confused about the current implementaion

for eg:
there are two cases (the sink is creating pool in both cases)

case1: If there is no renegotiation happened in the pipeline: the pool will be active even though the upstream elements drop the ref to the pool since the sink is holding the reference to the pool

case2: If renegotiation happens once: then upstream element can drop ref to the pool and which may lead to pool-deactivation since the sink doesn't hold any ref to the pool.

is this scenario is correct?
Comment 9 sreerenj 2012-11-24 21:38:13 UTC
(In reply to comment #2)
> sreerenj: btw, it is always helpful to describe the context / situation / bug
> that led you to create a patch (what pipeline were you using? What did you do?
> What happened? etc.) - anything that might give us some clues where the actual
> problem lies - or did you just happen to read the code and propose this?

I was looking through the xvimagesink code to implement the same behavior for a different sink and felt that the xvsink code is incorrect.
Comment 10 sreerenj 2012-11-24 21:44:54 UTC
Can you reopen the bug based on comment 5,6 and 7 ??

or the better way is to unref the dirty pool in propose_allocation itself...
propose_allocation:
  if new_poo_created_in_propose_allocation then   
     unref the dirty pool
Comment 11 Wim Taymans 2012-11-26 09:14:28 UTC
(In reply to comment #10)
> Can you reopen the bug based on comment 5,6 and 7 ??
> 
> or the better way is to unref the dirty pool in propose_allocation itself...
> propose_allocation:
>   if new_poo_created_in_propose_allocation then   
>      unref the dirty pool

No, the pool in propose_allocation has nothing to do with the pool used for rendering. The pool is a *proposal* based on the caps of the upstream element that is free to use the pool or not.

The current code is correct.