fftools/ffmpeg: discard packets for unused streams in demuxing thread
Avoids the pointless overhead of transferring them to the main thread.
This commit is contained in:
		
							parent
							
								
									a0174a235b
								
							
						
					
					
						commit
						2d43c23b81
					
				@ -1961,9 +1961,6 @@ static int process_input(int file_index)
 | 
				
			|||||||
    ist->data_size += pkt->size;
 | 
					    ist->data_size += pkt->size;
 | 
				
			||||||
    ist->nb_packets++;
 | 
					    ist->nb_packets++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ist->discard)
 | 
					 | 
				
			||||||
        goto discard_packet;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* add the stream-global side data to the first packet */
 | 
					    /* add the stream-global side data to the first packet */
 | 
				
			||||||
    if (ist->nb_packets == 1) {
 | 
					    if (ist->nb_packets == 1) {
 | 
				
			||||||
        for (i = 0; i < ist->st->nb_side_data; i++) {
 | 
					        for (i = 0; i < ist->st->nb_side_data; i++) {
 | 
				
			||||||
@ -2002,7 +1999,6 @@ static int process_input(int file_index)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    process_input_packet(ist, pkt, 0);
 | 
					    process_input_packet(ist, pkt, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
discard_packet:
 | 
					 | 
				
			||||||
    av_packet_free(&pkt);
 | 
					    av_packet_free(&pkt);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -318,7 +318,8 @@ static void *input_thread(void *arg)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        /* the following test is needed in case new streams appear
 | 
					        /* the following test is needed in case new streams appear
 | 
				
			||||||
           dynamically in stream : we ignore them */
 | 
					           dynamically in stream : we ignore them */
 | 
				
			||||||
        if (pkt->stream_index >= f->nb_streams) {
 | 
					        if (pkt->stream_index >= f->nb_streams ||
 | 
				
			||||||
 | 
					            f->streams[pkt->stream_index]->discard) {
 | 
				
			||||||
            report_new_stream(d, pkt);
 | 
					            report_new_stream(d, pkt);
 | 
				
			||||||
            av_packet_unref(pkt);
 | 
					            av_packet_unref(pkt);
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user