mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode (#2)
This is basically redo of all changed and add appropriate conditions to disable only ioctl calls, but preserve tstamp_type assignments. Fixes:15f2b276("pcm: hw: fix default timestamp type for O_APPPEND") Fixes:7e01443e("pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode") Link: https://github.com/alsa-project/alsa-lib/pull/450 Suggested-by: Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									15f2b27612
								
							
						
					
					
						commit
						8b75db9676
					
				
					 1 changed files with 13 additions and 19 deletions
				
			
		|  | @ -1665,22 +1665,23 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!(mode & SND_PCM_APPEND)) { |  | ||||||
| #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | ||||||
| 	if (SNDRV_PROTOCOL_VERSION(2, 0, 9) <= ver) { | 	if (SNDRV_PROTOCOL_VERSION(2, 0, 9) <= ver) { | ||||||
| 		struct timespec timespec; | 		struct timespec timespec; | ||||||
| 		if (clock_gettime(CLOCK_MONOTONIC, ×pec) == 0) { | 		if (clock_gettime(CLOCK_MONOTONIC, ×pec) == 0) { | ||||||
|  | 			if (!(mode & SND_PCM_APPEND)) { | ||||||
| 				int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; | 				int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; | ||||||
| 				if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) { | 				if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) { | ||||||
| 					ret = -errno; | 					ret = -errno; | ||||||
| 					SNDMSG("TTSTAMP failed"); | 					SNDMSG("TTSTAMP failed"); | ||||||
| 					return ret; | 					return ret; | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
| 			tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; | 			tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; | ||||||
| 		} | 		} | ||||||
| 	} else | 	} else | ||||||
| #endif | #endif | ||||||
| 		if (SNDRV_PROTOCOL_VERSION(2, 0, 5) <= ver) { | 	  if (SNDRV_PROTOCOL_VERSION(2, 0, 5) <= ver && !(mode & SND_PCM_APPEND)) { | ||||||
| 		int on = 1; | 		int on = 1; | ||||||
| 		if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) { | 		if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) { | ||||||
| 			ret = -errno; | 			ret = -errno; | ||||||
|  | @ -1688,13 +1689,6 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd, | ||||||
| 			return ret; | 			return ret; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) |  | ||||||
| 	else { |  | ||||||
| 		/* the first stream already sets this */ |  | ||||||
| 		tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; |  | ||||||
| 	} |  | ||||||
| #endif |  | ||||||
| 	 | 	 | ||||||
| 	hw = calloc(1, sizeof(snd_pcm_hw_t)); | 	hw = calloc(1, sizeof(snd_pcm_hw_t)); | ||||||
| 	if (!hw) { | 	if (!hw) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jaroslav Kysela
						Jaroslav Kysela