From e28a5a31f7d0d355162c729c3b7fd58ea4ac8b28 Mon Sep 17 00:00:00 2001 From: ouyang Date: Wed, 4 Sep 2024 10:54:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E7=BB=93=E6=9D=9F=E6=97=B6=E8=B0=83=E7=94=A8?= =?UTF-8?q?ON=5FNativeWindow=5FDestroyNativeWindow=E9=87=8A=E6=94=BE?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E4=BC=9A=E5=AF=BC=E8=87=B4fd?= =?UTF-8?q?=E6=B3=84=E9=9C=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ouyang --- entry/src/main/cpp/sample/recorder/Recorder.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/entry/src/main/cpp/sample/recorder/Recorder.cpp b/entry/src/main/cpp/sample/recorder/Recorder.cpp index 13337ca..5d17d0b 100644 --- a/entry/src/main/cpp/sample/recorder/Recorder.cpp +++ b/entry/src/main/cpp/sample/recorder/Recorder.cpp @@ -141,6 +141,10 @@ void Recorder::Release() { videoEncoder_.reset(); AVCODEC_SAMPLE_LOGI("Video encoder release successful"); } + if (sampleInfo_.window != nullptr) { + OH_NativeWindow_DestroyNativeWindow(sampleInfo_.window); + sampleInfo_.window = nullptr; + } if (encContext_ != nullptr) { delete encContext_; encContext_ = nullptr; -- Gitee From 38c0a4d334623c3269152a4a4d7074c9a9dcf3ad Mon Sep 17 00:00:00 2001 From: ouyang Date: Wed, 4 Sep 2024 13:25:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E7=BB=93=E6=9D=9F=E6=97=B6=E8=B0=83=E7=94=A8?= =?UTF-8?q?ON=5FNativeWindow=5FDestroyNativeWindow=E9=87=8A=E6=94=BE?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E4=BC=9A=E5=AF=BC=E8=87=B4fd?= =?UTF-8?q?=E6=B3=84=E9=9C=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ouyang --- entry/src/main/cpp/sample/recorder/Recorder.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entry/src/main/cpp/sample/recorder/Recorder.cpp b/entry/src/main/cpp/sample/recorder/Recorder.cpp index 5d17d0b..2688b3f 100644 --- a/entry/src/main/cpp/sample/recorder/Recorder.cpp +++ b/entry/src/main/cpp/sample/recorder/Recorder.cpp @@ -137,14 +137,14 @@ void Recorder::Release() { } if (videoEncoder_ != nullptr) { videoEncoder_->Stop(); + if (sampleInfo_.window != nullptr) { + OH_NativeWindow_DestroyNativeWindow(sampleInfo_.window); + sampleInfo_.window = nullptr; + } videoEncoder_->Release(); videoEncoder_.reset(); AVCODEC_SAMPLE_LOGI("Video encoder release successful"); } - if (sampleInfo_.window != nullptr) { - OH_NativeWindow_DestroyNativeWindow(sampleInfo_.window); - sampleInfo_.window = nullptr; - } if (encContext_ != nullptr) { delete encContext_; encContext_ = nullptr; -- Gitee