diff --git a/module/gmp-openh264.cpp b/module/gmp-openh264.cpp index 9c3ba297..bed75f13 100644 --- a/module/gmp-openh264.cpp +++ b/module/gmp-openh264.cpp @@ -342,6 +342,11 @@ class OpenH264VideoEncoder : public GMPVideoEncoder { } if (!has_frame) { + // This frame must be destroyed on the main thread. + g_platform_api->syncrunonmainthread (WrapTask ( + this, + &OpenH264VideoEncoder::DestroyInputFrame_m, + inputImage)); return; } @@ -420,6 +425,11 @@ class OpenH264VideoEncoder : public GMPVideoEncoder { 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) { return GMPVideoNoErr; }