diff --git a/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h b/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h index 830fe62692212fcb3f3eb04863f12f7457335ea4..7ac0c2bcbd3adaeddfda973c5dc30f9e149c23e1 100644 --- a/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h +++ b/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h @@ -118,6 +118,7 @@ private: std::shared_ptr eventBusPipeline_; std::weak_ptr callbackPipelineSource_; + std::mutex mtxDecoderLock_; std::mutex mtxDecoderState_; std::mutex mtxHoldCount_; VideoConfigParams sourceConfig_; diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp index 14158e7aa700b5d90bdb5ec26fce43bb30938ab0..1eff94eff88040650ec1ba96422a6e37962e0f09 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp @@ -272,8 +272,9 @@ int32_t DecodeDataProcess::StopVideoDecoder() void DecodeDataProcess::ReleaseVideoDecoder() { - std::lock_guard lck(mtxDecoderState_); DHLOGD("Start release videoDecoder."); + std::lock_guard inputLock(mtxDecoderLock_); + std::lock_guard outputLock(mtxDecoderState_); if (videoDecoder_ == nullptr) { DHLOGE("The video decoder does not exist before ReleaseVideoDecoder."); decodeVideoCallback_ = nullptr; @@ -405,7 +406,7 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() } { - std::lock_guard lck(mtxDecoderState_); + std::lock_guard inputLock(mtxDecoderLock_); if (videoDecoder_ == nullptr) { DHLOGE("The video decoder does not exist before GetInputBuffer."); return DCAMERA_OK; @@ -769,7 +770,7 @@ void DecodeDataProcess::OnOutputBufferAvailable(uint32_t index, const Media::AVC info.presentationTimeUs, info.size, info.offset, flag); outputInfo_ = info; { - std::lock_guard lck(mtxDecoderState_); + std::lock_guard outputLock(mtxDecoderState_); if (videoDecoder_ == nullptr) { DHLOGE("The video decoder does not exist before decoding data."); return; diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp index 6a42895d0fd0be1715332f1e4b0ac4de2ca68993..d6c489323e1868c8b7b704d8d48c98c6f5ec0ba9 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp @@ -261,8 +261,9 @@ int32_t DecodeDataProcess::StopVideoDecoder() void DecodeDataProcess::ReleaseVideoDecoder() { - std::lock_guard lck(mtxDecoderState_); DHLOGD("Start release videoDecoder."); + std::lock_guard inputLock(mtxDecoderLock_); + std::lock_guard outputLock(mtxDecoderState_); if (videoDecoder_ == nullptr) { DHLOGE("The video decoder does not exist before ReleaseVideoDecoder."); decodeVideoCallback_ = nullptr; @@ -394,7 +395,7 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() } { - std::lock_guard lck(mtxDecoderState_); + std::lock_guard inputLock(mtxDecoderLock_); if (videoDecoder_ == nullptr) { DHLOGE("The video decoder does not exist before GetInputBuffer."); return DCAMERA_OK; @@ -652,7 +653,7 @@ void DecodeDataProcess::OnOutputBufferAvailable(uint32_t index, const Media::AVC info.presentationTimeUs, info.size, info.offset, flag); outputInfo_ = info; { - std::lock_guard lck(mtxDecoderState_); + std::lock_guard outputLock(mtxDecoderState_); if (videoDecoder_ == nullptr) { DHLOGE("The video decoder does not exist before decoding data."); return;