Merge "pal: use default value if preroll is not set with 2nd stage enabled"
diff --git a/configs/kalama/resourcemanager_kalama_cdp.xml b/configs/kalama/resourcemanager_kalama_cdp.xml
index f9fab4e..b336363 100644
--- a/configs/kalama/resourcemanager_kalama_cdp.xml
+++ b/configs/kalama/resourcemanager_kalama_cdp.xml
@@ -1260,8 +1260,9 @@
<!-- do update acdb and usecaseKvManager.xml files by adding more instances -->
<param pdk_first_stage_max_engine_count="1"/>
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/kalama/resourcemanager_kalama_mtp.xml b/configs/kalama/resourcemanager_kalama_mtp.xml
index dea9e57..488bc63 100644
--- a/configs/kalama/resourcemanager_kalama_mtp.xml
+++ b/configs/kalama/resourcemanager_kalama_mtp.xml
@@ -1273,8 +1273,9 @@
<!-- do update acdb and usecaseKvManager.xml files by adding more instances -->
<param pdk_first_stage_max_engine_count="1"/>
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/kalama/resourcemanager_kalama_qrd.xml b/configs/kalama/resourcemanager_kalama_qrd.xml
index 7a36ef1..7f139c8 100644
--- a/configs/kalama/resourcemanager_kalama_qrd.xml
+++ b/configs/kalama/resourcemanager_kalama_qrd.xml
@@ -1276,8 +1276,9 @@
<!-- do update acdb and usecaseKvManager.xml files by adding more instances -->
<param pdk_first_stage_max_engine_count="1"/>
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/taro/resourcemanager_cdp_wcd.xml b/configs/taro/resourcemanager_cdp_wcd.xml
index 2194384..1354378 100644
--- a/configs/taro/resourcemanager_cdp_wcd.xml
+++ b/configs/taro/resourcemanager_cdp_wcd.xml
@@ -827,8 +827,9 @@
<param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
<param merge_first_stage_sound_models="false" />
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/taro/resourcemanager_diwali_idp.xml b/configs/taro/resourcemanager_diwali_idp.xml
index 82c0d11..e965df7 100644
--- a/configs/taro/resourcemanager_diwali_idp.xml
+++ b/configs/taro/resourcemanager_diwali_idp.xml
@@ -1044,8 +1044,9 @@
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<operating_modes>
<low_power capture_profile_handset="DUAL_MIC_16KHZ_16BIT_FFNS" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_FFNS"/>
<high_performance capture_profile_handset="DUAL_MIC_16KHZ_16BIT_FFECNS" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_FFECNS"/>
diff --git a/configs/taro/resourcemanager_diwali_idp_sku1.xml b/configs/taro/resourcemanager_diwali_idp_sku1.xml
index 1aeda95..21ac867 100644
--- a/configs/taro/resourcemanager_diwali_idp_sku1.xml
+++ b/configs/taro/resourcemanager_diwali_idp_sku1.xml
@@ -1044,8 +1044,9 @@
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<operating_modes>
<low_power capture_profile_handset="SINGLE_MIC_16KHZ_16BIT_RAW_LPI" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_RAW_LPI"/>
<high_performance capture_profile_handset="DUAL_MIC_16KHZ_16BIT_FFECNS" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_FFECNS"/>
diff --git a/configs/taro/resourcemanager_diwali_qrd.xml b/configs/taro/resourcemanager_diwali_qrd.xml
index 1387025..b8d9658 100644
--- a/configs/taro/resourcemanager_diwali_qrd.xml
+++ b/configs/taro/resourcemanager_diwali_qrd.xml
@@ -1044,8 +1044,9 @@
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<operating_modes>
<low_power capture_profile_handset="DUAL_MIC_16KHZ_16BIT_FFNS" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_FFNS"/>
<high_performance capture_profile_handset="DUAL_MIC_16KHZ_16BIT_FFECNS" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_FFECNS"/>
diff --git a/configs/taro/resourcemanager_diwali_qrd_sku1.xml b/configs/taro/resourcemanager_diwali_qrd_sku1.xml
index 93f63c5..71a3de3 100644
--- a/configs/taro/resourcemanager_diwali_qrd_sku1.xml
+++ b/configs/taro/resourcemanager_diwali_qrd_sku1.xml
@@ -1044,8 +1044,9 @@
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<operating_modes>
<low_power capture_profile_handset="SINGLE_MIC_16KHZ_16BIT_RAW_LPI" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_RAW_LPI"/>
<high_performance capture_profile_handset="DUAL_MIC_16KHZ_16BIT_FFECNS" capture_profile_headset="SINGLE_MIC_16KHZ_16BIT_HEADSET_FFECNS"/>
diff --git a/configs/taro/resourcemanager_upd.xml b/configs/taro/resourcemanager_upd.xml
index 2b711f6..4bec954 100644
--- a/configs/taro/resourcemanager_upd.xml
+++ b/configs/taro/resourcemanager_upd.xml
@@ -956,8 +956,9 @@
<param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
<param merge_first_stage_sound_models="false" />
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/taro/resourcemanager_waipio_cdp.xml b/configs/taro/resourcemanager_waipio_cdp.xml
old mode 100755
new mode 100644
index e8e5217..0bece5c
--- a/configs/taro/resourcemanager_waipio_cdp.xml
+++ b/configs/taro/resourcemanager_waipio_cdp.xml
@@ -1111,8 +1111,9 @@
<!-- do update acdb and usecaseKvManager.xml files by adding more instances -->
<param pdk_first_stage_max_engine_count="1"/>
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/taro/resourcemanager_waipio_mtp.xml b/configs/taro/resourcemanager_waipio_mtp.xml
old mode 100755
new mode 100644
index c6942f0..0d8736b
--- a/configs/taro/resourcemanager_waipio_mtp.xml
+++ b/configs/taro/resourcemanager_waipio_mtp.xml
@@ -1167,8 +1167,9 @@
<!-- do update acdb and usecaseKvManager.xml files by adding more instances -->
<param pdk_first_stage_max_engine_count="1"/>
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/configs/taro/resourcemanager_waipio_qrd.xml b/configs/taro/resourcemanager_waipio_qrd.xml
old mode 100755
new mode 100644
index 4f0cc77..98c44c1
--- a/configs/taro/resourcemanager_waipio_qrd.xml
+++ b/configs/taro/resourcemanager_waipio_qrd.xml
@@ -1127,8 +1127,9 @@
<!-- do update acdb and usecaseKvManager.xml files by adding more instances -->
<param pdk_first_stage_max_engine_count="1"/>
<!-- Profile specific data which the algorithm can support -->
- <param capture_keyword="2000" />
- <param client_capture_read_delay="2000" />
+ <param capture_keyword="2000" /> <!-- Default history buffer length -->
+ <param client_capture_read_delay="2000" /> <!-- reserved buffer duration for rt data -->
+ <param pre_roll_duration="500" /> <!-- Default preroll duration -->
<!-- durations in us -->
<param kw_start_tolerance="360000" />
<param kw_end_tolerance="240000" />
diff --git a/stream/src/StreamSoundTrigger.cpp b/stream/src/StreamSoundTrigger.cpp
index e4caea1..831759d 100644
--- a/stream/src/StreamSoundTrigger.cpp
+++ b/stream/src/StreamSoundTrigger.cpp
@@ -1607,6 +1607,11 @@
}
}
+ // use default value if preroll is not set
+ if (pre_roll_duration_ == 0) {
+ pre_roll_duration_ = sm_cfg_->GetPreRollDuration();
+ }
+
client_capture_read_delay = sm_cfg_->GetCaptureReadDelay();
PAL_DBG(LOG_TAG, "history buf len = %d, preroll len = %d, read delay = %d",
hist_buf_duration_, pre_roll_duration_, client_capture_read_delay);
diff --git a/utils/inc/VoiceUIPlatformInfo.h b/utils/inc/VoiceUIPlatformInfo.h
index 26848ed..a035ed2 100644
--- a/utils/inc/VoiceUIPlatformInfo.h
+++ b/utils/inc/VoiceUIPlatformInfo.h
@@ -135,6 +135,7 @@
bool isQCVAUUID() const { return is_qcva_uuid_; }
uint32_t GetKwDuration() const { return capture_keyword_; }
uint32_t GetCaptureReadDelay() const { return client_capture_read_delay_; }
+ uint32_t GetPreRollDuration() const { return pre_roll_duration_; }
uint32_t GetKwStartTolerance() const { return kw_start_tolerance_; }
uint32_t GetKwEndTolerance() const { return kw_end_tolerance_; }
uint32_t GetDataBeforeKwStart() const { return data_before_kw_start_; }
@@ -166,6 +167,7 @@
bool merge_first_stage_sound_models_;
uint32_t capture_keyword_;
uint32_t client_capture_read_delay_;
+ uint32_t pre_roll_duration_;
uint32_t kw_start_tolerance_;
uint32_t kw_end_tolerance_;
uint32_t data_before_kw_start_;
diff --git a/utils/src/VoiceUIPlatformInfo.cpp b/utils/src/VoiceUIPlatformInfo.cpp
index bbc2e37..7fac943 100644
--- a/utils/src/VoiceUIPlatformInfo.cpp
+++ b/utils/src/VoiceUIPlatformInfo.cpp
@@ -180,6 +180,7 @@
merge_first_stage_sound_models_(false),
capture_keyword_(2000),
client_capture_read_delay_(2000),
+ pre_roll_duration_(0),
supported_first_stage_engine_count_(1),
curr_child_(nullptr)
{
@@ -299,6 +300,8 @@
capture_keyword_ = std::stoi(attribs[++i]);
} else if (!strcmp(attribs[i], "client_capture_read_delay")) {
client_capture_read_delay_ = std::stoi(attribs[++i]);
+ } else if (!strcmp(attribs[i], "pre_roll_duration")) {
+ pre_roll_duration_ = std::stoi(attribs[++i]);
} else if (!strcmp(attribs[i], "kw_start_tolerance")) {
kw_start_tolerance_ = std::stoi(attribs[++i]);
} else if (!strcmp(attribs[i], "kw_end_tolerance")) {