Commit 85e1d930 authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Fix incorrect _FREE and _USED circbuff calculation

parent 6b6d9d20
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -617,7 +617,8 @@ loff_t circbuf_lseek(struct file * file, loff_t offset, int orig) {
          case LSEEK_CIRC_USED:
          case LSEEK_CIRC_USED:
             bp=((camSeqGetJPEG_wp(chn)<<2) - file->f_pos);
             bp=((camSeqGetJPEG_wp(chn)<<2) - file->f_pos);
//             return (bp>=0)?bp:(bp+l); //!will return 0 if current pointer is a write pointer (waiting for the next frame)
//             return (bp>=0)?bp:(bp+l); //!will return 0 if current pointer is a write pointer (waiting for the next frame)
             return (file->f_pos=(bp>0)?bp:(bp + circbuf_priv_ptr[chn].buf_size)); //!Has a side effect of moving a file pointer!
             // the condition below was (bp>0), but this resulted in the same _FREE and _USED sizes reported when file and HW pointers are equal
             return (file->f_pos=(bp>=0)?bp:(bp + circbuf_priv_ptr[chn].buf_size)); //!Has a side effect of moving a file pointer!
          case LSEEK_CIRC_TORP:
          case LSEEK_CIRC_TORP:
             break;
             break;
          case LSEEK_CIRC_TOWP:
          case LSEEK_CIRC_TOWP: