From fc31e449761721d75e2dc8ad80c2f1d553748890 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Mon, 30 Jul 2007 15:03:31 +0000 Subject: [PATCH] bugfixes: recv_offset_i was not initialized, which could lead to no audio input on big TS difference. timestamps correctly reset on resync. git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@414 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmPlayoutBuffer.cpp | 12 +++++++----- core/AmRtpStream.cpp | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/AmPlayoutBuffer.cpp b/core/AmPlayoutBuffer.cpp index b3e029d4..b7c79a7b 100644 --- a/core/AmPlayoutBuffer.cpp +++ b/core/AmPlayoutBuffer.cpp @@ -19,7 +19,9 @@ #define MAX_DELAY 8000 /* 1 second */ AmPlayoutBuffer::AmPlayoutBuffer(AmPLCBuffer *plcbuffer) - : r_ts(0),w_ts(0), last_ts_i(false), m_plcbuffer(plcbuffer) + : r_ts(0),w_ts(0), + last_ts_i(false), recv_offset_i(false), + m_plcbuffer(plcbuffer) { } @@ -36,12 +38,12 @@ void AmPlayoutBuffer::write(u_int32_t ref_ts, u_int32_t rtp_ts, { recv_offset = rtp_ts - ref_ts; recv_offset_i = true; - DBG("initialized recv_offset with %i (%i - %i)\n", + DBG("initialized recv_offset with %u (%u - %u)\n", recv_offset, ref_ts, rtp_ts); - mapped_ts = r_ts = w_ts = ref_ts;// + jitter_delay; + mapped_ts = r_ts = w_ts = ref_ts; } else { - mapped_ts = rtp_ts - recv_offset;// + jitter_delay; + mapped_ts = rtp_ts - recv_offset; // resync if( ts_less()(mapped_ts, ref_ts - MAX_DELAY/2) || @@ -50,7 +52,7 @@ void AmPlayoutBuffer::write(u_int32_t ref_ts, u_int32_t rtp_ts, DBG("resync needed: reference ts = %u; write ts = %u\n", ref_ts, mapped_ts); recv_offset = rtp_ts - ref_ts; - mapped_ts = ref_ts;// + jitter_delay; + mapped_ts = r_ts = w_ts = ref_ts; } } diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp index 7649b063..1e4cea1a 100644 --- a/core/AmRtpStream.cpp +++ b/core/AmRtpStream.cpp @@ -265,7 +265,6 @@ AmRtpStream::AmRtpStream(AmSession* _s) r_port(0), l_port(0), l_sd(0), - // recv_offset_i(false), r_ssrc_i(false), session(_s), passive(false),