Merge "agm: plugin: tinyalsa: Fix subtraction overflow error" into audio-platform-arintf.lnx.1.0.c10
diff --git a/plugins/tinyalsa/src/agm_pcm_plugin.c b/plugins/tinyalsa/src/agm_pcm_plugin.c
index 92c53ce..176a218 100644
--- a/plugins/tinyalsa/src/agm_pcm_plugin.c
+++ b/plugins/tinyalsa/src/agm_pcm_plugin.c
@@ -340,6 +340,7 @@
uint32_t read_index, wall_clk_msw, wall_clk_lsw;
int64_t delta_wall_clk_us = 0;
uint32_t delta_wall_clk_frames = 0;
+ uint64_t sub_res = 0;
int ret = 0;
uint32_t period_size = priv->period_size; /** in frames */
uint32_t crossed_boundary = 0;
@@ -371,7 +372,8 @@
priv->pos_buf->wall_clk_lsw);
// Compute delta only if diff is greater than zero
if (dsp_wall_clk > cached_wall_clk) {
- delta_wall_clk_us = (int64_t)(dsp_wall_clk - cached_wall_clk);
+ __builtin_usubl_overflow(dsp_wall_clk,cached_wall_clk,&sub_res);
+ delta_wall_clk_us = (int64_t)sub_res;
}
}
// Identify the number of times of shared buffer length that the