shithub: openh264

Download patch

ref: baa69f3cd02199ab726295835e6d2931c82829d7
parent: e014b5ea43af7ba16cbde79b8a11be65b2b66f0c
author: Hank Peng <hankpeng@cisco.com>
date: Fri Nov 13 05:01:10 EST 2015

Shut down the encoder/decoder thread when Encoding/DecodingComplete is invoked, to avoid potential crash on Android

--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -364,12 +364,14 @@
     // Release the reference to the external objects, because it is no longer safe to call them
     host_     = nullptr;
     callback_ = nullptr;
+    TearDownEncoder();
+
     Release();
   }
 
  private:
   virtual ~OpenH264VideoEncoder() {
-    // Tear down the internal encoder
+    // Tear down the internal encoder in case of EncodingComplete() not being called
     TearDownEncoder();
   }
 
@@ -741,12 +743,14 @@
     // Release the reference to the external objects, because it is no longer safe to call them
     host_     = nullptr;
     callback_ = nullptr;
+    TearDownDecoder();
+
     Release();
   }
 
  private:
   virtual ~OpenH264VideoDecoder() {
-    // Tear down the internal decoder
+    // Tear down the internal decoder in case of DecodingComplete() not being called
     TearDownDecoder();
   }