mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	NetBSD sometimes doesn't know SNDCTL_DSP_GETODELAY
Signed-off-by: Lennart Poettering <lennart@poettering.net>
This commit is contained in:
		
							parent
							
								
									cef5f48b50
								
							
						
					
					
						commit
						7c7133e09d
					
				
					 1 changed files with 21 additions and 2 deletions
				
			
		| 
						 | 
					@ -71,6 +71,11 @@
 | 
				
			||||||
#include <pulsecore/thread-mq.h>
 | 
					#include <pulsecore/thread-mq.h>
 | 
				
			||||||
#include <pulsecore/rtpoll.h>
 | 
					#include <pulsecore/rtpoll.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(__NetBSD__) && !defined(SNDCTL_DSP_GETODELAY)
 | 
				
			||||||
 | 
					#include <sys/audioio.h>
 | 
				
			||||||
 | 
					#include <sys/syscall.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "oss-util.h"
 | 
					#include "oss-util.h"
 | 
				
			||||||
#include "module-oss-symdef.h"
 | 
					#include "module-oss-symdef.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -399,13 +404,27 @@ static pa_usec_t io_sink_get_latency(struct userdata *u) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->use_getodelay) {
 | 
					    if (u->use_getodelay) {
 | 
				
			||||||
        int arg;
 | 
					        int arg;
 | 
				
			||||||
 | 
					#if defined(__NetBSD__) && !defined(SNDCTL_DSP_GETODELAY)
 | 
				
			||||||
 | 
					#if defined(AUDIO_GETBUFINFO)
 | 
				
			||||||
 | 
					        struct audio_info info;
 | 
				
			||||||
 | 
					        if (syscall(SYS_ioctl, u->fd, AUDIO_GETBUFINFO, &info) < 0) {
 | 
				
			||||||
 | 
					            pa_log_info("Device doesn't support AUDIO_GETBUFINFO: %s", pa_cstrerror(errno));
 | 
				
			||||||
 | 
					            u->use_getodelay = 0;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            arg = info.play.seek + info.blocksize / 2;
 | 
				
			||||||
 | 
					            r = pa_bytes_to_usec((size_t) arg, &u->sink->sample_spec);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        pa_log_info("System doesn't support AUDIO_GETBUFINFO");
 | 
				
			||||||
 | 
					        u->use_getodelay = 0;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
        if (ioctl(u->fd, SNDCTL_DSP_GETODELAY, &arg) < 0) {
 | 
					        if (ioctl(u->fd, SNDCTL_DSP_GETODELAY, &arg) < 0) {
 | 
				
			||||||
            pa_log_info("Device doesn't support SNDCTL_DSP_GETODELAY: %s", pa_cstrerror(errno));
 | 
					            pa_log_info("Device doesn't support SNDCTL_DSP_GETODELAY: %s", pa_cstrerror(errno));
 | 
				
			||||||
            u->use_getodelay = 0;
 | 
					            u->use_getodelay = 0;
 | 
				
			||||||
        } else
 | 
					        } else
 | 
				
			||||||
            r = pa_bytes_to_usec((size_t) arg, &u->sink->sample_spec);
 | 
					            r = pa_bytes_to_usec((size_t) arg, &u->sink->sample_spec);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!u->use_getodelay && u->use_getospace) {
 | 
					    if (!u->use_getodelay && u->use_getospace) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue