mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: Fix snd_pcm_status() for dmix & co
Fetch the timestamp and other status fields by issuing snd_pcm_status() for the slave PCM. Also, fill the delay field properly. This should fix longstanding PA's complaints. Reported-by: Dan Hordern <danhordern@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									a5e5e3cd3c
								
							
						
					
					
						commit
						18ce3ec9ca
					
				
					 3 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -475,12 +475,13 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	memset(status, 0, sizeof(*status));
 | 
			
		||||
	snd_pcm_status(dmix->spcm, status);
 | 
			
		||||
	status->state = snd_pcm_dmix_state(pcm);
 | 
			
		||||
	status->trigger_tstamp = dmix->trigger_tstamp;
 | 
			
		||||
	gettimestamp(&status->tstamp, pcm->tstamp_type);
 | 
			
		||||
	status->avail = snd_pcm_mmap_playback_avail(pcm);
 | 
			
		||||
	status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;
 | 
			
		||||
	dmix->avail_max = 0;
 | 
			
		||||
	status->delay = snd_pcm_mmap_playback_delay(pcm);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -224,12 +224,13 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	memset(status, 0, sizeof(*status));
 | 
			
		||||
	snd_pcm_status(dshare->spcm, status);
 | 
			
		||||
	status->state = snd_pcm_state(dshare->spcm);
 | 
			
		||||
	status->trigger_tstamp = dshare->trigger_tstamp;
 | 
			
		||||
	gettimestamp(&status->tstamp, pcm->tstamp_type);
 | 
			
		||||
	status->avail = snd_pcm_mmap_playback_avail(pcm);
 | 
			
		||||
	status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
 | 
			
		||||
	dshare->avail_max = 0;
 | 
			
		||||
	status->delay = snd_pcm_mmap_playback_delay(pcm);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -187,13 +187,14 @@ static int snd_pcm_dsnoop_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	memset(status, 0, sizeof(*status));
 | 
			
		||||
	snd_pcm_status(dsnoop->spcm, status);
 | 
			
		||||
	state = snd_pcm_state(dsnoop->spcm);
 | 
			
		||||
	status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state;
 | 
			
		||||
	status->trigger_tstamp = dsnoop->trigger_tstamp;
 | 
			
		||||
	status->tstamp = dsnoop->update_tstamp;
 | 
			
		||||
	status->avail = snd_pcm_mmap_capture_avail(pcm);
 | 
			
		||||
	status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max;
 | 
			
		||||
	dsnoop->avail_max = 0;
 | 
			
		||||
	status->delay = snd_pcm_mmap_capture_delay(pcm);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue