ref: 148f86f3b05a3b8c21e386fa0bf8e57bd3a803c9
parent: 7bc1b7abf5c37fba66b48eb3a929dfc4b2e0e92c
parent: 28bdcc3871d64592908b8c7e31016510ad67b847
author: HaiboZhu <haibozhu@cisco.com>
date: Tue Nov 17 09:35:16 EST 2015
Merge pull request #2244 from pengyanhai/master Merge back the changes of v1.5.2 to master and generate PDB file on Windows
--- a/RELEASES
+++ b/RELEASES
@@ -1,6 +1,14 @@
Releases
-----------
+v1.5.2
+------
+- Fix GMP Plugin causing the Browser crash on Android
+
+v1.5.1
+------
+- Bug fixes for GMP Plugin
+
v1.5.0
------
- Correct a typo in codec return value (github issue#2046, cmUnkonwReason -> cmUnknownReason)
--- a/build/msvc-common.mk
+++ b/build/msvc-common.mk
@@ -22,7 +22,7 @@
# it unconditionally. The same issue can also be worked around by adding
# -DGTEST_HAS_TR1_TUPLE=0 instead, but we prefer this version since it
# matches what gtest itself does.
-CFLAGS += -nologo -Fd$(PROJECT_NAME).pdb -W3 -EHsc -fp:precise -Zc:wchar_t -Zc:forScope -D_VARIADIC_MAX=10
+CFLAGS += -nologo -W3 -EHsc -fp:precise -Zc:wchar_t -Zc:forScope -D_VARIADIC_MAX=10
CXX_LINK_O=-nologo -Fe$@
AR_OPTS=-nologo -out:$@
CFLAGS_OPT=-O2 -Ob1 -Oy- -Zi -GF -Gm- -GS -Gy -DNDEBUG
@@ -41,7 +41,7 @@
SHARED=-LD
EXTRA_LIBRARY=$(PROJECT_NAME)_dll.lib
LDFLAGS += -link
-SHLDFLAGS=-pdb:$(PROJECT_NAME).pdb -def:$(SRC_PATH)openh264.def -implib:$(EXTRA_LIBRARY)
+SHLDFLAGS=-debug -opt:ref -opt:icf -def:$(SRC_PATH)openh264.def -implib:$(EXTRA_LIBRARY)
STATIC_LDFLAGS=
CODEC_UNITTEST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS
--- a/gmpopenh264.info
+++ b/gmpopenh264.info
@@ -1,4 +1,4 @@
Name: gmpopenh264
Description: GMP Plugin for OpenH264.
-Version: 1.5
+Version: 1.5.2
APIs: encode-video[h264], decode-video[h264]
--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -361,14 +361,17 @@
}
virtual void EncodingComplete() {
- // Release the reference to the callback, because it is no longer safe to call it
+ // 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();
}
@@ -481,12 +484,18 @@
void Encode_m (GMPVideoi420Frame* frame, SFrameBSInfo* encoded,
GMPVideoFrameType frame_type) {
+ // Attach a self-destructor so that this dies on return.
+ SelfDestruct<GMPVideoi420Frame> ifd (frame);
+
+ if (!host_) {
+ return;
+ }
+
// Now return the encoded data back to the parent.
GMPVideoFrame* ftmp;
GMPErr err = host_->CreateFrame (kGMPEncodedVideoFrame, &ftmp);
if (err != GMPNoErr) {
GMPLOG (GL_ERROR, "Error creating encoded frame");
- frame->Destroy();
return;
}
@@ -513,7 +522,6 @@
if (err != GMPNoErr) {
GMPLOG (GL_ERROR, "Error allocating frame data");
f->Destroy();
- frame->Destroy();
return;
}
@@ -539,9 +547,6 @@
<< " timestamp="
<< f->TimeStamp());
- // Destroy the frame.
- frame->Destroy();
-
// Return the encoded frame.
GMPCodecSpecificInfo info;
memset (&info, 0, sizeof (info)); // shouldn't be needed, we init everything
@@ -735,14 +740,17 @@
}
virtual void DecodingComplete() {
- // Release the reference to the callback, because it is no longer safe to call it
+ // 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();
}
@@ -836,6 +844,10 @@
GMPVideoFrame* ftmp = nullptr;
+ if (!host_) {
+ return;
+ }
+
// Translate the image.
GMPErr err = host_->CreateFrame (kGMPI420VideoFrame, &ftmp);
if (err != GMPNoErr) {