From e0b19f2df0b8c8c07dccb745271e3b4c1cf721f1 Mon Sep 17 00:00:00 2001
From: meizhigang <meizhigang@kylinsec.com.cn>
Date: Fri, 14 Apr 2023 14:11:00 +0800
Subject: [PATCH] fix(audio):Fix the type of return value in template
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 - 适配模板数据类型返回值

Signed-off-by: meizhigang <meizhigang@kylinsec.com.cn>
---
 lib/base/stl-helper.h              |  2 +-
 plugins/audio/pulse/pulse-node.cpp | 11 -----------
 plugins/audio/pulse/pulse-node.h   |  2 +-
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/lib/base/stl-helper.h b/lib/base/stl-helper.h
index 3f9017c..cf73b8d 100644
--- a/lib/base/stl-helper.h
+++ b/lib/base/stl-helper.h
@@ -42,7 +42,7 @@ public:
         {
             return iter->second;
         }
-        return nullptr;
+        return V();
     }
 };
 
diff --git a/plugins/audio/pulse/pulse-node.cpp b/plugins/audio/pulse/pulse-node.cpp
index eac7dfe..912a811 100644
--- a/plugins/audio/pulse/pulse-node.cpp
+++ b/plugins/audio/pulse/pulse-node.cpp
@@ -130,17 +130,6 @@ uint32_t PulseNode::get_base_volume()
     return uint32_t(PA_VOLUME_NORM);
 }
 
-std::string PulseNode::get_property(const std::string &key)
-{
-    auto iter = this->attrs_.find(key);
-    if (iter != this->attrs_.end())
-    {
-        return iter->second;
-    }
-
-    return std::string("");
-}
-
 void PulseNode::update(const pa_channel_map &channel_map,
                        const pa_cvolume &cvolume,
                        int32_t mute,
diff --git a/plugins/audio/pulse/pulse-node.h b/plugins/audio/pulse/pulse-node.h
index 06a76a7..664005c 100644
--- a/plugins/audio/pulse/pulse-node.h
+++ b/plugins/audio/pulse/pulse-node.h
@@ -96,7 +96,7 @@ public:
     uint32_t get_base_volume();
 
     // 获取属性
-    std::string get_property(const std::string &key);
+    std::string get_property(const std::string &key) { return MapHelper::get_value(this->attrs_, key); };
 
     sigc::signal<void, PulseNodeField> &signal_node_info_changed() { return this->node_info_changed_; };
 
-- 
2.27.0

