NetBSD-Bugs archive

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

Re: kern/50613: unpausing audio(4) causes already written data to be dropped



The following reply was made to PR kern/50613; it has been noted by GNATS.

From: Onno van der Linden <o.vd.linden%quicknet.nl@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/50613: unpausing audio(4) causes already written data to be
 dropped
Date: Mon, 4 Jan 2016 21:27:26 +0100

 And a test case
 
 #include <sys/audioio.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 
 main()
 {
         int     fd;
         char    buf[1024];
 	unsigned long	wseek;
         audio_offset_t  ao;
         struct audio_info       ai;
 
         memset(buf,'\0',sizeof buf);
         AUDIO_INITINFO(&ai);
         fd=open("/dev/audio",O_WRONLY,0);
         ai.play.pause=1;
         ai.blocksize=1024;
         ioctl(fd, AUDIO_SETINFO, &ai);
         ioctl(fd, AUDIO_GETOOFFS, &ao);
         printf("After open/pause samples=%u deltablks=%u offset=%u\n",ao.samples,ao.deltablks, ao.offset);
         write(fd,buf,sizeof buf);
         ioctl(fd, AUDIO_GETOOFFS, &ao);
         printf("After write samples=%u deltablks=%u offset=%u\n",ao.samples,ao.deltablks, ao.offset);
         AUDIO_INITINFO(&ai);
         ai.play.pause=0;
         ioctl(fd, AUDIO_SETINFO, &ai);
         ioctl(fd, AUDIO_GETOOFFS, &ao);
         printf("After unpause samples=%u deltablks=%u offset=%u\n",ao.samples,ao.deltablks, ao.offset);
         write(fd,buf,sizeof buf);
         ioctl(fd, AUDIO_DRAIN);
         ioctl(fd, AUDIO_GETOOFFS, &ao);
         printf("After write samples=%u deltablks=%u offset=%u\n",ao.samples,ao.deltablks, ao.offset);
         close(fd);
 }
 
 Run straight after booting an unpatched kernel:
 
 After open/pause samples=0 deltablks=0 offset=1024 
 After write samples=1024 deltablks=1 offset=2048
 After unpause samples=0 deltablks=0 offset=2048 
 After write samples=1024 deltablks=1 offset=3072
 
 
 Run straight after booting a kernel with the patch:
 After open/pause samples=0 deltablks=0 offset=1024 
 After write samples=1024 deltablks=1 offset=2048
 After unpause samples=1024 deltablks=0 offset=2048 
 After write samples=2048 deltablks=1 offset=3072
 
 samples=0 after unpause vs. samples=1024 after unpause
 


Home | Main Index | Thread Index | Old Index