OSDN Git Service

tunerec: include <unistd.h> for usleep
[rec10/rec10-git.git] / tunerec / tunerec.c
index d1ea2af..bce1a50 100755 (executable)
@@ -15,6 +15,8 @@
 #include <pthread.h>
 #include <stdbool.h>
 #include <string.h>
+#include <ctype.h>
+#include <unistd.h>
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #ifndef DTV_STREAM_ID
@@ -95,7 +97,7 @@ bool mrb_get(mrb* rb, char *target, size_t size) {
                // RingBuffer underflow.
                return false;
        }
-       if ( rb->rb_rt + size <= rb->rb_wt ) {
+       if ( rb->rb_rt + size <= RING_BUFFER_SIZE ) {
                // read bytes + newly taken bytes <= buffer max size
                memcpy(target, rb->rb_ptr + rb->rb_rt, size);
                rb->rb_rt = rb->rb_rt + size;