summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorMaarten Bosmans <mkbosmans@gmail.com>2011-01-12 07:31:26 +0100
committerMaarten Bosmans <mkbosmans@gmail.com>2011-01-16 02:27:25 +0100
commit27db0603d6af7d25558af38ed525fc50330a9c32 (patch)
treea73c3c1db75a7742f77628f461c7a1ee4a73aa48 /src/modules
parente868638768fc492ff5906a6e38b8223808608976 (diff)
module-rtp-recv: Remove smoother from write index
It isn't necessary anymore with the new algorithm. The slow adjust of the smoother was even detrimental to the accuracy of the rate estimate.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/rtp/module-rtp-recv.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 3cf5d890..49fdf9b5 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -52,7 +52,6 @@
#include <pulsecore/macro.h>
#include <pulsecore/atomic.h>
#include <pulsecore/atomic.h>
-#include <pulsecore/time-smoother.h>
#include <pulsecore/socket-util.h>
#include <pulsecore/once.h>
@@ -104,7 +103,6 @@ struct session {
pa_atomic_t timestamp;
- pa_smoother *smoother;
pa_usec_t intended_latency;
pa_usec_t sink_latency;
@@ -197,10 +195,9 @@ static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) {
pa_sink_input_assert_ref(i);
pa_assert_se(s = i->userdata);
- if (b) {
- pa_smoother_pause(s->smoother, pa_rtclock_now());
+ if (b)
pa_memblockq_flush_read(s->memblockq);
- } else
+ else
s->first_packet = FALSE;
}
@@ -269,11 +266,6 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
} else
pa_rtclock_from_wallclock(&now);
- pa_smoother_put(s->smoother, pa_timeval_load(&now), pa_bytes_to_usec((uint64_t) pa_memblockq_get_write_index(s->memblockq), &s->sink_input->sample_spec));
-
- /* Tell the smoother that we are rolling now, in case it is still paused */
- pa_smoother_resume(s->smoother, pa_timeval_load(&now), TRUE);
-
if (pa_memblockq_push(s->memblockq, &chunk) < 0) {
pa_log_warn("Queue overrun");
pa_memblockq_seek(s->memblockq, (int64_t) chunk.length, PA_SEEK_RELATIVE, TRUE);
@@ -297,7 +289,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
pa_log_debug("Updating sample rate");
- wi = pa_smoother_get(s->smoother, pa_timeval_load(&now));
+ wi = pa_bytes_to_usec((uint64_t) pa_memblockq_get_write_index(s->memblockq), &s->sink_input->sample_spec);
ri = pa_bytes_to_usec((uint64_t) pa_memblockq_get_read_index(s->memblockq), &s->sink_input->sample_spec);
pa_log_debug("wi=%lu ri=%lu", (unsigned long) wi, (unsigned long) ri);
@@ -508,14 +500,6 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
s->sdp_info = *sdp_info;
s->rtpoll_item = NULL;
s->intended_latency = LATENCY_USEC;
- s->smoother = pa_smoother_new(
- PA_USEC_PER_SEC*5,
- PA_USEC_PER_SEC*2,
- TRUE,
- TRUE,
- 10,
- pa_timeval_load(&now),
- TRUE);
s->last_rate_update = pa_timeval_load(&now);
s->last_latency = LATENCY_USEC;
s->estimated_rate = (double) sink->sample_spec.rate;
@@ -619,8 +603,6 @@ static void session_free(struct session *s) {
pa_sdp_info_destroy(&s->sdp_info);
pa_rtp_context_destroy(&s->rtp_context);
- pa_smoother_free(s->smoother);
-
pa_xfree(s);
}