mirror of
				https://github.com/k4yt3x/video2x.git
				synced 2025-10-31 04:40:59 +01:00 
			
		
		
		
	fixed the issue where the encoder cannot exit
This commit is contained in:
		
							parent
							
								
									f7d6dc41b3
								
							
						
					
					
						commit
						29a55e633c
					
				| @ -19,7 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||
| Name: Video Encoder | ||||
| Author: K4YT3X | ||||
| Date Created: June 17, 2021 | ||||
| Last Modified: April 9, 2022 | ||||
| Last Modified: August 28, 2022 | ||||
| """ | ||||
| 
 | ||||
| import os | ||||
| @ -138,10 +138,6 @@ class VideoEncoder: | ||||
|         self.encoder.stdin.flush() | ||||
|         self.encoder.stderr.flush() | ||||
| 
 | ||||
|         # send SIGINT (2) to FFmpeg | ||||
|         # this instructs it to finalize and exit | ||||
|         self.encoder.send_signal(signal.SIGINT) | ||||
| 
 | ||||
|         # close PIPEs to prevent process from getting stuck | ||||
|         self.encoder.stdin.close() | ||||
|         self.encoder.stderr.close() | ||||
|  | ||||
| @ -27,7 +27,7 @@ __      __  _       _                  ___   __   __ | ||||
| Name: Video2X | ||||
| Creator: K4YT3X | ||||
| Date Created: February 24, 2018 | ||||
| Last Modified: April 30, 2022 | ||||
| Last Modified: August 28, 2022 | ||||
| 
 | ||||
| Editor: BrianPetkovsek | ||||
| Last Modified: June 17, 2019 | ||||
| @ -332,11 +332,6 @@ class Video2X: | ||||
|             decoder_thread.stop() | ||||
|             decoder_thread.join() | ||||
| 
 | ||||
|             # stop the encoder | ||||
|             encoder.join() | ||||
| 
 | ||||
|             logger.critical("ENCODER") | ||||
| 
 | ||||
|             # clear queue and signal processors to exit | ||||
|             # multiprocessing.Queue has no Queue.queue.clear | ||||
|             while tasks_queue.empty() is not True: | ||||
| @ -348,6 +343,9 @@ class Video2X: | ||||
|             processor_pool.close() | ||||
|             processor_pool.join() | ||||
| 
 | ||||
|             # stop the encoder | ||||
|             encoder.join() | ||||
| 
 | ||||
|             # restore original STDOUT and STDERR | ||||
|             sys.stdout = original_stdout | ||||
|             sys.stderr = original_stderr | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user