diff options
author | vincechiu <vincechiu@google.com> | 2021-07-12 16:45:18 +0800 |
---|---|---|
committer | vincechiu <vincechiu@google.com> | 2021-07-13 08:50:26 +0800 |
commit | 245fc85fbf2df3fca4a6a6923cf3bafa6dd4012e (patch) | |
tree | 0c71900c76672ffc189d29fc08c7f2bba808d7a3 | |
parent | 4807cad37027262dc6ca88fe6bc2972af0852de4 (diff) | |
download | camera-245fc85fbf2df3fca4a6a6923cf3bafa6dd4012e.tar.gz |
Camera: Correct the close latency
GCA calls flush() twice during close AP.
When GCA call the second flush(), it calls SetLatencyProfiler and then destroy the latency_profiler_ that created by first flush() in HidlProfilerImpl.
Don't set nullptr to profiler to avoid this issue.
Test: GCA
Bug: 191192127
Change-Id: I93af12c8c3f79da64a67ad60ca64f9bfacfa7154
-rw-r--r-- | common/hal/hidl_service/hidl_profiler.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/hal/hidl_service/hidl_profiler.cc b/common/hal/hidl_service/hidl_profiler.cc index 7f4726c..7bb8027 100644 --- a/common/hal/hidl_service/hidl_profiler.cc +++ b/common/hal/hidl_service/hidl_profiler.cc @@ -142,6 +142,9 @@ class HidlProfilerImpl : public HidlProfiler { } void SetLatencyProfiler(std::unique_ptr<Profiler> profiler) override { + if (profiler == nullptr || latency_profiler_ == nullptr) { + return; + } latency_profiler_ = std::move(profiler); if (latency_profiler_ != nullptr) { latency_profiler_->SetDumpFilePrefix( @@ -155,6 +158,9 @@ class HidlProfilerImpl : public HidlProfiler { } void SetFpsProfiler(std::unique_ptr<Profiler> profiler) override { + if (profiler == nullptr || fps_profiler_ == nullptr) { + return; + } fps_profiler_ = std::move(profiler); if (fps_profiler_ != nullptr) { fps_profiler_->SetDumpFilePrefix( |