ref: c47d23594257b2db8ba018569b5b26663707058b
parent: f13f502203140574eb0e5c7bf15c0571ce7a57be
parent: 955fce60a1cfcbd66a778350fc4b6d8e54ea946f
author: huili2 <huili2@cisco.com>
date: Thu Nov 5 04:09:55 EST 2015
Merge pull request #2210 from pengyanhai/master Never call GMPVideoDecoderCallback after Encoding/DecodingComplete, to fix bug #1204588 in Bugzilla
--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -361,6 +361,8 @@
}
virtual void EncodingComplete() {
+ // Release the reference to the callback, because it is no longer safe to call it
+ callback_ = nullptr;
Release();
}
@@ -532,7 +534,9 @@
info.mBufferType = GMP_BufferLength32;
info.mCodecSpecific.mH264.mSimulcastIdx = 0;
- callback_->Encoded (f, reinterpret_cast<uint8_t*> (&info), sizeof (info));
+ if (callback_) {
+ callback_->Encoded (f, reinterpret_cast<uint8_t*> (&info), sizeof (info));
+ }
stats_.FrameOut();
}
@@ -716,6 +720,8 @@
}
virtual void DecodingComplete() {
+ // Release the reference to the callback, because it is no longer safe to call it
+ callback_ = nullptr;
Release();
}
@@ -780,7 +786,9 @@
if (decoded->iBufferStatus != 1) {
GMPLOG (GL_ERROR, "iBufferStatus=" << decoded->iBufferStatus);
- callback_->InputDataExhausted();
+ if (callback_) {
+ callback_->InputDataExhausted();
+ }
return;
}
@@ -822,7 +830,9 @@
<< frame->AllocatedSize (kGMPYPlane));
frame->SetTimestamp (inputFrame->TimeStamp());
frame->SetDuration (inputFrame->Duration());
- callback_->Decoded (frame);
+ if (callback_) {
+ callback_->Decoded (frame);
+ }
stats_.FrameOut();
}