|  | @@ -152,6 +152,11 @@ func main() {
 | 
											
												
													
														|  |  		log.Panicln("failed to set device pixel format")
 |  |  		log.Panicln("failed to set device pixel format")
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +	fps, err := device.GetFrameRate()
 | 
											
												
													
														|  | 
 |  | +	if err != nil {
 | 
											
												
													
														|  | 
 |  | +		log.Panicln("failed to get device frame rate")
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  	processorQueue := make(chan []byte, bufferSize)
 |  |  	processorQueue := make(chan []byte, bufferSize)
 | 
											
												
													
														|  |  	senderQueue := make(chan []byte, bufferSize)
 |  |  	senderQueue := make(chan []byte, bufferSize)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -176,11 +181,20 @@ func main() {
 | 
											
												
													
														|  |  	interrupt := make(chan os.Signal, 1)
 |  |  	interrupt := make(chan os.Signal, 1)
 | 
											
												
													
														|  |  	signal.Notify(interrupt, os.Interrupt)
 |  |  	signal.Notify(interrupt, os.Interrupt)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +	var frame_n uint32 = 0
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  	for {
 |  |  	for {
 | 
											
												
													
														|  |  		select {
 |  |  		select {
 | 
											
												
													
														|  |  		case frame := <-device.GetOutput():
 |  |  		case frame := <-device.GetOutput():
 | 
											
												
													
														|  | -			if len(frame) != 0 {
 |  | 
 | 
											
												
													
														|  | -				processorQueue <- frame
 |  | 
 | 
											
												
													
														|  | 
 |  | +			if len(frame) > 0 {
 | 
											
												
													
														|  | 
 |  | +				frame_n++
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +				if frame_n == fps {
 | 
											
												
													
														|  | 
 |  | +					processorQueue <- frame
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +					frame_n = 0
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		case <-interrupt:
 |  |  		case <-interrupt:
 | 
											
												
													
														|  |  			log.Println("interrupted")
 |  |  			log.Println("interrupted")
 |