From: Lennart Poettering Date: Sat, 14 Jun 2008 21:33:21 +0000 (+0000) Subject: avoid division by zero when informing user about unloaded lazy samples in the sample... X-Git-Tag: v0.9.11~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce534976cec4fe3fa4b861b0136062e817ed0994;p=platform%2Fupstream%2Fpulseaudio.git avoid division by zero when informing user about unloaded lazy samples in the sample cache git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2529 fefdeb5f-60dc-0310-8127-8f9354f1896f --- diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index a05c0f7ef..7d8b93992 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -2566,12 +2566,15 @@ static void scache_fill_tagstruct(connection *c, pa_tagstruct *t, pa_scache_entr pa_assert(t); pa_assert(e); - fixup_sample_spec(c, &fixed_ss, &e->sample_spec); + if (e->memchunk.memblock) + fixup_sample_spec(c, &fixed_ss, &e->sample_spec); + else + memset(&fixed_ss, 0, sizeof(fixed_ss)); pa_tagstruct_putu32(t, e->index); pa_tagstruct_puts(t, e->name); pa_tagstruct_put_cvolume(t, &e->volume); - pa_tagstruct_put_usec(t, pa_bytes_to_usec(e->memchunk.length, &e->sample_spec)); + pa_tagstruct_put_usec(t, e->memchunk.memblock ? pa_bytes_to_usec(e->memchunk.length, &e->sample_spec) : NULL); pa_tagstruct_put_sample_spec(t, &fixed_ss); pa_tagstruct_put_channel_map(t, &e->channel_map); pa_tagstruct_putu32(t, e->memchunk.length);