diff --git a/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.cc b/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.cc index 0ea28fb80..0b0e1ada4 100644 --- a/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.cc +++ b/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.cc @@ -33,9 +33,16 @@ uint32_t RtpGenerator::GetRtpHeader(uint8_t payload_type, uint32_t this_send_time = next_send_time_ms_; assert(samples_per_ms_ > 0); - next_send_time_ms_ += payload_length_samples / samples_per_ms_; + next_send_time_ms_ += ((1.0 + drift_factor_) * payload_length_samples) / + samples_per_ms_; return this_send_time; } +void RtpGenerator::set_drift_factor(double factor) { + if (factor > -1.0) { + drift_factor_ = factor; + } +} + } // namespace test } // namespace webrtc diff --git a/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.h b/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.h index a2f885f31..ece7ef298 100644 --- a/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.h +++ b/webrtc/modules/audio_coding/neteq4/tools/rtp_generator.h @@ -30,7 +30,8 @@ class RtpGenerator { timestamp_(start_timestamp), next_send_time_ms_(start_send_time_ms), ssrc_(ssrc), - samples_per_ms_(samples_per_ms) { + samples_per_ms_(samples_per_ms), + drift_factor_(0.0) { } // Writes the next RTP header to |rtp_header|, which will be of type @@ -39,12 +40,15 @@ class RtpGenerator { uint32_t GetRtpHeader(uint8_t payload_type, size_t payload_length_samples, WebRtcRTPHeader* rtp_header); + void set_drift_factor(double factor); + private: uint16_t seq_number_; uint32_t timestamp_; uint32_t next_send_time_ms_; const uint32_t ssrc_; const int samples_per_ms_; + double drift_factor_; DISALLOW_COPY_AND_ASSIGN(RtpGenerator); };