shithub: openh264

Download patch

ref: 8662eca2c3314486a56b1c144b07e39dbda600e8
parent: 2b038fa73b2b9ff2abef1e45f7e4db741835cf6e
author: Ethan Hugg <[email protected]>
date: Mon Jun 30 12:59:50 EDT 2014

Fix for memory leak of input frames in encoder.

--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -397,6 +397,11 @@
     }
 
     if (!has_frame) {
+      // This frame must be destroyed on the main thread.
+      g_platform_api->syncrunonmainthread (WrapTask (
+                                             this,
+                                             &OpenH264VideoEncoder::DestroyInputFrame_m,
+                                             inputImage));
       return;
     }
 
@@ -473,6 +478,11 @@
     callback_->Encoded (f, info);
 
     stats_.FrameOut();
+  }
+
+  // These frames must be destroyed on the main thread.
+  void DestroyInputFrame_m (GMPVideoi420Frame* frame) {
+    frame->Destroy();
   }
 
   virtual GMPVideoErr SetChannelParameters (uint32_t aPacketLoss, uint32_t aRTT) {