renaming of jitter_buf in receive_buf, wallclock_ts (to be continued)

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@308 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent 00629bc2dc
commit 8132928ace

@ -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;

@ -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;

@ -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;

@ -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;
}

@ -58,7 +58,7 @@ struct amci_payload_t;
class AmAudio;
class AmSession;
class SdpPayload;
typedef map<unsigned int, AmRtpPacket, ts_less> JitterBuffer;
typedef map<unsigned int, AmRtpPacket, ts_less> ReceiveBuffer;
/**
* \brief RTP implementation
@ -121,8 +121,8 @@ protected:
auto_ptr<const SdpPayload> telephone_event_pt;
JitterBuffer jitter_buf;
AmMutex jitter_mut;
ReceiveBuffer receive_buf;
AmMutex receive_mut;
/* get next packet in buffer */
int nextPacket(AmRtpPacket& p);

Loading…
Cancel
Save