From 4468e1074d0332c17a4e7ccf8265a51543f25076 Mon Sep 17 00:00:00 2001 From: pwx1285814 Date: Fri, 3 Jan 2025 14:31:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DconsumerSurface=5F=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=EF=BC=8CStopEncoder=E6=9C=AA=E5=88=A4?= =?UTF-8?q?=E7=A9=BA=E5=AF=BC=E8=87=B4=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pwx1285814 Change-Id: Ib1d0f427b16e79b5b977eb587c01712500578cd7 Signed-off-by: pwx1285814 --- .../encoder/src/image_source_encoder.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp index 07ee23fa..4e64691c 100644 --- a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp +++ b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -301,11 +301,14 @@ int32_t ImageSourceEncoder::StopEncoder() DHLOGE("%{public}s: Stop encoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_STOP_FAILED; } - ret = consumerSurface_->UnregisterConsumerListener(); - if (ret != SURFACE_ERROR_OK) { - DHLOGE("Unregister Consumer Listener failed."); + std::unique_lock bufLock(bufferMtx_); + if (consumerSurface_ != nullptr) { + ret = consumerSurface_->UnregisterConsumerListener(); + if (ret != SURFACE_ERROR_OK) { + DHLOGE("Unregister Consumer Listener failed."); + } + consumerSurface_ = nullptr; } - consumerSurface_ = nullptr; producerSurface_ = nullptr; return DH_SUCCESS; } -- Gitee