mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v4l2: Drop the first frame after camera startup
A quite big number of UVC cameras - due to firmware or kernel driver issues - have bad timestamps of the first frame, confusing clients like pipewiresrc. Drop the first frame, as this seems to be the most reliable workaround for the time being. Closes https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3910
This commit is contained in:
		
							parent
							
								
									88db0a9103
								
							
						
					
					
						commit
						f9bac4889c
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -1369,6 +1369,11 @@ static int mmap_read(struct impl *this)
 | 
				
			||||||
	if (xioctl(dev->fd, VIDIOC_DQBUF, &buf) < 0)
 | 
						if (xioctl(dev->fd, VIDIOC_DQBUF, &buf) < 0)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Drop the first frame in order to work around common firmware
 | 
				
			||||||
 | 
						 * timestamp issues */
 | 
				
			||||||
 | 
						if (buf.sequence == 0)
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pts = SPA_TIMEVAL_TO_NSEC(&buf.timestamp);
 | 
						pts = SPA_TIMEVAL_TO_NSEC(&buf.timestamp);
 | 
				
			||||||
	spa_log_trace(this->log, "v4l2 %p: have output %d", this, buf.index);
 | 
						spa_log_trace(this->log, "v4l2 %p: have output %d", this, buf.index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue