Re: lavrec+lml33+sblive - ERROR: Unable to get audio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, 8 Sep 2003, Steve Tell wrote:

> On Mon, 8 Sep 2003, Ronald Bultje wrote:
> 
> > Hi Steve,
> > 
> > On Mon, 2003-09-08 at 06:56, Steve Tell wrote:
> > >    INFO: [lavrec] Getting audio ...
> > > 
> > > (pause of several seconds here)
> > > 
> > > **ERROR: [lavrec] Unable to get audio - exiting ....
> > 
> > Uhm, that's odd... You *are* using --use-read (-U), that's the proper


> In the meantime perhaps I'll look into testrec some more try to figure out 
> what's different between the audio apps that work and lavtools/audiolib.c.
> I think it may actually be capturing audio, but having trouble with 
> timestamps.

I've confirmed this hypothesis.
Adding some new debug output and uncommenting existing prints yields:
# ./trectst 

Audio parameters:

Audio sample size:           16 bit
Audio sampling rate:         44100 Hz
Audio is STEREO
Audio input recording level: 100 %
Don't mute audio output during recording
Recording source: l

   INFO: [testrec] Using read(2) system call for capture
do_audio: maxdiff = 460                                         !
Info: Getting audio ... 
audio_read res=0 astat=0
   INFO: [testrec] CB=00006304 ND=002208 BL=001 NB=0
audio_read res=4096 astat=1
   INFO: [testrec] CB=00010400 ND=002208 BL=001 NB=1
audio_read res=4096 astat=1
   INFO: [testrec] CB=00014496 ND=002208 BL=001 NB=2
   INFO: [testrec] CB=00018592 ND=002208 BL=001 NB=3
audio_read res=4096 astat=1
   INFO: [testrec] CB=00022688 ND=002208 BL=001 NB=4
audio_read res=4096 astat=1
   INFO: [testrec] CB=00026784 ND=002208 BL=001 NB=5
audio_read res=4096 astat=1
   INFO: [testrec] CB=00030880 ND=002208 BL=001 NB=6


In the INFO lines, ND (ndiff) "difference of minimum number of bytes after 
the select call and bytes actually present" is always greater than 
maxdiff (460), so the timestamp always discarded.

This computation of maxdiff in the setup code is bogus because of integer 
overflow in lavtools/audiolib.c:

	maxdiff = TIME_STAMP_TOL*audio_byte_rate/1000000;
(TIME_STAMP_TOL is 100000 and audio_byte_rate is 176400.  
Same in both mjpegtools-1.6.1 and -1.6.1.90).

forcing it to floating point and back makes everything work and I can 
capture video + audio nicely (patch attached):

	maxdiff = (int) (((double)TIME_STAMP_TOL)*audio_byte_rate/1000000.0);

Which begs the question, how come audio in lavrec ever worked for anyone?  
I guess I ought to get onto the mjpegtools list to report this...

Steve
*** mjpegtools-1.6.1/lavtools/audiolib.c~	Sat Jul  6 02:15:26 2002
--- mjpegtools-1.6.1/lavtools/audiolib.c	Tue Sep  9 00:27:17 2003
***************
*** 745,751 ****
  
  /* 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,751 ----
  
  /* Calculate number of bytes corresponding to TIME_STAMP_TOL */
  
!    maxdiff = (int) (((double)TIME_STAMP_TOL)*audio_byte_rate/1000000.0);
  
  /*
   * Check that the device has capability to do mmap and trigger

[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux