summaryrefslogtreecommitdiffstats
path: root/ext/pulse
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-06-11 19:10:53 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-06-11 19:18:52 +0200
commit0bd984c52f1a172545930f94306b4e7a82cacb2e (patch)
treea3b5caa58e2330054384a772a21e53122bea1e2a /ext/pulse
parentc6c769aa8a6b711e9fbc74482c6d3747730ab542 (diff)
pulsesink: handle border cases in resampler
Diffstat (limited to 'ext/pulse')
-rw-r--r--ext/pulse/pulsesink.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index fd349e73..cc9902cd 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -800,6 +800,7 @@ gst_pulseringbuffer_start (GstRingBuffer * buf)
pa_threaded_mainloop_lock (psink->mainloop);
GST_DEBUG_OBJECT (psink, "starting");
pbuf->paused = FALSE;
+ gst_pulsering_set_corked (pbuf, FALSE, FALSE);
pa_threaded_mainloop_unlock (psink->mainloop);
return TRUE;
@@ -927,7 +928,7 @@ G_STMT_START { \
memcpy (d, se, bps); \
se -= bps; \
*accum += outr; \
- while ((*accum << 1) >= inr) { \
+ while (d < de && (*accum << 1) >= inr) { \
*accum -= inr; \
d += bps; \
} \
@@ -944,7 +945,7 @@ G_STMT_START { \
memcpy (d, se, bps); \
d += bps; \
*accum += inr; \
- while ((*accum << 1) >= outr) { \
+ while (s <= se && (*accum << 1) >= outr) { \
*accum -= outr; \
se -= bps; \
} \
@@ -1009,6 +1010,8 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
inr = in_samples - 1;
outr = out_samples - 1;
+ GST_DEBUG_OBJECT (psink, "in %d, out %d", inr, outr);
+
/* data_end points to the last sample we have to write, not past it. This is
* needed to properly handle reverse playback: it points to the last sample. */
data_end = data + (bps * inr);