diff --git a/core/AmMediaProcessor.cpp b/core/AmMediaProcessor.cpp index f41bda51..dc86b7ff 100644 --- a/core/AmMediaProcessor.cpp +++ b/core/AmMediaProcessor.cpp @@ -178,6 +178,7 @@ void AmMediaProcessorThread::on_stop() void AmMediaProcessorThread::run() { struct timeval now,next_tick,diff,tick; + // wallclock time unsigned int ts = 0; tick.tv_sec = 0; diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp index f1f6892c..fe3508b5 100644 --- a/core/AmRtpAudio.cpp +++ b/core/AmRtpAudio.cpp @@ -69,9 +69,9 @@ unsigned int AmRtpAudio::bytes2samples(unsigned int bytes) const return AmAudio::bytes2samples(bytes); } /* - @param audio_buffer_ts [in] the current ts in the audio buffer + @param wallclock_ts [in] the current ts in the audio buffer */ -int AmRtpAudio::receive(unsigned int audio_buffer_ts) +int AmRtpAudio::receive(unsigned int wallclock_ts) { int size; unsigned int rtp_ts; @@ -97,7 +97,7 @@ int AmRtpAudio::receive(unsigned int audio_buffer_ts) return -1; } - playout_buffer->write(audio_buffer_ts, rtp_ts, (ShortSample*)((unsigned char *)samples), + playout_buffer->write(wallclock_ts, rtp_ts, (ShortSample*)((unsigned char *)samples), PCM16_B2S(size), begin_talk); } return size; diff --git a/core/AmRtpAudio.h b/core/AmRtpAudio.h index ebc3fa5e..0f73be58 100644 --- a/core/AmRtpAudio.h +++ b/core/AmRtpAudio.h @@ -72,7 +72,7 @@ public: void setCurrentPayload(int payload); - int receive(unsigned int audio_buffer_ts); + int receive(unsigned int wallclock_ts); void setSendOnly(bool so){ send_only = so; diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp index aa15e6fc..7649b063 100644 --- a/core/AmRtpStream.cpp +++ b/core/AmRtpStream.cpp @@ -403,9 +403,9 @@ void AmRtpStream::bufferPacket(const AmRtpPacket* p) if (!receiving && !passive) return; - jitter_mut.lock(); - jitter_buf[p->timestamp].copy(p); - jitter_mut.unlock(); + receive_mut.lock(); + receive_buf[p->timestamp].copy(p); + receive_mut.unlock(); } void AmRtpStream::clearRTPTimeout(struct timeval* recv_time) { @@ -421,26 +421,26 @@ int AmRtpStream::nextPacket(AmRtpPacket& p) struct timeval diff; gettimeofday(&now,NULL); - jitter_mut.lock(); + receive_mut.lock(); timersub(&now,&last_recv_time,&diff); if(AmConfig::DeadRtpTime && (diff.tv_sec > 0) && ((unsigned int)diff.tv_sec > AmConfig::DeadRtpTime)){ WARN("RTP Timeout detected. Last received packet is too old.\n"); DBG("diff.tv_sec = %i\n",(unsigned int)diff.tv_sec); - jitter_mut.unlock(); + receive_mut.unlock(); return RTP_TIMEOUT; } - if(jitter_buf.empty()){ - jitter_mut.unlock(); + if(receive_buf.empty()){ + receive_mut.unlock(); return RTP_EMPTY; } - AmRtpPacket& pp = jitter_buf.begin()->second; + AmRtpPacket& pp = receive_buf.begin()->second; p.copy(&pp); - jitter_buf.erase(jitter_buf.begin()); - jitter_mut.unlock(); + receive_buf.erase(receive_buf.begin()); + receive_mut.unlock(); return 1; } diff --git a/core/AmRtpStream.h b/core/AmRtpStream.h index 120770c5..5c1a6c00 100644 --- a/core/AmRtpStream.h +++ b/core/AmRtpStream.h @@ -58,7 +58,7 @@ struct amci_payload_t; class AmAudio; class AmSession; class SdpPayload; -typedef map JitterBuffer; +typedef map ReceiveBuffer; /** * \brief RTP implementation @@ -121,8 +121,8 @@ protected: auto_ptr telephone_event_pt; - JitterBuffer jitter_buf; - AmMutex jitter_mut; + ReceiveBuffer receive_buf; + AmMutex receive_mut; /* get next packet in buffer */ int nextPacket(AmRtpPacket& p);