summaryrefslogtreecommitdiffstats
path: root/src/modules/bluetooth/module-bluetooth-device.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marc-andre.lureau@nokia.com>2009-07-06 17:50:51 +0300
committerLennart Poettering <lennart@poettering.net>2009-08-15 02:42:56 +0200
commitfd32fee4488b1e06d0a64079485aa77f0c87164b (patch)
tree9b53cae3480b27086f1786778d3035dc9f5a47eb /src/modules/bluetooth/module-bluetooth-device.c
parentea5cdcbe52e3e1ac6189fb6472fafe61fbfdd73c (diff)
bluetooth: don't call pa_sink_render with 0 bytes request
Diffstat (limited to 'src/modules/bluetooth/module-bluetooth-device.c')
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 93b14a12..d9831854 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1319,18 +1319,21 @@ static void thread_func(void *userdata) {
if (u->write_index > 0 && audio_to_send > MAX_PLAYBACK_CATCH_UP_USEC) {
pa_usec_t skip_usec;
uint64_t skip_bytes;
- pa_memchunk tmp;
skip_usec = audio_to_send - MAX_PLAYBACK_CATCH_UP_USEC;
skip_bytes = pa_usec_to_bytes(skip_usec, &u->sample_spec);
- pa_log_warn("Skipping %llu us (= %llu bytes) in audio stream",
- (unsigned long long) skip_usec,
- (unsigned long long) skip_bytes);
+ if (skip_bytes > 0) {
+ pa_memchunk tmp;
- pa_sink_render_full(u->sink, skip_bytes, &tmp);
- pa_memblock_unref(tmp.memblock);
- u->write_index += skip_bytes;
+ pa_log_warn("Skipping %llu us (= %llu bytes) in audio stream",
+ (unsigned long long) skip_usec,
+ (unsigned long long) skip_bytes);
+
+ pa_sink_render_full(u->sink, skip_bytes, &tmp);
+ pa_memblock_unref(tmp.memblock);
+ u->write_index += skip_bytes;
+ }
}
do_write = 1;