mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: plugin - optimize sync in snd_pcm_plugin_status()
Do hw_ptr sync only once after the status call. This avoids double update. Also, the application pointer must not change when the status is called. Add assert() call for this condition. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									fa1895aa2b
								
							
						
					
					
						commit
						28cc099d9e
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
					@ -553,14 +553,11 @@ static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 | 
				
			||||||
	snd_pcm_plugin_t *plugin = pcm->private_data;
 | 
						snd_pcm_plugin_t *plugin = pcm->private_data;
 | 
				
			||||||
	snd_pcm_sframes_t err;
 | 
						snd_pcm_sframes_t err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* sync with the latest hw and appl ptrs */
 | 
					 | 
				
			||||||
	snd_pcm_plugin_avail_update(pcm);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	err = snd_pcm_status(plugin->gen.slave, status);
 | 
						err = snd_pcm_status(plugin->gen.slave, status);
 | 
				
			||||||
	if (err < 0)
 | 
						if (err < 0)
 | 
				
			||||||
		return err;
 | 
							return err;
 | 
				
			||||||
	status->appl_ptr = *pcm->appl.ptr;
 | 
						assert(status->appl_ptr == *pcm->appl.ptr);
 | 
				
			||||||
	status->hw_ptr = *pcm->hw.ptr;
 | 
						snd_pcm_plugin_sync_hw_ptr(pcm, status->hw_ptr, status->avail);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue