I missed most of this discussion (wretched network outages - it will
probably arrive in bits and pieces over the next day or two). I use the
following code for OSS timestamping:
struct audio_buf_info info;
long long u, ntime = getntime();
if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) < 0) {
PERROR("Could not determine buffer offset");
u = 0;
} else {
u = info.bytes;
u *= 1000000000ULL;
u /= realbps;
}
ntime -= u;
It works very well, even under OSS emulation on ALSA. (getntime is a
private function that returns time in nanoseconds.)
-justin
Michel Bardiaux wrote:
Ronald Bultje wrote:
hi Michel,
On Fri, 2003-05-16 at 11:08, Michel Bardiaux wrote:
My grab application works OK with V4L as far as video is concerned,
but I have a problem with sound (using OSS): I would like to have
exact timestamps on every sample in the sound stream, and I couldnt
find anything about that in any OSS documentation I could find on the
web. Any recommendations?
OSS doesn't provide timestamps. Simply call gettimeofday() after
receiving a sound buffer.
As is often the case with 'simply...'-stic solutions (in French, we call
that a YAKA) it does not work. Because (1) there could well be *another*
buffer already available in the kernel (2) the process could be
rescheduled between the read and the gettimeofday.
Ronald