On Thu, 27 Nov 2003, Ronald Bultje wrote:

> Hi all,
> 
> as promised, today's the great day that mjpegtools-1.6.1.92 (release
> candidate 3) is online. It's basically the same as 1.6.1.91, with some
> small changes:

Hi Ronald et. al.,

Looking at mjpegtools-1.6.1.92 I don't see any fix for the problem I
reported with this computation in lavtools/audiolib.c:

   maxdiff = TIME_STAMP_TOL*audio_byte_rate/1000000;

TIME_STAMP_TOL*audio_byte_rate is very likely to overflow an int on a 32 
bit machine, with the result that capture may fail or fail to start at 
all.

The attached patch fixes it by casting through double; changing the cast
from double to long long would probably fine also.

Thanks for the great software.  This weekend i burned my first DVDRs from 
footage shot with my own camera using lavtools, mjpegtools, and dvdauthor.

Steve
*** mjpegtools-1.6.1/lavtools/audiolib.c.orig   Sat Jul  6 02:15:26 2002
--- mjpegtools-1.6.1/lavtools/audiolib.c        Sat Nov 15 15:12:35 2003
***************
*** 745,752 ****
  
  /* Calculate number of bytes corresponding to TIME_STAMP_TOL */
  
!    maxdiff = TIME_STAMP_TOL*audio_byte_rate/1000000;
! 
  /*
   * Check that the device has capability to do mmap and trigger
   */
--- 745,752 ----
  
  /* Calculate number of bytes corresponding to TIME_STAMP_TOL */
  
!    maxdiff = (int) (((double)TIME_STAMP_TOL)*audio_byte_rate/1000000.0);
! /*   printf("audio_byte_rate=%d maxdiff=%d\n", audio_byte_rate, maxdiff);*/
  /*
   * Check that the device has capability to do mmap and trigger
   */

Reply via email to