mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Removed xrun_act. Added SND_PCM_STATE_DRAINING. Clean spinlock abuse in read/write path
This commit is contained in:
		
							parent
							
								
									057f56de06
								
							
						
					
					
						commit
						62493ec983
					
				
					 2 changed files with 0 additions and 34 deletions
				
			
		| 
						 | 
					@ -411,7 +411,6 @@ static assoc_t starts[] = { START(EXPLICIT), START(DATA), END };
 | 
				
			||||||
static assoc_t readys[] = { READY(FRAGMENT), READY(ASAP), END };
 | 
					static assoc_t readys[] = { READY(FRAGMENT), READY(ASAP), END };
 | 
				
			||||||
static assoc_t xfers[] = { XFER(INTERLEAVED), XFER(NONINTERLEAVED), END };
 | 
					static assoc_t xfers[] = { XFER(INTERLEAVED), XFER(NONINTERLEAVED), END };
 | 
				
			||||||
static assoc_t mmaps[] = { MMAP(INTERLEAVED), MMAP(NONINTERLEAVED), END };
 | 
					static assoc_t mmaps[] = { MMAP(INTERLEAVED), MMAP(NONINTERLEAVED), END };
 | 
				
			||||||
static assoc_t xrun_acts[] = { XRUN_ACT(DRAIN), XRUN_ACT(DROP), END };
 | 
					 | 
				
			||||||
static assoc_t onoff[] = { {0, "OFF", NULL}, {1, "ON", NULL}, {-1, "ON", NULL}, END };
 | 
					static assoc_t onoff[] = { {0, "OFF", NULL}, {1, "ON", NULL}, {-1, "ON", NULL}, END };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp)
 | 
					int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp)
 | 
				
			||||||
| 
						 | 
					@ -433,7 +432,6 @@ int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp)
 | 
				
			||||||
	fprintf(fp, "xfer_min   : %ld\n", (long)setup->xfer_min);
 | 
						fprintf(fp, "xfer_min   : %ld\n", (long)setup->xfer_min);
 | 
				
			||||||
	fprintf(fp, "xfer_align : %ld\n", (long)setup->xfer_align);
 | 
						fprintf(fp, "xfer_align : %ld\n", (long)setup->xfer_align);
 | 
				
			||||||
	fprintf(fp, "xrun_mode  : %s\n", assoc(setup->xrun_mode, xruns));
 | 
						fprintf(fp, "xrun_mode  : %s\n", assoc(setup->xrun_mode, xruns));
 | 
				
			||||||
	fprintf(fp, "xrun_act   : %s\n", assoc(setup->xrun_act, xrun_acts));
 | 
					 | 
				
			||||||
	fprintf(fp, "xrun_max   : %ld\n", (long)setup->xrun_max);
 | 
						fprintf(fp, "xrun_max   : %ld\n", (long)setup->xrun_max);
 | 
				
			||||||
	fprintf(fp, "mmap_shape : %s\n", assoc(setup->mmap_shape, mmaps));
 | 
						fprintf(fp, "mmap_shape : %s\n", assoc(setup->mmap_shape, mmaps));
 | 
				
			||||||
	fprintf(fp, "buffer_size: %ld\n", (long)setup->buffer_size);
 | 
						fprintf(fp, "buffer_size: %ld\n", (long)setup->buffer_size);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,38 +36,6 @@ size_t snd_pcm_mmap_avail(snd_pcm_t *pcm)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int snd_pcm_mmap_playback_ready(snd_pcm_t *pcm)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (pcm->mmap_status->state == SND_PCM_STATE_XRUN)
 | 
					 | 
				
			||||||
		return -EPIPE;
 | 
					 | 
				
			||||||
	return snd_pcm_mmap_playback_avail(pcm) >= pcm->setup.avail_min;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static int snd_pcm_mmap_capture_ready(snd_pcm_t *pcm)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
	if (pcm->mmap_status->state == SND_PCM_STATE_XRUN) {
 | 
					 | 
				
			||||||
		ret = -EPIPE;
 | 
					 | 
				
			||||||
		if (pcm->setup.xrun_act == SND_PCM_XRUN_ACT_DROP)
 | 
					 | 
				
			||||||
			return -EPIPE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (snd_pcm_mmap_capture_avail(pcm) >= pcm->setup.avail_min)
 | 
					 | 
				
			||||||
		return 1;
 | 
					 | 
				
			||||||
	return ret;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int snd_pcm_mmap_ready(snd_pcm_t *pcm)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
        assert(pcm);
 | 
					 | 
				
			||||||
	assert(pcm->mmap_status && pcm->mmap_control);
 | 
					 | 
				
			||||||
	assert(pcm->mmap_status->state >= SND_PCM_STATE_PREPARED);
 | 
					 | 
				
			||||||
	if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
 | 
					 | 
				
			||||||
		return snd_pcm_mmap_playback_ready(pcm);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		return snd_pcm_mmap_capture_ready(pcm);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
size_t snd_pcm_mmap_playback_xfer(snd_pcm_t *pcm, size_t frames)
 | 
					size_t snd_pcm_mmap_playback_xfer(snd_pcm_t *pcm, size_t frames)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_pcm_mmap_control_t *control = pcm->mmap_control;
 | 
						snd_pcm_mmap_control_t *control = pcm->mmap_control;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue