Closed
      
        Bug 1048104
      
      
        Opened 11 years ago
          Closed 11 years ago
      
        
    
  
GMPMutexes are not able to be deleted by a GMP and leak
Categories
(Core :: Audio/Video, defect)
Tracking
()
        RESOLVED
        FIXED
        
    
  
        
            mozilla34
        
    
  
People
(Reporter: cpearce, Assigned: cpearce)
References
Details
Attachments
(1 file)
| 
        
        
         2.23 KB,
          patch         
       | 
      
           jesup
 :
              
              review+
          ehugg
 :
              
              feedback+
           | 
      Details | Diff | Splinter Review | 
GMPMutex doesn't have a function to allow it to be deleted. So if I run a GMP which creates GMPMutexes with XPCOM_MEM_LEAK_LOG=2 I see geckomediaplugin process leaking mozilla::Mutexes, since GMPMutexImpl uses that to implement itself.
We should either:
1. Keep track of the GMPMutexes created during GMP lifetime, and delete them on GMP process exit, or
2. add a virtual function GMPMutex::Destroy() that GMPs can call to delete the GMPMutex.
I think 2 is best. OpenH264 doesn't use GMPMutex, so it won't technically require a re-spin of the OpenH264 GMP.
| Assignee | ||
          Comment 1•11 years ago
           
         | 
      ||
Adds GMPMutex::Destroy().
ehugg: This change won't cause any problems for OpenH264 right?
        Attachment #8466876 -
        Flags: review?(rjesup)
        Attachment #8466876 -
        Flags: feedback?(ethanhugg)
          Comment 2•11 years ago
           
         | 
      ||
Comment on attachment 8466876 [details] [diff] [review]
Patch: Add GMPMutex::Destroy()
Review of attachment 8466876 [details] [diff] [review]:
-----------------------------------------------------------------
r+ given verification of binary compat
::: content/media/gmp/gmp-api/gmp-platform.h
@@ +44,3 @@
>    virtual ~GMPTask() {}
>    virtual void Run() = 0;
> +  virtual void Destroy() = 0; // Deletes object.
Careful... this might impact binary compatibility (vtable order).  Verify before landing this doesn't impact OpenH264
@@ +57,5 @@
>  public:
>    virtual ~GMPMutex() {}
>    virtual void Acquire() = 0;
>    virtual void Release() = 0;
> +  virtual void Destroy() = 0; // Deletes object.
Adding at the end I think is ok, vtable-wise
        Attachment #8466876 -
        Flags: review?(rjesup) → review+
          Comment 3•11 years ago
           
         | 
      ||
Comment on attachment 8466876 [details] [diff] [review]
Patch: Add GMPMutex::Destroy()
Review of attachment 8466876 [details] [diff] [review]:
-----------------------------------------------------------------
Tested on OSX with OpenH264.  It works fine with restarts and closing/opening tabs as long as we don't change the VTable order on GMPTask.   With Destory() moved to the end OpenH264 does not work, so f+ if you put it back on top.
::: content/media/gmp/gmp-api/gmp-platform.h
@@ +44,3 @@
>    virtual ~GMPTask() {}
>    virtual void Run() = 0;
> +  virtual void Destroy() = 0; // Deletes object.
This does affect OpenH264.  Move it back to the top and it works again.
        Attachment #8466876 -
        Flags: feedback?(ethanhugg) → feedback+
| Assignee | ||
          Comment 4•11 years ago
           
         | 
      ||
Landed with the GMPTask vtable change removed:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7b550d45454b
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/f9d5b35e4b5b for build bustage: https://tbpl.mozilla.org/php/getParsedLog.php?id=45200545&tree=Mozilla-Inbound
Flags: needinfo?(nobody)
| Assignee | ||
          Comment 6•11 years ago
           
         | 
      ||
          Comment 7•11 years ago
           
         | 
      ||
Assignee: nobody → cpearce
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
          Updated•10 years ago
           
         | 
      
Flags: needinfo?(nobody)
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•