From b66a7b09c8ac7394fcc699a6a0bd833d375ed329 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 8 Jun 2007 11:47:17 +0000 Subject: [PATCH] fix: set wsola and w_ts offset correctly after time scaling git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@359 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmPlayoutBuffer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/AmPlayoutBuffer.cpp b/core/AmPlayoutBuffer.cpp index b77ab098..b3e029d4 100644 --- a/core/AmPlayoutBuffer.cpp +++ b/core/AmPlayoutBuffer.cpp @@ -249,8 +249,12 @@ void AmAdaptivePlayout::write_buffer(u_int32_t ref_ts, u_int32_t ts, n_len = time_scale(ts,f,len); wsola_off = old_off + n_len - len; - - //ts += n_len - len; + + // if we have shrinked the voice, set back w_ts + // in order to have correct start point for possible + // PLC + if (n_len < (int32_t) len) + w_ts += n_len - len; if(w_ts != old_wts) plc_cnt = 0; @@ -266,7 +270,8 @@ u_int32_t AmAdaptivePlayout::read(u_int32_t ts, int16_t* buf, u_int32_t len) if(ts_less()(w_ts,ts+len) && (plc_cnt < 6)){ if(!plc_cnt){ - time_scale(w_ts-len,2.0, len); + int nlen = time_scale(w_ts-len,2.0, len); + wsola_off += nlen-len; } else { do_plc = true;