fix calculation of pa_usec_to_bytes, to make sure that it never returns fractions...
authorLennart Poettering <lennart@poettering.net>
Sat, 29 Jul 2006 15:02:53 +0000 (15:02 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 29 Jul 2006 15:02:53 +0000 (15:02 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1165 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulse/sample.c

index 2e055bf..87b2d7a 100644 (file)
@@ -70,7 +70,7 @@ pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) {
 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) {
     assert(spec);
 
-    return ((double) t * spec->rate / 1000000)*pa_frame_size(spec); 
+    return (size_t) (((double) t * spec->rate / 1000000))*pa_frame_size(spec); 
 }
 
 int pa_sample_spec_valid(const pa_sample_spec *spec) {