Advertisement
Guest User

fix buffering problem in rockbox

a guest
Jan 21st, 2011
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.19 KB | None | 0 0
  1. peadar@fatlenny$ diff -Nuw apps/buffering.c.0 apps/buffering.c
  2. --- apps/buffering.c.0  2011-01-11 00:01:50.000000000 +0000
  3. +++ apps/buffering.c    2011-01-22 01:50:57.000000000 +0000
  4. @@ -681,7 +681,7 @@
  5.           * If this is true, then there's a handle even though we have still
  6.          * data to buffer. This should NEVER EVER happen! (but it does :( ) */
  7.         if (h->next && (overlap
  8. -                = ringbuf_add_cross(h->widx, copy_n, next_handle)) > 0)
  9. +                = ringbuf_add_cross(h->widx, copy_n, next_handle)) >= 0)
  10.         {
  11.             /* stop buffering data for now and post-pone buffering the rest */
  12.             stop = true;
  13. @@ -689,7 +689,11 @@
  14.                     " copy_n:%lu overlap:%ld h1.filerem:%lu\n", __func__,
  15.                     h->id, h->next->id, (unsigned long)copy_n, (long)overlap,
  16.                     (unsigned long)h->filerem);
  17. -            copy_n -= overlap;
  18. +            if (overlap == (ssize_t)copy_n) {
  19. +                DEBUGF("%u: buffer_handle(%d): READ NOTHING\n", thread_get_current(), handle_id);
  20. +                return false;
  21. +            }
  22. +            copy_n -= overlap + 1;
  23.         }
  24.  
  25.         /* rc is the actual amount read */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement