mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 12:36:41 +08:00 
			
		
		
		
	fftools/ffmpeg: always read input in a thread
This will be required by the following architecture changes.
This commit is contained in:
		| @@ -3713,10 +3713,8 @@ static int init_input_thread(int i) | |||||||
|     int ret; |     int ret; | ||||||
|     InputFile *f = input_files[i]; |     InputFile *f = input_files[i]; | ||||||
|  |  | ||||||
|     if (f->thread_queue_size < 0) |     if (f->thread_queue_size <= 0) | ||||||
|         f->thread_queue_size = (nb_input_files > 1 ? 8 : 0); |         f->thread_queue_size = (nb_input_files > 1 ? 8 : 1); | ||||||
|     if (!f->thread_queue_size) |  | ||||||
|         return 0; |  | ||||||
|  |  | ||||||
|     if (f->ctx->pb ? !f->ctx->pb->seekable : |     if (f->ctx->pb ? !f->ctx->pb->seekable : | ||||||
|         strcmp(f->ctx->iformat->name, "lavfi")) |         strcmp(f->ctx->iformat->name, "lavfi")) | ||||||
| @@ -3747,13 +3745,6 @@ static int init_input_threads(void) | |||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| static int get_input_packet_mt(InputFile *f, AVPacket **pkt) |  | ||||||
| { |  | ||||||
|     return av_thread_message_queue_recv(f->in_thread_queue, pkt, |  | ||||||
|                                         f->non_blocking ? |  | ||||||
|                                         AV_THREAD_MESSAGE_NONBLOCK : 0); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static int get_input_packet(InputFile *f, AVPacket **pkt) | static int get_input_packet(InputFile *f, AVPacket **pkt) | ||||||
| { | { | ||||||
|     if (f->readrate || f->rate_emu) { |     if (f->readrate || f->rate_emu) { | ||||||
| @@ -3775,10 +3766,9 @@ static int get_input_packet(InputFile *f, AVPacket **pkt) | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (f->thread_queue_size) |     return av_thread_message_queue_recv(f->in_thread_queue, pkt, | ||||||
|         return get_input_packet_mt(f, pkt); |                                         f->non_blocking ? | ||||||
|     *pkt = f->pkt; |                                         AV_THREAD_MESSAGE_NONBLOCK : 0); | ||||||
|     return av_read_frame(f->ctx, *pkt); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static int got_eagain(void) | static int got_eagain(void) | ||||||
| @@ -4162,10 +4152,7 @@ static int process_input(int file_index) | |||||||
|     process_input_packet(ist, pkt, 0); |     process_input_packet(ist, pkt, 0); | ||||||
|  |  | ||||||
| discard_packet: | discard_packet: | ||||||
|     if (ifile->thread_queue_size) |  | ||||||
|     av_packet_free(&pkt); |     av_packet_free(&pkt); | ||||||
|     else |  | ||||||
|     av_packet_unref(pkt); |  | ||||||
|  |  | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Anton Khirnov
					Anton Khirnov